Skip to content

dq.zeros

zeros(*dims: int, layout: Layout | None = None) -> QArray

Returns the null operator.

If multiple dimensions are provided dims=(n1,,nN)\mathtt{dims}=(n_1,\dots,n_N), it returns the null operator of the composite Hilbert space of dimension n=nkn=\prod n_k: 0n=0n10nN. 0_n = 0_{n_1}\otimes\dots\otimes 0_{n_N}.

Parameters

  • *dims

    Hilbert space dimension of each subsystem.

  • layout

    Matrix layout (dq.dense, dq.dia or None).

Returns

(qarray of shape (n, n)) Null operator, with n = prod(dims).

Examples

Single-mode 040_4:

>>> dq.zeros(4)
QArray: shape=(4, 4), dims=(4,), dtype=complex64, layout=dia, ndiags=0
[[  ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅   ]]

Multi-mode 02030_2 \otimes 0_3:

>>> dq.zeros(2, 3)
QArray: shape=(6, 6), dims=(2, 3), dtype=complex64, layout=dia, ndiags=0
[[  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]
 [  ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ]]
See also
  • dq.zeros_like(): returns the null operator in the Hilbert space of the input.