sf.physics.fock.wigner_to_fock_state¶
- mrmustard.physics.fock.wigner_to_fock_state(cov, means, shape, max_prob=1.0, max_photons=None, return_dm=True)[source]¶
Returns the Fock representation of a Gaussian state. Use with caution: if the cov matrix is that of a mixed state, setting return_dm to False will produce nonsense. If return_dm=False, we can apply max_prob and max_photons to stop the computation of the Fock representation early, when those conditions are met.
- If the state is pure it can return the state vector (ket) or the density matrix.
The index ordering is going to be [i’s] in ket_i
- If the state is mixed it can return the density matrix.
The index order is going to be [i’s,j’s] in dm_ij
- Parameters:
cov (
ndarray[Tuple[int,int],Union[TypeVar(R,float16,float32,float64),TypeVar(C,complex64,complex128),TypeVar(Z,int16,int32,int64),TypeVar(N,uint16,uint32,uint64)]]) – the Wigner covariance matrixmeans (
ndarray[Tuple[int],Union[TypeVar(R,float16,float32,float64),TypeVar(C,complex64,complex128),TypeVar(Z,int16,int32,int64),TypeVar(N,uint16,uint32,uint64)]]) – the Wigner means vectorshape (
Sequence[int]) – the shape of the tensormax_prob (
float) – the maximum probability of a the state (applies only if the ket is returned)max_photons (
Optional[int]) – the maximum number of photons in the state (applies only if the ket is returned)return_dm (
bool) – whether to return the density matrix (otherwise it returns the ket)
- Returns:
the fock representation
- Return type:
Tensor