Fock States#

Warning

The ordering of the Fock basis is increasing with particle numbers, and in each particle number conserving subspace, lexicographic ordering is used.

Example for 3 modes:

\[| 000 \rangle, | 001 \rangle, | 010 \rangle, | 100 \rangle, | 002 \rangle, | 011 \rangle, | 020 \rangle, | 101 \rangle, | 110 \rangle, | 200 \rangle \dots\]

General Fock State#

class FockState(*, d: int, calculator: BaseCalculator, config: Config | None = None)#

Object to represent a general bosonic state in the Fock basis.

Note

If you only work with pure states, it is advised to use PureFockState instead.

Parameters:
  • d (int) – The number of modes.

  • calculator (BaseCalculator) – Instance containing calculation functions.

  • config (Config) – Instance containing constants for the simulation.

reset() None#

Resets the Fock state to a vacuum state.

classmethod from_fock_state(state: BaseFockState) FockState#

Instantiation using another BaseFockState instance.

Parameters:

state (BaseFockState) – The instance from which a FockState instance is created.

property nonzero_elements: Generator[Tuple[complex, Tuple], Any, None]#

The nonzero contributions to the state representation in Fock basis.

property density_matrix: ndarray#

The density matrix of the state in terms of the Fock basis vectors.

get_particle_detection_probability(occupation_number: ndarray) float#

Returns the particle number detection probability using the occupation number specified as a parameter.

Parameters:

occupation_number (tuple) – Tuple of natural numbers representing the number of particles in each mode.

Returns:

The probability of detection.

Return type:

float

property fock_probabilities: ndarray#

Returns the particle detection probabilities.

Note

The ordering of the Fock basis is increasing with particle numbers, and in each particle number conserving subspace, lexicographic ordering is used.

Returns:

The particle detection probabilities.

Return type:

numpy.ndarray

property fock_probabilities_map: Dict[Tuple[int, ...], float]#

The particle number detection probabilities in a map.

reduced(modes: Tuple[int, ...]) FockState#

Reduces the state to a subsystem corresponding to the specified modes.

normalize() None#

Normalizes the density matrix to have a trace of 1.

Raises:

RuntimeError – Raised if the current norm of the state is too close to 0.

validate() None#

Validates the represented state.

Raises:

InvalidState – Raised, if the density matrix is not positive semidefinite, not self-adjoint or the trace of the density matrix is not 1.

quadratures_mean_variance(modes: Tuple[int, ...], phi: float = 0) Tuple[float, float]#

This method calculates the mean and the variance of the qudrature operators for a single qumode state. The quadrature operators \(x\) and \(p\) for a mode \(i\) can be calculated using the creation and annihilation operators as follows:

\[\begin{split}x_i &= \sqrt{\frac{\hbar}{2}} (a_i + a_i^\dagger) \\ p_i &= -i \sqrt{\frac{\hbar}{2}} (a_i - a_i^\dagger).\end{split}\]

Let \(\phi \in [ 0, 2 \pi )\), we can rotate the quadratures using the following transformation:

\[Q_{i, \phi} = \cos\phi~x_i + \sin\phi~p_i.\]

The expectation value \(\langle Q_{i, \phi}\rangle\) can be calculated as:

\[\operatorname{Tr}(\rho_i Q_{i, \phi}),\]

where \(\rho_i\) is the reduced density matrix of the mode \(i\) and \(Q_{i, \phi}\) is the rotated quadrature operator for a single mode and the variance is calculated as:

\[\operatorname{\textit{Var}(Q_{i,\phi})} = \langle Q_{i, \phi}^{2}\rangle - \langle Q_{i, \phi}\rangle^{2}.\]
Parameters:
  • phi (float) – The rotation angle. By default it is 0 which means that the mean of the position operator is being calculated. For \(\phi= \frac{\pi}{2}\) the mean of the momentum operator is being calculated.

  • modes (tuple[int]) – The correspoding mode at which the mean of the quadratures are being calculated.

Returns:

A tuple that contains the expectation value and the

varianceof of the quadrature operator respectively.

Return type:

(float, float)

Pure Fock State#

class PureFockState(*, d: int, calculator: BaseCalculator, config: Config | None = None)#

A simulated pure Fock state.

If no mixed states are needed for a Fock simulation, then this state is the most appropriate currently, since it does not store an entire density matrix, only a state vector with size

\[{d + c - 1 \choose c - 1},\]

where \(c \in \mathbb{N}\) is the Fock space cutoff.

Variables:

state_vector – The state vector of the quantum state.

Parameters:
  • d (int) – The number of modes.

  • calculator (BaseCalculator) – Instance containing calculation functions.

  • config (Config) – Instance containing constants for the simulation.

reset() None#

Resets the Fock state to a vacuum state.

property nonzero_elements#

The nonzero contributions to the state representation in Fock basis.

property density_matrix: ndarray#

The density matrix of the state in terms of the Fock basis vectors.

reduced(modes: Tuple[int, ...]) FockState#

Reduces the state to a subsystem corresponding to the specified modes.

get_particle_detection_probability(occupation_number: ndarray) float#

Returns the particle number detection probability using the occupation number specified as a parameter.

Parameters:

occupation_number (tuple) – Tuple of natural numbers representing the number of particles in each mode.

Returns:

The probability of detection.

Return type:

float

property fock_probabilities: ndarray#

Returns the particle detection probabilities.

Note

The ordering of the Fock basis is increasing with particle numbers, and in each particle number conserving subspace, lexicographic ordering is used.

Returns:

The particle detection probabilities.

Return type:

numpy.ndarray

property fock_probabilities_map: Dict[Tuple[int, ...], float]#

The particle number detection probabilities in a map.

normalize() None#

Normalizes the state to have norm 1.

validate() None#

Validates the represented state.

Raises:

InvalidState – Raised, if the norm of the state vector is not close to 1.0.

quadratures_mean_variance(modes: Tuple[int, ...], phi: float = 0) Tuple[float, float]#

This method calculates the mean and the variance of the qudrature operators for a single qumode state. The quadrature operators \(x\) and \(p\) for a mode \(i\) can be calculated using the creation and annihilation operators as follows:

\[\begin{split}x_i &= \sqrt{\frac{\hbar}{2}} (a_i + a_i^\dagger) \\ p_i &= -i \sqrt{\frac{\hbar}{2}} (a_i - a_i^\dagger).\end{split}\]

Let \(\phi \in [ 0, 2 \pi )\), we can rotate the quadratures using the following transformation:

\[Q_{i, \phi} = \cos\phi~x_i + \sin\phi~p_i.\]

The expectation value \(\langle Q_{i, \phi}\rangle\) can be calculated as:

\[\operatorname{Tr}(\rho_i Q_{i, \phi}),\]

where \(\rho_i\) is the reduced density matrix of the mode \(i\) and \(Q_{i, \phi}\) is the rotated quadrature operator for a single mode and the variance is calculated as:

\[\operatorname{\textit{Var}(Q_{i,\phi})} = \langle Q_{i, \phi}^{2}\rangle - \langle Q_{i, \phi}\rangle^{2}.\]
Parameters:
  • phi (float) – The rotation angle. By default it is 0 which means that the mean of the position operator is being calculated. For \(\phi= \frac{\pi}{2}\) the mean of the momentum operator is being calculated.

  • modes (tuple[int]) – The correspoding mode at which the mean of the quadratures are being calculated.

Returns:

A tuple that contains the expectation value and the

varianceof of the quadrature operator respectively.

Return type:

(float, float)