Skip to content

dq.wigner

wigner(
    state: ArrayLike,
    xmax: float = 6.0,
    ymax: float = 6.0,
    npixels: int = 201,
    xvec: ArrayLike | None = None,
    yvec: ArrayLike | None = None,
    g: float = 2.0,
) -> 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)\).

Warning

Wigner computation is not yet supported on GPU for double precision (float64). If this is needed don't hesitate to open an issue on GitHub.

Parameters

  • state (array_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,), optional) –

    \(x\) coordinates. If None, defaults to xvec = jnp.linspace(-xmax, xmax, npixels).

  • yvec (array_like of shape (nyvec,), optional) –

    \(y\) coordinates. If None, defaults to yvec = jnp.linspace(-ymax, ymax, npixels).

  • g –

    Scaling factor of Wigner quadratures, such that \(a = g(x + iy)/2\).

Returns

A tuple (xvec, yvec, w) where

  • xvec (array of shape (npixels,) or (nxvec,)) -- \(x\) coordinates, or xvec if specified.
  • yvec (array of shape (npixels,) or (nyvec,)) -- \(y\) coordinates, or yvec if specified.
  • w (array of shape (..., npixels, npixels) or (..., nyvec, nxvec)) -- Wigner distribution.