dq.parity
parity(dim: int) -> Array
Returns the parity operator of a bosonic mode.
It is defined by \(P = e^{i\pi a^\dag a}\), where \(a\) and \(a^\dag\) are the annihilation and creation operators, respectively.
Parameters
-
dim
–
Dimension of the Hilbert space.
Returns
(array of shape (dim, dim)) Parity operator.
Examples
>>> dq.parity(4)
Array([[ 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
[ 0.+0.j, -1.+0.j, 0.+0.j, 0.+0.j],
[ 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j],
[ 0.+0.j, 0.+0.j, 0.+0.j, -1.+0.j]], dtype=complex64)