sf.lab.Vacuum¶
- class mrmustard.lab.Vacuum(num_modes)[source]¶
Bases:
State
The N-mode vacuum state.
Attributes
Returns the covariance matrix of the state.
Returns the Hilbert space dimension of each mode.
Returns the Fock representation of the state.
Returns whether the state is mixed.
Returns
True
if the state is pure andFalse
otherwise.Returns the means vector of the state.
Returns the modes of the state.
Returns the norm of the state.
Returns the complete photon number covariance matrix.
Returns the mean photon number for each mode.
Returns the square root of the photon number variances (standard deviation) in each mode.
The set of parameters for this state.
Returns the probability of the state.
Returns the purity of the state.
Returns the shape of the state, accounting for ket/dm representation.
- cov¶
Returns the covariance matrix of the state.
- cutoffs¶
Returns the Hilbert space dimension of each mode.
- fock¶
Returns the Fock representation of the state.
- is_mixed¶
Returns whether the state is mixed.
- is_pure¶
Returns
True
if the state is pure andFalse
otherwise.
- means¶
Returns the means vector of the state.
- modes¶
Returns the modes of the state.
- norm¶
Returns the norm of the state.
- number_cov¶
Returns the complete photon number covariance matrix.
- number_means¶
Returns the mean photon number for each mode.
- number_stdev¶
Returns the square root of the photon number variances (standard deviation) in each mode.
- parameter_set¶
The set of parameters for this state.
- probability¶
Returns the probability of the state.
- purity¶
Returns the purity of the state.
- shape¶
Returns the shape of the state, accounting for ket/dm representation.
If the state is in Gaussian representation, the shape is inferred from the first two moments of the number operator.
Methods
bargmann
([numpy])Returns the Bargmann representation of the state.
dm
([cutoffs])Returns the density matrix of the state in Fock representation.
fock_probabilities
(cutoffs)Returns the probabilities in Fock representation.
get_modes
(item)Returns the state on the given modes.
indices
(modes)Returns the indices of the given modes.
ket
([cutoffs, max_prob, max_photons])Returns the ket of the state in Fock representation or
None
if the state is mixed.primal
(other)Returns the post-measurement state after
other
is projected ontoself
.- bargmann(numpy=False)¶
Returns the Bargmann representation of the state. If numpy=True, returns the numpy arrays instead of the backend arrays.
- Return type:
Optional
[tuple
[ndarray
[Tuple
[int
,int
],TypeVar
(C
,complex64
,complex128
)],ndarray
[Tuple
[int
],TypeVar
(C
,complex64
,complex128
)],complex
]]
- dm(cutoffs=None)¶
Returns the density matrix of the state in Fock representation.
- Parameters:
List[int] (cutoffs) – The cutoff dimensions for each mode. If a mode cutoff is
None
, it’s automatically computed.- Returns:
the density matrix
- Return type:
Tensor
- fock_probabilities(cutoffs)¶
Returns the probabilities in Fock representation.
If the state is pure, they are the absolute value squared of the ket amplitudes. If the state is mixed they are the multi-dimensional diagonals of the density matrix.
- Parameters:
List[int] (cutoffs) – the cutoff dimensions for each mode
- Returns:
the probabilities
- Return type:
Tensor
- indices(modes)¶
Returns the indices of the given modes.
- Parameters:
modes (Sequence[int] or int) – the modes or mode
- Returns:
a tuple of indices of the given modes or the single index of a single mode
- Return type:
Tuple[int] or int
- ket(cutoffs=None, max_prob=1.0, max_photons=None)¶
Returns the ket of the state in Fock representation or
None
if the state is mixed.- Parameters:
None] (cutoffs List[int or) – The cutoff dimensions for each mode. If a mode cutoff is
None
, it’s guessed automatically.max_prob (float) – The maximum probability of the state. Defaults to 1.0. (used to stop the calculation of the amplitudes early)
max_photons (int) – The maximum number of photons in the state, summing over all modes (used to stop the calculation of the amplitudes early)
- Returns:
the ket
- Return type:
Tensor
- primal(other)¶
Returns the post-measurement state after
other
is projected ontoself
.other << self
is other projected ontoself
.If
other
is aTransformation
, it returns the dual of the transformation applied toself
:other << self
is likeself >> other^dual
.Note that the returned state is not normalized. To normalize a state you can use
mrmustard.physics.normalize
.- Return type: