dq.zeros_like
zeros_like(
x: QArrayLike, dims: tuple[int, ...] | None = None, layout: Layout | None = None
) -> QArray
Returns the null operator in the Hilbert space of the input.
Parameters:
-
x(qarray-like of shape (..., n, 1) or (..., 1, n) or (..., n, n)) –Ket, bra or operator.
-
dims(tuple of ints or None) –Dimensions of each subsystem in the composite system Hilbert space tensor product. Defaults to
None(x.dimsif available, single Hilbert spacedims=(n,)otherwise). -
layout–Overrides the returned matrix layout. If
None, the layout is the same asx.
Returns:
-
(qarray of shape (n, n))
–
Null operator, with n = prod(dims).
Examples:
Single-mode \(0_4\):
>>> a = dq.destroy(4)
>>> dq.zeros_like(a)
QArray: shape=(4, 4), dims=(4,), dtype=complex64, layout=dia, ndiags=0
[[ â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… ]]
Multi-mode \(0_2 \otimes 0_3\):
>>> a, b = dq.destroy(2, 3)
>>> dq.zeros_like(a)
QArray: shape=(6, 6), dims=(2, 3), dtype=complex64, layout=dia, ndiags=0
[[ â‹… â‹… â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… â‹… â‹… ]
[ â‹… â‹… â‹… â‹… â‹… â‹… ]]
See also
dq.zeros(): returns the null operator.