Skip to content

dq.tobra

tobra(x: QArrayLike) -> QArray

Returns the bra representation of a pure quantum state.

Parameters

  • x (qarray-like of shape (..., n, 1) or (..., 1, n)) –

    Ket or bra.

Returns

(qarray of shape (..., 1, n)) Qarray.

Examples

>>> psi = dq.fock(3, 0)  # shape: (3, 1)
>>> psi
QArray: shape=(3, 1), dims=(3,), dtype=complex64, layout=dense
[[1.+0.j]
 [0.+0.j]
 [0.+0.j]]
>>> dq.tobra(psi)  # shape: (1, 3)
QArray: shape=(1, 3), dims=(3,), dtype=complex64, layout=dense
[[1.-0.j 0.-0.j 0.-0.j]]