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:
General Fock State¶
- class FockState(*, d: int, connector: BaseConnector, 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
PureFockStateinstead.- Parameters:
d (int) – The number of modes.
connector (BaseConnector) – Instance containing calculation functions.
config (Config) – Instance containing constants for the simulation.
- classmethod from_fock_state(state: BaseFockState) FockState¶
Instantiation using another
BaseFockStateinstance.- Parameters:
state (BaseFockState) – The instance from which a
FockStateinstance 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.
- 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:
- 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:
- get_purity()¶
The purity of the Fock state.
- copy() State¶
Returns an exact copy of this state.
- Returns:
An exact copy of this state.
- Return type:
- fidelity(state: BaseFockState) float¶
Calculates the state fidelity between two quantum states.
The state fidelity \(F\) between two density matrices \(\rho_1, \rho_2\) is given by:
\[\operatorname{F}(\rho_1, \rho_2) = \operatorname{Tr}(\sqrt{\sqrt{\rho_1} \rho_2\sqrt{\rho_1}})^2 = \operatorname{Tr}(\sqrt{\rho_1 \rho_2})^2\]
- wigner_function(positions: List[float], momentums: List[float], modes: Tuple[int, ...] | None = None) ndarray¶
This method calculates the Wigner function values at the specified position and momentum vectors, according to the following equation:
\[W(r) = \frac{1}{\pi^d \sqrt{\mathrm{det} \sigma}} \exp \big ( - (r - \mu)^T \sigma^{-1} (r - \mu) \big ).\]Note
The implementation is copied from QuTiP.
Note
Only single modes are supported.
- Parameters:
- Returns:
The Wigner function values in the shape of a grid specified by the input.
- Return type: