dq.toket
toket(x: QArrayLike) -> QArray
Returns the ket representation of a pure quantum state.
Parameters
-
x
(qarray-like of shape (..., n, 1) or (..., 1, n))
–
Ket or bra.
Returns
(qarray of shape (..., n, 1)) Ket.
Examples
>>> psi = dq.fock(3, 0).tobra() # shape: (1, 3)
>>> psi
QArray: shape=(1, 3), dims=(3,), dtype=complex64, layout=dense
[[1.-0.j 0.-0.j 0.-0.j]]
>>> dq.toket(psi) # shape: (3, 1)
QArray: shape=(3, 1), dims=(3,), dtype=complex64, layout=dense
[[1.+0.j]
[0.+0.j]
[0.+0.j]]