Skip to content

dq.cat

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

Returns the ket 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.

Note

In the vanishing-amplitude limit \(\alpha\to 0\) the two coherent states collapse onto the vacuum. The returned state is then the vacuum \(\ket{0}\) for the even cat, and the single-photon Fock state \(\ket{1}\) for the odd cat (\(\theta=\pi\)), where the vacuum contributions cancel.

Returns:

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

    Ket of the cat state.

Examples:

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

>>> dq.cat(4, 2.0)
QArray: shape=(4, 1), dims=(4,), dtype=complex64, layout=dense
[[0.893+0.j]
 [0.   +0.j]
 [0.449+0.j]
 [0.   +0.j]]

Batched over the amplitude \(\{\ket{\mathrm{cat}(1, 0)}\!, \ket{\mathrm{cat}(2, 0)}\}\):

>>> dq.cat(4, [1.0, 2.0]).shape
(2, 4, 1)

Batched over the amplitude and phase, broadcast to a common shape:

>>> alpha = [1.0, 2.0, 3.0]
>>> theta = [[0.0], [3.14]]
>>> dq.cat(8, alpha, theta).shape
(2, 3, 8, 1)

Vanishing-amplitude odd cat \(\ket{\mathrm{cat}(0, \pi)} = \ket{1}\):

>>> dq.cat(4, 0.0, np.pi)
QArray: shape=(4, 1), dims=(4,), dtype=complex64, layout=dense
[[0.+0.j]
 [1.+0.j]
 [0.+0.j]
 [0.+0.j]]