Quasi-Probabilities (quanguru.QuantumToolbox.quasiProbabilities)#

Contains functions to calculate quasi-probability distributions (adapted from qutip).

Functions#

Wigner(rho, vec[, g])

An iterative method to evaluate the Wigner functions for the states \(|m \rangle \langle n|\) and use them in a weighted sum to calculate Wigner function of any arbitrary state.

HusimiQ(state, vec[, g])

Q-function of a given state vector or density matrix at points vec + i * vec

_qfuncPure(psi, alphaMat)

Calculates the Q-function for a pure state.

Function Name

Docstrings

Examples

Unit Tests

Tutorials

Wigner

      ✅

    ❌

    ❌

    ❌

HusimiQ

      ✅

    ❌

    ❌

    ❌

_qfuncPure

      ✅

    ❌

    ❌

    ❌

Wigner(rho: spmatrix | ndarray, vec: ndarray | list, g: float = np.float64(1.4142135623730951)) ndarray[source]#

An iterative method to evaluate the Wigner functions for the states \(|m \rangle \langle n|\) and use them in a weighted sum to calculate Wigner function of any arbitrary state.

The Wigner function is calculated as \(W = \sum_{mn} \rho_{mn} W_{mn}\) where \(W_{mn}\) is the Wigner function for the density matrix \(|m \rangle \langle n|\).

In this implementation, for each row m, Wlist contains the Wigner functions Wlist = \([0, ..., W_{mm} , ..., W_{mN} ]\). As soon as one \(W_{mn}\) Wigner function is calculated, the corresponding contribution is added to the total Wigner function, weighted by the corresponding element in the density matrix \(\\rho_{mn}\).

Parameters:
  • rho (Matrix) – Density matrix or ket state.

  • vec (ndOrList) – An array (or list) to define the (coarse-grained) Phase space. This creates a square grid of the phase space.

  • g (float) – Scaling factor for a = 0.5 * g * (x + iy), default g = sqrt(2).

Returns:

Values representing the Wigner-function calculated over the specified range [vec, vec].

Return type:

ndarray

Examples

# TODO

HusimiQ(state: spmatrix | ndarray, vec: ndarray | list, g: float = np.float64(1.4142135623730951)) ndarray[source]#

Q-function of a given state vector or density matrix at points vec + i * vec

Parameters:
  • rho (Matrix) – density matrix or ket state

  • vec (ndOrList) – An array (or list) to define the (coarse-grained) Phase space. This creates a square grid of the phase space.

  • g (float) – Scaling factor for a = 0.5 * g * (x + iy), default g = sqrt(2).

Returns:

Values representing the Q-function calculated over the specified range [vec, vec].

Return type:

array

Examples

# TODO

_qfuncPure(psi: spmatrix | ndarray, alphaMat: ndarray) ndarray[source]#

Calculates the Q-function for a pure state.

Parameters:
  • psi (Matrix) – a pure state

  • vec (ndOrList) – an array (or list) to define the (coarse-grained) Phase space. This creates a square grid of the phase space.

  • g (float) – Scaling factor for a = 0.5 * g * (x + iy), default g = sqrt(2).

Returns:

Values representing the Q-function calculated over the specified range [vec, vec].

Return type:

array

Examples

# TODO