NumberOperator

Module: pennylane

class NumberOperator(wires)[source]

The photon number observable \(\langle \hat{n}\rangle\).

The number operator is defined as \(\hat{n} = \a^\dagger \a = \frac{1}{2\hbar}(\x^2 +\p^2) -\I/2\).

When used with the expval() function, the mean photon number \(\braket{\hat{n}}\) is returned.

Details:

  • Number of wires: 1

  • Number of parameters: 0

  • Observable order: 2nd order in the quadrature operators

  • Heisenberg representation:

    \[\begin{split}M = \frac{1}{2\hbar}\begin{bmatrix} -\hbar & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
Parameters:wires (Sequence[int] or int) – the wire the operation acts on