Fock Utilities¶
Transforms the |
|
Helper function for |
|
Estimates a suitable quadrature discretization interval dx. |
|
Generates a suitable quadrature axis. |
|
Estimates a suitable quadrature axis length. |
|
Computes the fidelity between two states in Fock representation. |
|
The Fock array of a batchable single-mode |
|
Helper function for |
|
Harmonic oscillator eigenstate wavefunction psi_n(q) = <n|q>. |
|
Given the Fock basis representation return the quadrature basis representation. |
|
Given the ket or density matrix of a single-mode state, it generates the probability density distribution \(\tr [ \rho |x_\phi><x_\phi| ]\) where |
c_in_PS¶
c_ps_matrix¶
estimate_dx¶
- mrmustard.physics.fock_utils.estimate_dx(cutoff, period_resolution=20)[source]¶
Estimates a suitable quadrature discretization interval dx. Uses the fact that Fock state n oscillates with angular frequency \(\sqrt{2(n + 1)}\), which follows from the relation.
\[\psi^{[n]}'(q) = q - sqrt(2*(n + 1))*\psi^{[n+1]}(q)\]by setting q = 0, and approximating the oscillation amplitude by psi^{[n+1]}(0).
Ref: https://en.wikipedia.org/wiki/Hermite_polynomials#Hermite_functions
- Parameters:
cutoff (int) – Fock cutoff
period_resolution (int) – Number of points used to sample one Fock wavefunction oscillation. Larger values yields better approximations and thus smaller dx.
- Returns:
discretization value of quadrature
- Return type:
(float)
estimate_quadrature_axis¶
- mrmustard.physics.fock_utils.estimate_quadrature_axis(cutoff, minimum=5, period_resolution=20)[source]¶
Generates a suitable quadrature axis.
- Parameters:
cutoff (int) – Fock cutoff
minimum (float) – Minimum value of the returned xmax
period_resolution (int) – Number of points used to sample one Fock wavefunction oscillation. Larger values yields better approximations and thus smaller dx.
- Returns:
quadrature axis
- Return type:
(array)
estimate_xmax¶
fidelity¶
fock_state¶
- mrmustard.physics.fock_utils.fock_state(n, cutoff=None)[source]¶
The Fock array of a batchable single-mode
Numberstate.- Parameters:
n (int | Sequence[int]) – The photon number of the number state. Can be a single integer or a batch of integers.
cutoff (int | None) – The cutoff of the Fock array.
- Returns:
The Fock array of a batchable single-mode
Numberstate.- Return type:
gamma_matrix¶
oscillator_eigenstate¶
- mrmustard.physics.fock_utils.oscillator_eigenstate(q, cutoff)[source]¶
Harmonic oscillator eigenstate wavefunction psi_n(q) = <n|q>.
- Parameters:
q (Vector) – array of q points at which the function is evaluated (units of sqrt{hbar}). Can have any shape; the result has shape
(cutoff, *q.shape).cutoff (int) – Fock space dimension (shape). Note: despite the parameter name, this is the shape (cutoff + 1), not the max photon number. Callers pass shape values here.
- Returns:
- shape
(cutoff, *q.shape). Entry[n, ...]is \(\psi_n\) evaluated at the corresponding points of q.
- shape
- Return type:
Details and Conventions
Definition
The q-quadrature eigenstates are defined as
\[\psi_n(x) = 1/sqrt[2^n n!](\frac{\omega}{\pi \hbar})^{1/4} \exp{-\frac{\omega}{2\hbar} x^2} H_n(\sqrt{\frac{\omega}{\pi}} x)\]where \(H_n(x)\) is the (physicists) n-th Hermite polynomial.
quadrature_basis¶
quadrature_distribution¶
- mrmustard.physics.fock_utils.quadrature_distribution(state, quadrature_angle=0.0, x=None)[source]¶
Given the ket or density matrix of a single-mode state, it generates the probability density distribution \(\tr [ \rho |x_\phi><x_\phi| ]\) where
\rhois the density matrix of the state and|x_\phi>the quadrature eigenvector with angle\phiequal toquadrature_angle.- Parameters:
- Returns:
The coordinates at which the pdf is evaluated and the probability distribution.