Skip to content

dq.quadrature

quadrature(
    dim: int, phi: float, *, layout: Layout | None = None, hbar: float = 0.5
) -> QArray

Returns the quadrature operator of phase angle \(\phi\).

It is defined by \(x_\phi = \sqrt{\hbar/2}\,(e^{i\phi} a^\dag + e^{-i\phi} a)\), where \(a\) and \(a^\dag\) are the annihilation and creation operators respectively.

Parameters:

  • dim –

    Dimension of the Hilbert space.

  • phi –

    Phase angle.

  • layout –

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

  • hbar –

    Value of \(\hbar\) in the commutation relation \([\hat{x}, \hat{p}] = i\hbar\). Common choices are 0.5 (default), 1.0, and 2.0.

Returns:

  • (qarray of shape (dim, dim)) –

    Quadrature operator.

Examples:

>>> dq.quadrature(3, 0.0)
QArray: shape=(3, 3), dims=(3,), dtype=complex64, layout=dia, ndiags=2
[[    â‹…     0.5  +0.j     â‹…    ]
 [0.5  +0.j     â‹…     0.707+0.j]
 [    â‹…     0.707+0.j     â‹…    ]]
>>> dq.quadrature(3, jnp.pi / 2)
QArray: shape=(3, 3), dims=(3,), dtype=complex64, layout=dia, ndiags=2
[[   â‹…       -0.-0.5j      â‹…      ]
 [-0.+0.5j      â‹…       -0.-0.707j]
 [   â‹…       -0.+0.707j    â‹…      ]]