Fock

This module contains functions for performing calculations on Fock states.

Functions

U_to_choi(U)

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

dm_to_ket(dm)

Maps a density matrix to a ket if the state is pure.

dm_to_probs(dm)

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.

fock_state(n)

Returns a pure or mixed Fock state.

is_mixed_dm(dm)

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.

ket_to_probs(ket)

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) = <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><x_\phi| ]\) where rho is the density matrix of the state and |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><x_\phi| ]\) where rho is the reduced density matrix of the state.

tensor_int_cache(fn)

Decorator function to cache functions with a 1D Tensor (Vector) and int as arguments, that is, functions with signature func(x: Vector, n: int).

trace(dm, keep)

Computes the partial trace of a density matrix.

validate_contraction_indices(in_idx, ...)

Validates the indices used for the contraction of a tensor.

wigner_to_bargmann_Choi(X, Y, d)

Converts the wigner representation in terms of covariance matrix and mean vector into the Bargmann A,B,C triple for a channel (i.e.

wigner_to_bargmann_U(X, d)

Converts the wigner representation in terms of covariance matrix and mean vector into the Bargmann A,B,C triple for a unitary (i.e.

wigner_to_bargmann_psi(cov, means)

Converts the wigner representation in terms of covariance matrix and mean vector into the Bargmann A,B,C triple for a Hilbert vector (i.e.

wigner_to_bargmann_rho(cov, means)

Converts the wigner representation in terms of covariance matrix and mean vector into the Bargmann A,B,C triple for a density matrix (i.e.

wigner_to_fock_Choi(X, Y, d, shape)

Returns the Fock representation of a Gaussian Choi matrix.

wigner_to_fock_U(X, d, shape)

Returns the Fock representation of a Gaussian unitary transformation.

wigner_to_fock_state(cov, means, shape[, ...])

Returns the Fock representation of a Gaussian state.

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.