Full API
Autogenerated API list
Gabs.GaussianChannel
— TypeDefines a Gaussian channel for an N-mode bosonic system over a 2N-dimensional phase space.
Fields
basis
: Symplectic representation for Gaussian channel.disp
: The displacement vector of length 2N.transform
: The transformation matrix of size 2N x 2N.noise
: The noise matrix of size 2N x 2N.ħ = 2
: Reduced Planck's constant.
Mathematical description of a Gaussian channel
An N
-mode Gaussian channel is an operator characterized by a displacement vector d
of length 2N
, as well as a transformation matrix T
and noise matrix N
of size 2N x 2N
, such that its action on a Gaussian state results in a Gaussian state. More specifically, a Gaussian channel action on a Gaussian state is described by its maps on the statistical moments x̄
and V
of the Gaussian state: x̄ → Tx̄ + d
and V → TVTᵀ + N
.
Example
julia> noise = [1.0 -3.0; 4.0 2.0];
julia> displace(QuadPairBasis(1), 1.0+im, noise)
GaussianChannel for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
2.0
2.0
transform: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
noise: 2×2 Matrix{Float64}:
1.0 -3.0
4.0 2.0
Gabs.GaussianLinearCombination
— TypeGaussianLinearCombination{B<:SymplecticBasis,C,S}
Represents a linear combination of Gaussian states of the form Σᵢ cᵢ|ψᵢ⟩
where cᵢ
are coefficients and |ψᵢ⟩
are Gaussian states, all sharing the same symplectic basis and ħ
value.
Fields
basis::B
: Symplectic basis shared by all statescoeffs::Vector{C}
: Complex coefficients for the linear combinationstates::Vector{S}
: Vector of Gaussian statesħ::Number
: Reduced Planck's constant (must be same for all states)
Examples
julia> basis = QuadPairBasis(1) QuadPairBasis(1)
julia> state1 = coherentstate(basis, 1.0) GaussianState for 1 mode. symplectic basis: QuadPairBasis mean: 2-element Vector{Float64}: 2.0 0.0 covariance: 2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0
julia> state2 = coherentstate(basis, -1.0) GaussianState for 1 mode. symplectic basis: QuadPairBasis mean: 2-element Vector{Float64}: -2.0 0.0 covariance: 2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0
julia> cat_state = 0.5 * state1 + 0.5 * state2 GaussianLinearCombination with 2 terms for 1 mode. symplectic basis: QuadPairBasis ħ = 2
[1] 0.5 * GaussianState [2] 0.5 * GaussianState
julia> lcgs = GaussianLinearCombination([0.6, 0.8], [state1, state2]) GaussianLinearCombination with 2 terms for 1 mode. symplectic basis: QuadPairBasis ħ = 2
[1] 0.6 * GaussianState [2] 0.8 * GaussianState
Gabs.GaussianLinearCombination
— MethodGaussianLinearCombination(pairs::Pair{<:Number,<:GaussianState}...)
Create a linear combination from coefficient => state pairs.
Gabs.GaussianLinearCombination
— MethodGaussianLinearCombination(coeffs::Vector{<:Number}, states::Vector{<:GaussianState})
Create a linear combination from separate vectors of coefficients and states.
Gabs.GaussianLinearCombination
— MethodGaussianLinearCombination(pairs::Vector{<:Tuple})
Create a linear combination from a vector of (coefficient, state) tuples.
Gabs.GaussianLinearCombination
— MethodGaussianLinearCombination(state::GaussianState)
Create a linear combination containing a single Gaussian state with coefficient 1.0.
Gabs.GaussianState
— TypeDefines a Gaussian state for an N-mode bosonic system over a 2N-dimensional phase space.
Fields
basis
: Symplectic basis for Gaussian state.mean
: The mean vector of length 2N.covar
: The covariance matrix of size 2N x 2N.ħ = 2
: Reduced Planck's constant.
Example
julia> coherentstate(QuadPairBasis(1), 1.0+im)
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
2.0
2.0
covariance: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
Gabs.GaussianUnitary
— TypeDefines a Gaussian unitary for an N-mode bosonic system over a 2N-dimensional phase space.
Fields
basis
: Symplectic basis for Gaussian unitary.disp
: The displacement vector of length 2N.symplectic
: The symplectic matrix of size 2N x 2N.ħ = 2
: Reduced Planck's constant.
Mathematical description of a Gaussian unitary
An N
-mode Gaussian unitary, is a unitary operator characterized by a displacement vector d
of length 2N
and symplectic matrix S
of size 2N x 2N
, such that its action on a Gaussian state results in a Gaussian state. More specifically, a Gaussian unitary transformation on a Gaussian state is described by its maps on the statistical moments x̄
and V
of the Gaussian state: x̄ → Sx̄ + d
and V → SVSᵀ
.
Example
julia> displace(QuadPairBasis(1), 1.0+im)
GaussianUnitary for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
2.0
2.0
symplectic: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
Gabs.QuadBlockBasis
— TypeDefines a symplectic basis for a bosonic system of size nmodes
in which the quadrature field operators are arranged blockwise.
Gabs.QuadPairBasis
— TypeDefines a symplectic basis for a bosonic system of size nmodes
in which the quadrature field operators are arranged pairwise.
Gabs.amplifier
— Methodamplifier([Td=Vector{Float64}, Tt=Matrix{Float64},] basis::SymplecticBasis, r<:Real, n<:Int)
Gaussian channel describing the interaction of an input single mode Gaussian state and its environment via a two-mode squeezing operation. The channel is paramatrized by squeezing amplitude parameter r
and thermal noise n
.
Mathematical description of an amplifier channel
An amplifier channel, A(r, nₜₕ)
, where r
is the squeezing amplitude parameter and nₜₕ ≥ 1
is the thermal noise parameter, is characterized by the zero displacement vector, transformation matrix cosh(r)I
, and noise matrix nₜₕsinh²(r)I
.
Example
julia> amplifier(QuadPairBasis(1), 2.0, 3)
GaussianChannel for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
0.0
0.0
transform: 2×2 Matrix{Float64}:
3.7622 0.0
0.0 3.7622
noise: 2×2 Matrix{Float64}:
39.4623 0.0
0.0 39.4623
Gabs.attenuator
— Methodattenuator([Td=Vector{Float64}, Tt=Matrix{Float64},] basis::SymplecticBasis, theta<:Real, n<:Int)
Gaussian channel describing the coupling of an input single mode Gaussian state and its environment via a beam splitter operation. The channel is paramatrized by beam splitter rotation angle theta
and thermal noise n
.
Mathematical description of an attenuator channel
An attenuator channel, E(θ, nₜₕ)
, where θ
is the beam splitter rotation parameter and nₜₕ ≥ 1
is the thermal noise parameter, is characterized by the zero displacement vector, transformation matrix cos(θ)I
, and noise matrix nₜₕsin²(θ)I
.
Example
julia> attenuator(QuadPairBasis(1), pi/6, 3)
GaussianChannel for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
0.0
0.0
transform: 2×2 Matrix{Float64}:
0.866025 0.0
0.0 0.866025
noise: 2×2 Matrix{Float64}:
0.75 0.0
0.0 0.75
Gabs.beamsplitter
— Methodbeamsplitter([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, transmit<:Real)
beamsplitter([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, transmit<:Real, noise::Ts)
Gaussian operator that serves as the beam splitter transformation of a two-mode Gaussian state, known as the beam splitter operator. The symplectic representation is given by basis
. The transmittivity of the operator is given by transmit
. Noise can be added to the operation with noise
.
Mathematical description of a beam splitter operator
A beam splitter operator B(τ)
is defined by the operation B(τ) = exp(θ(âᵗb̂ - âb̂ᵗ))
, where θ
is defined by τ = cos²θ
, and â
and b̂
are the annihilation operators of the two modes, respectively. The operator B(τ)
is characterized by the zero displacement vector and symplectic matrix [√τI √(1-τ)I; -√(1-τ)I √τI]
.
Example
julia> beamsplitter(QuadPairBasis(2), 0.75)
GaussianUnitary for 2 modes.
symplectic basis: QuadPairBasis
displacement: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
symplectic: 4×4 Matrix{Float64}:
0.5 0.0 0.866025 0.0
0.0 0.5 0.0 0.866025
-0.866025 0.0 0.5 0.0
0.0 -0.866025 0.0 0.5
Gabs.catstate
— Functioncatstate(basis::SymplecticBasis, αs::AbstractVector, phases::AbstractVector=zeros(length(αs)); squeeze_params=nothing, ħ=2)
Create multi-mode general cat states as tensor products of single-mode cat states.
Gabs.catstate
— Functioncatstate(basis::SymplecticBasis, α::Number, phase::Real=0; squeeze_params=nothing, ħ=2)
Create a general Schrödinger cat state |cat⟩ = (|α⟩ + e^(iφ)|-α⟩)/√N
where φ
is the relative phase.
This is the most general form of cat state, which reduces to even (φ=0)
or odd (φ=π)
cat states for specific phase values.
Arguments
basis::SymplecticBasis
: The symplectic basis for the stateα::Number
: Complex amplitude of the coherent statesphase::Real=0
: Relative phase between the two coherent state componentssqueeze_params=nothing
: Optional tuple(r, θ)
for squeezed cat statesħ=2
: Reduced Planck constant
Mathematical Description
|cat⟩ = (|α⟩ + e^(iφ)|-α⟩)/√(2(1 + Re(e^(iφ)exp(-2|α|²))))
Gabs.catstate_even
— Methodcatstate_even(basis::SymplecticBasis, αs::AbstractVector; squeeze_params=nothing, ħ=2)
Create multi-mode even cat states as tensor products of single-mode cat states.
Arguments
basis::SymplecticBasis
: The symplectic basis for the multi-mode systemαs::AbstractVector
: Vector of complex amplitudes for each modesqueeze_params=nothing
: Optional vector of tuples(r, θ)
for each modeħ=2
: Reduced Planck constant
Gabs.catstate_even
— Methodcatstate_even(basis::SymplecticBasis, α::Number; squeeze_params=nothing, ħ=2)
Create an even Schrödinger cat state |cat+⟩ = (|α⟩ + |-α⟩)/√N
where N
is the normalization constant.
The even cat state is a quantum superposition of two coherent states (or squeezed states) with opposite phases. The normalization accounts for the overlap between the two component states.
Arguments
basis::SymplecticBasis
: The symplectic basis for the stateα::Number
: Complex amplitude of the coherent statessqueeze_params=nothing
: Optional tuple(r, θ)
for squeezed cat states wherer
is the squeeze parameter andθ
is the squeeze angleħ=2
: Reduced Planck constant
Mathematical Description:
For coherent states: |cat+⟩ = (|α⟩ + |-α⟩)/√(2(1 + exp(-2|α|²)))
For squeezed states: The squeezed vacuum is first created, then displaced to ±α
.
Gabs.catstate_odd
— Methodcatstate_odd(basis::SymplecticBasis, αs::AbstractVector; squeeze_params=nothing, ħ=2)
Create multi-mode odd cat states as tensor products of single-mode cat states.
Gabs.catstate_odd
— Methodcatstate_odd(basis::SymplecticBasis, α::Number; squeeze_params=nothing, ħ=2)
Create an odd Schrödinger cat state |cat-⟩ = (|α⟩ - |-α⟩)/√N
where N
is the normalization constant.
The odd cat state is a quantum superposition of two coherent states (or squeezed states) with opposite phases and a relative minus sign.
Arguments
basis::SymplecticBasis
: The symplectic basis for the stateα::Number
: Complex amplitude of the coherent statessqueeze_params=nothing
: Optional tuple(r, θ)
for squeezed cat statesħ=2
: Reduced Planck constant
Mathematical Description
For coherent states: |cat-⟩ = (|α⟩ - |-α⟩)/√(2(1 - exp(-2|α|²)))
Gabs.changebasis
— Methodchangebasis(::SymplecticBasis, state::GaussianChannel)
Change the symplectic basis of a Gaussian channel.
Example
julia> ch = attenuator(QuadBlockBasis(2), [1.0, 2.0], [2, 4])
GaussianChannel for 2 modes.
symplectic basis: QuadBlockBasis
displacement: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
transform: 4×4 Matrix{Float64}:
0.540302 0.0 0.0 0.0
0.0 -0.416147 0.0 0.0
0.0 0.0 0.540302 0.0
0.0 0.0 0.0 -0.416147
noise: 4×4 Matrix{Float64}:
1.41615 0.0 0.0 0.0
0.0 3.30729 0.0 0.0
0.0 0.0 1.41615 0.0
0.0 0.0 0.0 3.30729
julia> changebasis(QuadPairBasis, ch)
GaussianChannel for 2 modes.
symplectic basis: QuadPairBasis
displacement: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
transform: 4×4 Matrix{Float64}:
0.540302 0.0 0.0 0.0
0.0 0.540302 0.0 0.0
0.0 0.0 -0.416147 0.0
0.0 0.0 0.0 -0.416147
noise: 4×4 Matrix{Float64}:
1.41615 0.0 0.0 0.0
0.0 1.41615 0.0 0.0
0.0 0.0 3.30729 0.0
0.0 0.0 0.0 3.30729
Gabs.changebasis
— Methodchangebasis(::SymplecticBasis, state::GaussianUnitary)
Change the symplectic basis of a Gaussian unitary.
Example
julia> op = displace(QuadBlockBasis(2), 1.0-im)
GaussianUnitary for 2 modes.
symplectic basis: QuadBlockBasis
displacement: 4-element Vector{Float64}:
2.0
2.0
-2.0
-2.0
symplectic: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
julia> changebasis(QuadPairBasis, op)
GaussianUnitary for 2 modes.
symplectic basis: QuadPairBasis
displacement: 4-element Vector{Float64}:
2.0
-2.0
2.0
-2.0
symplectic: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
Gabs.changebasis
— Methodchangebasis(::SymplecticBasis, state::GaussianState)
Change the symplectic basis of a Gaussian state.
Example
julia> st = squeezedstate(QuadBlockBasis(2), 1.0, 2.0)
GaussianState for 2 modes.
symplectic basis: QuadBlockBasis
mean: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
covariance: 4×4 Matrix{Float64}:
5.2715 0.0 -3.29789 0.0
0.0 5.2715 0.0 -3.29789
-3.29789 0.0 2.25289 0.0
0.0 -3.29789 0.0 2.25289
julia> changebasis(QuadPairBasis, st)
GaussianState for 2 modes.
symplectic basis: QuadPairBasis
mean: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
covariance: 4×4 Matrix{Float64}:
5.2715 -3.29789 0.0 0.0
-3.29789 2.25289 0.0 0.0
0.0 0.0 5.2715 -3.29789
0.0 0.0 -3.29789 2.25289
Gabs.coherentstate
— Methodcoherentstate([Tm=Vector{Float64}, Tc=Matrix{Float64},] basis::SymplecticBasis, alpha<:Number)
Gaussian state that is the quantum analogue of a monochromatic electromagnetic field, known as the coherent state. The symplectic representation is defined by basis
. The complex amplitude of the state is given by alpha
.
Mathematical description of a coherent state
A coherent state |α⟩
, where α
is the complex amplitude, is characterized by the mean vector √2ħ [real(α), imag(α)]
and covariance matrix (ħ/2)I
.
Example
julia> coherentstate(QuadPairBasis(1), 1.0+im)
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
2.0
2.0
covariance: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
Gabs.cross_wigner
— Methodcross_wigner(state1::GaussianState, state2::GaussianState, x::AbstractVector)
Compute the off-diagonal Wigner kernel (cross-Wigner function) between two Gaussian states.
The cross-Wigner function is given by:
`W₁₂(x) = (1/(2π)ⁿ√det((V₁+V₂)/2)) × exp[-½(x-μ̄)ᵀ((V₁+V₂)/2)⁻¹(x-μ̄)] × exp[i(μ₁-μ₂)ᵀΩ(x-μ̄)/ħ]`
where:
μ̄ = (μ₁ + μ₂)/2
is the average of the two mean vectorsμ₁
,μ₂
are the mean vectors of the two statesV₁
,V₂
are the covariance matrices of the two statesΩ
is the symplectic form matrixn
is the number of modesħ
is the reduced Planck constant
This function captures the quantum interference between two Gaussian states and is essential for computing Wigner functions of superposition states. The cross-Wigner function appears in the interference terms when computing the Wigner function of a linear combination |ψ⟩ = c₁|ψ₁⟩ + c₂|ψ₂⟩
:
`W(x) = |c₁|²W₁(x) + |c₂|²W₂(x) + 2Re(c₁*c₂*W₁₂(x))`
The normalization is chosen to ensure the identity property W₁₁(x) = W₁(x)
.
Arguments
state1::GaussianState
: First Gaussian statestate2::GaussianState
: Second Gaussian statex::AbstractVector
: Phase space point where to evaluate the function
Returns
ComplexF64
: Complex value of the cross-Wigner function at pointx
Notes
- The function is Hermitian:
W₁₂(x) = W₂₁*(x)
- For identical states:
W₁₁(x) = W₁(x)
(reduces to regular Wigner function) - The implementation uses log-space arithmetic for numerical stability
Gabs.cross_wignerchar
— Methodcross_wignerchar(state1::GaussianState, state2::GaussianState, xi::AbstractVector)
Compute cross-Wigner characteristic function between two Gaussian states.
Gabs.displace
— Methoddisplace([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, alpha<:Number)
displace([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, alpha<:Number, noise::Ts)
Gaussian operator that displaces the vacuum state into a coherent state, known as the displacement operator. The symplectic representation is given by basis
. The complex amplitude is given by alpha
. Noise can be added to the operation with noise
.
Mathematical description of a displacement operator
A displacement operator D(α)
is defined by the operation D(α)|0⟩ = |α⟩
, where α
is a complex amplitude. The operator D(α)
is characterized by the displacement vector √2ħ [real(α), imag(α)]
and symplectic matrix I
.
Example
julia> displace(QuadPairBasis(1), 1.0+im)
GaussianUnitary for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
2.0
2.0
symplectic: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
Gabs.eprstate
— Methodeprstate([Tm=Vector{Float64}, Tc=Matrix{Float64},] basis::SymplecticBasis, r<:Real, theta<:Real)
Gaussian state that is a two-mode squeezed state, known as the Einstein-Podolski-Rosen (EPR) state. The symplectic representation is defined by basis
. The amplitude and phase squeezing parameters are given by r
and theta
, respectively.
Mathematical description of an EPR state
An EPR state |r, θ⟩ₑₚᵣ
, where r
is the amplitude squeezing parameter and θ
is the phase squeezing parameter, is characterized by the zero mean vector and covariance matrix (ħ/2)[cosh(2r)I -sinh(2r)R(θ); -sinh(2r)R(θ) cosh(2r)I]
, where R(θ)
is the rotation matrix.
Example
julia> eprstate(QuadPairBasis(2), 0.5, pi/4)
GaussianState for 2 modes.
symplectic basis: QuadPairBasis
mean: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
covariance: 4×4 Matrix{Float64}:
1.54308 0.0 -0.830993 -0.830993
0.0 1.54308 -0.830993 0.830993
-0.830993 -0.830993 1.54308 0.0
-0.830993 0.830993 0.0 1.54308
Gabs.generaldyne
— Methodgeneraldyne(state::GaussianState, indices::Vector; proj = (ħ/2)I) -> Generaldyne
generaldyne(state::GaussianState, index::Int; proj = (ħ/2)I) -> Generaldyne
Compute the projection of the subsystem of a Gaussian state state
indicated by indices
on proj
and return a Generaldyne
object. The keyword argument proj
can take the following forms:
- If
proj
is a matrix, then the subsystem is projected onto a Gaussian state with a randomly sampled mean and covariance matrixresult
. - If
proj
is a Gaussian state, then the subsystem is projected ontoproj
.
The result
and mapped state output
can be obtained from the Generaldyne object M
via M.result
and M.output
. Iterating the decomposition produces the components result
and output
.
Note the measured modes are replaced with vacuum states after the general-dyne measurement.
Examples
julia> st = squeezedstate(QuadBlockBasis(3), 1.0, pi/4);
julia> M = generaldyne(st, [1, 3])
Generaldyne{GaussianState{QuadBlockBasis{Int64}, Vector{Float64}, Matrix{Float64}}, GaussianState{QuadBlockBasis{Int64}, Vector{Float64}, Matrix{Float64}}}
result:
GaussianState for 2 modes.
symplectic basis: QuadBlockBasis
mean: 4-element Vector{Float64}:
0.26967410461090285
1.4683993027500133
-1.84631450059537
0.16832788926417352
covariance: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
output state:
GaussianState for 3 modes.
symplectic basis: QuadBlockBasis
mean: 6-element Vector{Float64}:
0.0
0.0
0.0
0.0
0.0
0.0
covariance: 6×6 Matrix{Float64}:
1.0 0.0 0.0 0.0 0.0 0.0
0.0 1.19762 0.0 0.0 -2.56458 0.0
0.0 0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 -2.56458 0.0 0.0 6.32677 0.0
0.0 0.0 0.0 0.0 0.0 1.0
julia> result, state = M; # destructuring via iteration
julia> result == M.result && state == M.state
true
Gabs.gkpstate
— Methodgkpstate(basis::SymplecticBasis; lattice=:square, delta=0.1, nmax=5, ħ=2)
Create a Gottesman-Kitaev-Preskill (GKP) state as a finite-energy approximation using squeezed states.
GKP states are quantum error-correcting codes that protect against small displacement errors. They are constructed as superpositions of squeezed states positioned at lattice points in phase space.
Arguments
basis::SymplecticBasis
: The symplectic basis for the statelattice=:square
: Lattice type (:square or :hexagonal)delta=0.1
: Squeezing parameter for finite energy approximation (smaller = more squeezed)nmax=5
: Maximum lattice index for truncation (controls number of peaks)ħ=2
: Reduced Planck constant
Notes
- Very small
delta
values (< 1e-6) may cause numerical instability - Large
nmax
values (> 50) create many states and may impact performance - For square lattice: creates
2*nmax + 1
total states
Mathematical Description
For square lattice: |GKP⟩ = Σₖ |xₖ⟩
where xₖ = √(2πħ) × k
for integer k ∈ [-nmax, nmax]
Each |xₖ⟩
is approximated by a squeezed state with squeezing delta in the conjugate direction.
Gabs.isgaussian
— Methodisgaussian(x::GaussianState)
isgaussian(x::GaussianUnitary)
isgaussian(x::GaussianChannel)
Check if x
satisfies the corresponding Gaussian definition for its type.
Example
julia> basis = QuadPairBasis(1);
julia> op = displace(basis, 1.0-im)
GaussianUnitary for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
2.0
-2.0
symplectic: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
julia> isgaussian(op)
true
Gabs.norm_factor
— Methodnorm_factor(states::Vector{GaussianState}, coeffs::Vector{<:Number})
Calculate the normalization factor for a linear combination of Gaussian states.
This function computes the normalization constant needed to ensure ⟨ψ|ψ⟩ = 1
for a state |ψ⟩ = Σᵢ cᵢ|ψᵢ⟩
by calculating all overlap integrals between component states.
Arguments
states::Vector{GaussianState}
: Vector of Gaussian statescoeffs::Vector{<:Number}
: Vector of coefficients
Returns
Float64
: Normalization factorN
such that the stateΣᵢ (cᵢ/N)|ψᵢ⟩
is normalized
Notes
- Returns 1.0 if near-zero or negative normalization is detected (may indicate coefficient cancellation)
- Numerical instabilities can occur with very small coefficients or nearly orthogonal states
Mathematical Description
N² = Σᵢⱼ cᵢ* cⱼ ⟨ψᵢ|ψⱼ⟩
Gabs.phaseshift
— Methodphaseshift([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, theta<:Real)
phaseshift([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, theta<:Real, noise::Ts)
Gaussian operator that rotates the phase of a given Gaussian mode by theta
, as the phase shift operator. The symplectic representation is given by basis
. Noise can be added to the operation with noise
.
Mathematical description of a phase shift operator
A phase shift operator is defined by the operation U(θ) = exp(-iθâᵗâ)
, where θ
is the phase parameter, and âᵗ
and â
are the raising and lowering operators, respectively. The operator U(θ)
is characterized by the zero displacement vector and symplectic matrix [cos(θ) sin(θ); -sin(θ) cos(θ)]
.
Example
julia> phaseshift(QuadPairBasis(1), 3pi/4)
GaussianUnitary for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
0.0
0.0
symplectic: 2×2 Matrix{Float64}:
-0.707107 0.707107
-0.707107 -0.707107
Gabs.purity
— Methodpurity(state::GaussianState)
Calculate the purity of a Gaussian state, defined by 1/sqrt((2/ħ) det(V))
.
Gabs.randchannel
— Methodrandchannel([Td=Vector{Float64}, Tt=Matrix{Float64},] basis::SymplecticBasis)
Calculate a random Gaussian channel in symplectic representation defined by basis
.
Gabs.randstate
— Methodrandstate([Tm=Vector{Float64}, Tc=Matrix{Float64},] basis::SymplecticBasis; pure=false)
Calculate a random Gaussian state in symplectic representation defined by basis
.
Gabs.randunitary
— Methodrandunitary([Td=Vector{Float64}, Ts=Matrix{Float64},] basis::SymplecticBasis; passive=false)
Calculate a random Gaussian unitary operator in symplectic representation defined by basis
.
Gabs.squeeze
— Methodsqueeze([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, r<:Real, theta<:Real)
squeeze([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, r<:Real, theta<:Real, noise::Ts)
Gaussian operator that squeezes the vacuum state into a squeezed state, known as the squeezing operator. The symplectic representation is given by basis
. The amplitude and phase squeezing parameters are given by r
and theta
, respectively. Noise can be added to the operation with noise
.
Mathematical description of a squeezing operator
A squeeze operator S(r, θ)
is defined by the operation S(r, θ)|0⟩ = |r, θ⟩
, where r
and θ
are the real amplitude and phase parameters, respectively. The operator S(r, θ)
is characterized by the zero displacement vector and symplectic matrix cosh(r)I - sinh(r)R(θ)
, where R(θ)
is the rotation matrix.
Example
julia> squeeze(QuadPairBasis(1), 0.25, pi/4)
GaussianUnitary for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
0.0
0.0
symplectic: 2×2 Matrix{Float64}:
0.852789 -0.178624
-0.178624 1.21004
Gabs.squeezedstate
— Methodsqueezedstate([Tm=Vector{Float64}, Tc=Matrix{Float64},] basis::SymplecticBasis, r<:Real, theta<:Real)
Gaussian state with quantum uncertainty in its phase and amplitude, known as the squeezed state. The symplectic representation is defined by basis
. The amplitude and phase squeezing parameters are given by r
and theta
, respectively.
Mathematical description of a squeezed state
A squeezed state |r, θ⟩
, where r
is the amplitude squeezing parameter and θ
is the phase squeezing parameter, is characterized by the zero mean vector and covariance matrix (ħ/2) (cosh(2r)I - sinh(2r)R(θ))
, where R(θ)
is the rotation matrix.
Example
julia> squeezedstate(QuadPairBasis(1), 0.5, pi/4)
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
0.0
0.0
covariance: 2×2 Matrix{Float64}:
0.712088 -0.830993
-0.830993 2.37407
Gabs.sympspectrum
— Methodsympspectrum(state::GaussianState)
Compute the symplectic spectrum of a Gaussian state.
Gabs.thermalstate
— Methodthermalstate([Tm=Vector{Float64}, Tc=Matrix{Float64},] basis::SymplecticBasis, photons<:Int)
Gaussian state at thermal equilibrium, known as the thermal state. The symplectic representation is defined by basis
. The mean photon number of the state is given by photons
.
Mathematical description of a thermal state
A thermal state |n̄⟩
, where n̄
is the mean number of photons, is characterized by the zero mean vector and covariance matrix ħ(n̄+1/2)I
.
Example
julia> thermalstate(QuadPairBasis(1), 4)
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
0.0
0.0
covariance: 2×2 Matrix{Float64}:
9.0 0.0
0.0 9.0
Gabs.twosqueeze
— Methodtwosqueeze([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, r<:Real, theta<:Real)
twosqueeze([Tm=Vector{Float64}, Ts=Matrix{Float64}], basis::SymplecticBasis, r<:Real, theta<:Real, noise::Ts)
Gaussian operator that squeezes a two-mode vacuum state into a two-mode squeezed state, known as the two-mode squeezing operator. The symplectic representation is given by basis
. The amplitude and phase squeezing parameters are given by r
and theta
, respectively. Noise can be added to the operation with noise
.
Mathematical description of a two-mode squeezing operator
A two-mode squeeze operator S₂(r, θ)
is defined by the operation S₂(r, θ)|0⟩ = |r, θ⟩
, where r
and θ
are the real amplitude and phase parameters, respectively. The operator S₂(r, θ)
is characterized by the zero displacement vector and symplectic matrix [cosh(r)I -sinh(r)R(θ); -sinh(r)R(θ) cosh(r)I]
, where R(θ)
is the rotation matrix.
Example
julia> twosqueeze(QuadPairBasis(2), 0.25, pi/4)
GaussianUnitary for 2 modes.
symplectic basis: QuadPairBasis
displacement: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
symplectic: 4×4 Matrix{Float64}:
1.03141 0.0 -0.178624 -0.178624
0.0 1.03141 -0.178624 0.178624
-0.178624 -0.178624 1.03141 0.0
-0.178624 0.178624 0.0 1.03141
Gabs.vacuumstate
— Methodvacuumstate([Tm=Vector{Float64}, Tc=Matrix{Float64}], basis::SymplecticBasis)
Gaussian state with zero photons, known as the vacuum state. The symplectic representation is defined by basis
.
Mathematical description of a vacuum state
A vacuum state |0⟩
is characterized by the zero mean vector and covariance matrix (ħ/2)I
.
Example
julia> vacuumstate(QuadPairBasis(1))
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
0.0
0.0
covariance: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
Gabs.wigner
— Methodwigner(lc::GaussianLinearCombination, x::AbstractVector)
Compute Wigner function of a linear combination including quantum interference. W(x) = Σᵢ |cᵢ|² Wᵢ(x) + 2 Σᵢ<ⱼ Re(cᵢ*cⱼ W_cross(ψᵢ,ψⱼ,x))
Gabs.wigner
— Methodwigner(state::GaussianState, x)
Compute the Wigner function of an N-mode Gaussian state at x
, a vector of size 2N.
Gabs.wignerchar
— Methodwignerchar(lc::GaussianLinearCombination, xi::AbstractVector)
Compute Wigner characteristic function of a linear combination including interference.
Gabs.wignerchar
— Methodwignerchar(state::GaussianState, xi)
Compute the Wigner characteristic function of an N-mode Gaussian state at xi
, a vector of size 2N.
QuantumInterface.apply!
— Methodapply!(state::GaussianState, op::GaussianChannel)
In-place application of a Gaussian channel op
on a Gaussian state state
.
QuantumInterface.apply!
— Methodapply!(state::GaussianState, op::GaussianUnitary)
In-place application of a Gaussian unitary op
on a Gaussian state state
.
QuantumInterface.directsum
— Methoddirectsum(basis1::SymplecticBasis, basis2::SymplecticBasis)
Compute the direct sum of symplectic bases.
QuantumInterface.entropy_vn
— Methodentropy_vn(state::GaussianState; tol::Real = 128 * eps(1/2))
Calculate the Von Neumann entropy of a Gaussian state, defined as
\[S(\rho) = -Tr(\rho \log(\rho)) = \sum_i f(v_i)\]
such that $\log$ denotes the natural logarithm, $v_i$ is the symplectic spectrum of $\mathbf{V}/\hbar$, and the $f$ is taken to be
\[f(x) = (x + 1/2) \log(x + 1/2) - (x - 1/2) \log(x - 1/2)\]
wherein it is understood that $0 \log(0) \equiv 0$.
Arguments
state
: Gaussian state whose Von Neumann entropy is to be calculated.tol
: Tolerance (exclusive) above the cut-off at $1/2$ for computing $f(x)$.
QuantumInterface.fidelity
— Methodfidelity(state1::GaussianState, state2::GaussianState; tol::Real = 128 * eps(1))
Calculate the joint fidelity of two Gaussian states, defined as
\[F(\rho, \sigma) = Tr(\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}}).\]
See: Banchi, Braunstein, and Pirandola, Phys. Rev. Lett. 115, 260501 (2015)
Arguments
state1
,state2
: Gaussian states whose joint fidelity is to be calculated.tol
: Tolerance (inclusive) above the cut-off at $1$ for computing $x + \sqrt{x^2 - 1}$.
QuantumInterface.logarithmic_negativity
— Methodlogarithmic_negativity(state::GaussianState, indices::Union{Integer, AbstractVector{<:Integer}}; tola::Real = 0, tolb::Real = 128 * eps(1))
Calculate the logarithmic negativity of a Gaussian state partition, defined as
\[N(\rho) = \log\|\rho^{T_B}\|_1 = - \sum_i \log(2 \tilde{v}_i^<)\]
such that $\log$ denotes the natural logarithm, $\tilde{v}_i^<$ is the symplectic spectrum of $\mathbf{\tilde{V}}/\hbar$ which is $< 1/2$.
Therein, $\mathbf{\tilde{V}} = \mathbf{T} \mathbf{V} \mathbf{T}$ where
\[\forall k : \mathbf{T} q_k = q_k \forall k \in \mathrm{B} : \mathbf{T} p_k = -p_k \forall k \notin \mathrm{B} : \mathbf{T} p_k = p_k\]
Arguments
state
: Gaussian state whose logarithmic negativity is to be calculated.indices
: Integer or collection thereof, specifying the binary partition.tola
: Tolerance (inclusive) above the cut-off at $0$ for computing $\log(x)$.tolb
: Tolerance (inclusive) below the cut-off at $1$ for computing $\log(x)$.
QuantumInterface.ptrace
— Methodptrace(lc::GaussianLinearCombination, indices::AbstractVector{<:Int})
Compute partial trace of a linear combination over specified indices. Combines identical traced states automatically.
QuantumInterface.ptrace
— Methodptrace(lc::GaussianLinearCombination, index::Int)
Compute partial trace of a linear combination over specified index.
QuantumInterface.ptrace
— Methodptrace([Tm=Vector{Float64}, Tc=Matrix{Float64},] state::GaussianState, idx<:Int)
ptrace([Tm=Vector{Float64}, Tc=Matrix{Float64},] state::GaussianState, indices<:AbstractVector)
Partial trace of a Gaussian state over a subsystem indicated by idx
, or multiple subsystems indicated by indices
.
Example
julia> basis = QuadPairBasis(1);
julia> state = coherentstate(basis, 1.0+im) ⊗ thermalstate(basis, 2) ⊗ squeezedstate(basis, 3.0, pi/4);
julia> ptrace(state, 2)
GaussianState for 2 modes.
symplectic basis: QuadPairBasis
mean: 4-element Vector{Float64}:
2.0
2.0
0.0
0.0
covariance: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 59.0829 -142.633
0.0 0.0 -142.633 344.348
julia> ptrace(state, [1, 3])
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
0.0
0.0
covariance: 2×2 Matrix{Float64}:
5.0 0.0
0.0 5.0
QuantumInterface.tensor
— Methodtensor(lc1::GaussianLinearCombination, lc2::GaussianLinearCombination)
Compute tensor product of two linear combinations of Gaussian states.
QuantumInterface.tensor
— Methodtensor(::Type{Tc}, ::Type{Ts}, lc1::GaussianLinearCombination, lc2::GaussianLinearCombination)
Compute tensor product of two linear combinations with specified output types. Creates all pairwise tensor products: Σᵢⱼ cᵢcⱼ |ψᵢ⟩ ⊗ |ϕⱼ⟩
.
QuantumInterface.tensor
— Methodtensor(state1::GaussianState, state2::GaussianState)
tensor product of Gaussian states, which can also be called with ⊗
.
Example
julia> basis = QuadPairBasis(1);
julia> coherentstate(basis, 1.0+im) ⊗ thermalstate(basis, 2)
GaussianState for 2 modes.
symplectic basis: QuadPairBasis
mean: 4-element Vector{Float64}:
2.0
2.0
0.0
0.0
covariance: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 5.0 0.0
0.0 0.0 0.0 5.0
SymplecticFactorizations.blochmessiah
— Methodblochmessiah(state::GaussianUnitary) -> BlochMessiah
Compute the Bloch-Messiah/Euler decomposition of the symplectic
field of a GaussianUnitary
and return a BlockMessiah
object.
The orthogonal symplectic matrices O
and Q
as well as the singular values values
can be obtained via F.O
, F.Q
, and F.values
, respectively.
Iterating the decomposition produces the components O
, values
, and Q
, in that order.
SymplecticFactorizations.issymplectic
— Methodissymplectic(basis::SymplecticBasis, x::T)
Check if input matrix satisfies symplectic definition.
Example
julia> basis = QuadPairBasis(1);
julia> issymplectic(basis, [1.0 0.0; 0.0 1.0])
true
SymplecticFactorizations.polar
— Methodpolar(state::GaussianUnitary) -> Polar
Compute the Polar decomposition of the symplectic
field of a GaussianUnitary
object and return a Polar
object.
O
and P
can be obtained from the factorization F
via F.O
and F.P
, such that S = O * P
. For the symplectic polar decomposition case, O
is an orthogonal symplectic matrix and P
is a positive-definite symmetric symplectic matrix.
Iterating the decomposition produces the components O
and P
.
SymplecticFactorizations.randsymplectic
— Methodrandsymplectic([T=Matrix{Float64},] basis::SymplecticBasis, passive=false)
Calculate a random symplectic matrix in symplectic representation defined by basis
.
SymplecticFactorizations.symplecticform
— Methodsymplecticform([T = Matrix{Float64},] basis::SymplecticBasis)
Compute the symplectic form matrix of size 2N x 2N corresponding to basis
.
SymplecticFactorizations.williamson
— Methodwilliamson(state::GaussianState) -> Williamson
Compute the williamson decomposition of the covar
field of a GaussianState
object and return a Williamson
object.
A symplectic matrix S
and symplectic spectrum spectrum
can be obtained via F.S
and F.spectrum
.
Iterating the decomposition produces the components S
and spectrum
.
To compute only the symplectic spectrum of a Gaussian state, call sympspectrum
.