QuantumStateDistributions
Documentation for QuantumStateDistributions.
Installation
The package can be installed with the Julia package manager. From the Julia REPL, type ]
to enter the Pkg REPL mode and run:
pkg> add QuantumStateDistributions
Quick start
Construct a squeezed state via QuantumStateBase.jl
and declare its quantum state distribution.
julia> using QuantumStateDistributions, QuantumStateBase
julia> r, θ, dim = 0.8, π/2, 100;
julia> ρ = SqueezedState(r, θ, Matrix, dim=dim)
100×100 Matrix{ComplexF64}:
0.7477+0.0im 0.0+0.0im … -1.77607e-24-5.91946e-10im 0.0+0.0im
0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im
-2.14974e-17+0.351079im 0.0+0.0im 2.77945e-10-8.16923e-25im 0.0+0.0im
0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im
⋮ ⋱
0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im
-1.77607e-24+5.91946e-10im 0.0+0.0im 4.68637e-19+0.0im 0.0+0.0im
0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im
julia> d = GaussianStateBHD(ρ);
Sample a point from the quantum state distribution in intensity-to-measurement-phase quadrature coordinate measured by balanced homodyne detection:
julia> rand(d)
2-element Vector{Float64}:
0.8420476666965236
1.6008878775912423
Sample n
points from the quantum state distribution:
julia> rand(d, 4096)
2×4096 Matrix{Float64}:
0.0018714 0.0034182 0.00403972 0.00780472 … 6.27393 6.27811 6.27884
-0.706334 -1.16179 -0.195581 0.174201 -0.60763 0.853457 -0.217017
Estemate density matrix of a quantum state via MLE
Generate some data from a squeezed state:
julia> data = rand(d, 81920);
Construct a PositivePreservingIterator
:
julia> t = 50;
julia> ppit = PositivePreservingIterator(data, t, dim=35);
Estermate density matrix:
julia> run!(ppit)
julia> ρ_mle = ppit.ρ
Index
QuantumStateDistributions.GaussianStateBHD
QuantumStateDistributions.PositivePreservingIterator
QuantumStateDistributions.frac_π_p
QuantumStateDistributions.gen_π̂s
QuantumStateDistributions.next!
QuantumStateDistributions.qpdf
QuantumStateDistributions.run!
QuantumStateDistributions.ψₙ
QuantumStateDistributions.𝛑̂
APIs
QuantumStateDistributions.GaussianStateBHD
— TypeGaussianStateBHD
A Gaussian state distribution in intensity-to-measurement-phase quadrature coordinate measured by balanced homodyne detection.
Example
julia> using QuantumStateBase
julia> d = GaussianStateBHD(SqueezedState(0.8, π, Matrix, dim=100));
julia> points = rand(d, 4096);
QuantumStateDistributions.PositivePreservingIterator
— MethodPositivePreservingIterator(data::Matrix, steps::Integer; dim::Integer)
The maximum likelihood estimator with the magical positive preserving iterator derived by variational calculus.
Example
julia> using QuantumStateBase
julia> ρ = SqueezedState(0.8, π/4, Matrix, dim=100);
julia> data = rand(GaussianStateBHD(ρ), 8192);
julia> ρ_mle = run!(PositivePreservingIterator(data, 50, dim=35));
QuantumStateDistributions.frac_π_p
— Methodfrac_π_p(ppit::PositivePreservingIterator)
A positive preserving iterator.
$\mathcal{R} = \sum_i \frac{\hat{\pi_i}}{p_i}$
QuantumStateDistributions.gen_π̂s
— Methodgen_π̂s(θs::AbstractVector, xs::AbstractVector, dim::Integer)
Calculate $\hat{\Pi}$ for all given $(\theta, x)$ pairs.
QuantumStateDistributions.next!
— Methodnext!(ppit::PositivePreservingIterator)
Iterate one step with the magic positive preserving iterator.
$\rho^{t+1} = \mathcal{R} \rho^t \mathcal{R}$
QuantumStateDistributions.qpdf
— Methodqpdf([T=Float64], d::GaussianStateBHD, θ::Real, x::Real)
qpdf([T=Float64], d::GaussianStateBHD, θs::AbstractRange, xs::AbstractRange)
qpdf([T=Float64], d::QuantumStateBHD, θ::Real, x::Real)
qpdf([T=Float64], d::QuantumStateBHD, θs::AbstractRange, xs::AbstractRange)
qpdf([T=Float64], ρ::AbstractArray, θ::Real, x::Real)
qpdf([T=Float64], ρ::AbstractArray, θs::AbstractRange, xs::AbstractRange)
Quadrature prabability in intensity-to-measurement-phase quadrature coordinate.
Arguments
T
: Data type, default as Float64.state
: State can beGaussianStateBHD
distribution,QuantumStateBHD
distribution or density matrix.θ
: Measurement phase, can beReal
orAbstractRange
.x
: Intensity in quadrature coordinate, can beReal
orAbstractRange
.
$p(\rho, \theta, x) = tr(\hat{\Pi}(\theta, x) \rho)$
QuantumStateDistributions.run!
— Methodrun!(ppit::PositivePreservingIterator)
Iterate n
step with the magic positive preserving iterator.
QuantumStateDistributions.ψₙ
— Methodψₙ(n::Integer, θ::Real, x::Real)
Eigenstate of BHD measurement operator.
$\psi_n(\theta, x) = \langle n | \theta, x \rangle$
QuantumStateDistributions.𝛑̂
— Method𝛑̂(θ::Real, x::Real; dim::Integer)
BHD measurement operator.
$\hat{\Pi}_{m, n}(\theta, x) = \langle m | \hat{\Pi}(\theta, x) | n \rangle = \langle m | \theta, x \rangle \langle \theta, x | n \rangle$