Skip to content

dq.cat_dm

cat_dm(dim: int, alpha: ArrayLike, theta: ArrayLike = 0.0) -> QArray

Returns the density matrix of a Schrödinger cat state.

A cat state is the superposition of two coherent states of opposite amplitudes, $$ \ket{\mathrm{cat}(\alpha, \theta)} \propto \ket{\alpha} + e^{i\theta} \ket{-\alpha}, $$ where \(\theta=0\) gives the even cat state and \(\theta=\pi\) the odd cat state.

Parameters:

  • dim –

    Hilbert space dimension of the mode.

  • alpha (array-like of shape (...)) –

    Coherent state amplitude.

  • theta (array-like of shape (...)) –

    Relative phase between the two coherent states.

Note

Arguments alpha and theta are broadcast together following NumPy broadcasting rules, allowing batching over either or both.

Returns:

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

    Density matrix of the cat state.

Examples:

Even cat state \(\ket{\mathrm{cat}(2, 0)}\bra{\mathrm{cat}(2, 0)}\):

>>> dq.cat_dm(4, 2.0)
QArray: shape=(4, 4), dims=(4,), dtype=complex64, layout=dense
[[0.798+0.j 0.   +0.j 0.401+0.j 0.   +0.j]
 [0.   +0.j 0.   +0.j 0.   +0.j 0.   +0.j]
 [0.401+0.j 0.   +0.j 0.202+0.j 0.   +0.j]
 [0.   +0.j 0.   +0.j 0.   +0.j 0.   +0.j]]

Batched over the phase \(\{\ket{\mathrm{cat}(2, 0)}\bra{\mathrm{cat}(2, 0)}\!, \ket{\mathrm{cat}(2, \pi)}\bra{\mathrm{cat}(2, \pi)}\}\):

>>> import numpy as np
>>> dq.cat_dm(4, 2.0, [0.0, np.pi]).shape
(2, 4, 4)