Module: pennylane

class CatState(a, phi, p, wires)[source]

Prepares a cat state.

A cat state is the coherent superposition of two coherent states,

\[\ket{\text{cat}(\alpha)} = \frac{1}{N} (\ket{\alpha} +e^{ip\pi} \ket{-\alpha}),\]

where \(\ket{\pm\alpha} = D(\pm\alpha)\ket{0}\) are coherent states with displacement parameters \(\pm\alpha=\pm ae^{i\phi}\) and \(N = \sqrt{2 (1+\cos(p\pi)e^{-2|\alpha|^2})}\) is the normalization factor.


  • Number of wires: 1
  • Number of parameters: 3
  • Gradient recipe: None (uses finite difference)
  • a (float) – displacement magnitude \(a=|\alpha|\)
  • phi (float) – displacement angle \(\phi\)
  • p (float) – parity, where \(p=0\) corresponds to an even cat state, and \(p=1\) an odd cat state.
  • wires (Sequence[int] or int) – the wire the operation acts on