Calculations on Fock objects

This module contains functions for performing calculations on objects in the Fock representations.

Functions

U_to_choi(U[, Udual])

Converts a unitary transformation to a Choi tensor.

apply_choi_to_dm(choi, dm, choi_in_modes[, ...])

Applies a choi operator to a density matrix.

apply_choi_to_ket(choi, ket, choi_in_modes)

Applies a choi operator to a ket.

apply_kraus_to_dm(kraus, dm, kraus_in_modes)

Applies a kraus operator to a density matrix.

apply_kraus_to_ket(kraus, ket, kraus_in_modes)

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.

beamsplitter(*args, **kwargs)

contract_states(stateA, stateB, a_is_dm, ...)

Contracts two states in the specified modes.

displacement(*args, **kwargs)

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_state(n)

Returns a pure or mixed Fock state.

is_mixed_dm(dm)

Evaluates if a density matrix represents a mixed state.

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])

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.

squeezed(*args, **kwargs)

squeezer(*args, **kwargs)

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. for M modes, A has shape 4M x 4M and B has shape 4M).

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. for M modes, A has shape 2M x 2M and B has shape 2M).

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. for M modes, A has shape M x M and B has shape M).

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. for M modes, A has shape 2M x 2M and B has shape 2M).

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

ComplexTensor

ndarray(shape, dtype=float, buffer=None, offset=0,

List

A generic version of list.

Matrix

ndarray(shape, dtype=float, buffer=None, offset=0,

Optional

Optional[X] is equivalent to Union[X, None].

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.

Tensor

ndarray(shape, dtype=float, buffer=None, offset=0,

Tuple

Deprecated alias to builtins.tuple.

Vector

ndarray(shape, dtype=float, buffer=None, offset=0,

math

A class to manage the different backends supported by Mr Mustard.

settings

A class containing various settings that are used by Mr Mustard throughout a session.