dq.wigner
wigner(
state: QArrayLike,
xmax: float = 6.0,
ymax: float = 6.0,
npixels: int = 201,
xvec: ArrayLike | None = None,
yvec: ArrayLike | None = None,
hbar: float = 0.5,
) -> tuple[Array, Array, Array]
Compute the Wigner distribution of a ket or density matrix.
The Wigner distribution is computed on a grid of coordinates \((x, y)\).
Parameters:
-
state(qarray-like of shape (..., n, 1) or (..., n, n)) –Ket or density matrix.
-
xmax–Maximum absolute value of the \(x\) coordinate.
-
ymax–Maximum absolute value of the \(y\) coordinate.
-
npixels–Number of pixels in each direction.
-
xvec(array-like of shape (nxvec,)) –\(x\) coordinates. If
None, defaults toxvec = jnp.linspace(-xmax, xmax, npixels). -
yvec(array-like of shape (nyvec,)) –\(y\) coordinates. If
None, defaults toyvec = jnp.linspace(-ymax, ymax, npixels). -
hbar–Value of \(\hbar\) in the commutation relation \([\hat{x}, \hat{p}] = i\hbar\). Common choices are
0.5(default, coherent state \(\ket{\alpha}\) centered at \((\mathrm{Re}(\alpha), \mathrm{Im}(\alpha))\)),1.0, and2.0.
Returns:
-
xvec(array of shape (npixels,) or (nxvec,)) –\(x\) coordinates, or
xvecif specified. -
yvec(array of shape (npixels,) or (nyvec,)) –\(y\) coordinates, or
yvecif specified. -
w(array of shape (..., npixels, npixels) or (..., nyvec, nxvec)) –Wigner distribution.
See also
dq.plot.wigner(): plot the Wigner function of a state.dq.plot.wigner_data(): plot a pre-computed Wigner function.