Skip to content

dq.toket

toket(x: ArrayLike) -> Array

Returns the ket representation of a pure quantum state.

Parameters

  • x (array_like of shape (..., n, 1) or (..., 1, n))

    Ket or bra.

Returns

(array of shape (..., n, 1)) Ket.

Examples

>>> psi = dq.tobra(dq.fock(3, 0))  # shape: (1, 3)
>>> psi
Array([[1.-0.j, 0.-0.j, 0.-0.j]], dtype=complex64)
>>> dq.toket(psi)  # shape: (3, 1)
Array([[1.+0.j],
       [0.+0.j],
       [0.+0.j]], dtype=complex64)