# Fock¶

This module contains functions for performing calculations on Fock states.

## Functions¶

 Converts a unitary transformation to a Choi tensor. apply_choi_to_dm(choi, dm, choi_in_idx[, ...]) Applies a choi operator to a density matrix. apply_choi_to_ket(choi, ket, choi_in_idx[, ...]) Applies a choi operator to a ket. apply_kraus_to_dm(kraus, dm, kraus_in_idx[, ...]) Applies a kraus operator to a density matrix. apply_kraus_to_ket(kraus, ket, kraus_in_idx) Applies a kraus operator to a ket. autocutoffs(cov, means, probability) Returns the cutoffs of a Gaussian state by computing the 1-mode marginals until the probability of the marginal is less than probability. contract_states(stateA, stateB, a_is_dm, ...) Contracts two states in the specified modes. displacement(r, phi, cutoff[, tol]) creates a single mode displacement matrix Maps a density matrix to a ket if the state is pure. Extracts the diagonals of a density matrix. estimate_dx(cutoff[, period_resolution]) Estimates a suitable quadrature discretization interval dx. estimate_quadrature_axis(cutoff[, minimum, ...]) Generates a suitable quadrature axis. estimate_xmax(cutoff[, minimum]) Estimates a suitable quadrature axis length fidelity(state_a, state_b, a_ket, b_ket) Computes the fidelity between two states in Fock representation. fock_representation_diagonal_amps(A, B, G0, ...) First initialise the submatrices of G (of which the shape depends on cutoff and M) and some other constants (These initialisations currently cannot be done using Numba.) Then calculate the fock representation. Returns a pure or mixed Fock state. Evaluates if a density matrix represents a mixed state. jit([signature_or_function, locals, cache, ...]) This decorator is used to compile a Python function into native code. ket_to_dm(ket) Maps a ket to a density matrix. Maps a ket to probabilities. lru_cache([maxsize, typed]) Least-recently-used cache decorator. norm(state, is_dm) Returns the norm of a ket or the trace of the density matrix. normalize(fock, is_dm) Returns the normalized ket state. number_means(tensor, is_dm) Returns the mean of the number operator in each mode. number_variances(tensor, is_dm) Returns the variance of the number operator in each mode. oscillator_eigenstate(q, cutoff) Harmonic oscillator eigenstate wavefunction psi_n(q) = . purity(dm) Returns the purity of a density matrix. quadrature_distribution(state[, ...]) Given the ket or density matrix of a single-mode state, it generates the probability density distribution \(\tr [ \rho |x_\phi> the quadrature eigenvector with angle phi equal to quadrature_angle. sample_homodyne(state[, quadrature_angle, hbar]) Given a single-mode state, it generates the pdf of \(\tr [ \rho |x_\phi>

## Variables¶

 List A generic version of list. Optional Optional type. SQRT ndarray(shape, dtype=float, buffer=None, offset=0, Scalar alias of Union[R, C, Z, N] Sequence A generic version of collections.abc.Sequence. Tuple Tuple type; Tuple[X, Y] is the cross-product type of X and Y. math Tensorflow implemantion of the Math interface. settings Settings class.