Skip to content

dq.quadrature

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

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

It is defined by \(x_\phi = (e^{i\phi} a^\dag + e^{-i\phi} a) / 2\), 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).

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    â‹…      ]]