Quantum tomography
Tomography
PastaQ.tomography
— Functiontomography(train_data::Matrix{Pair{String, Int}}, L::LPDO;
optimizer::Optimizer,
observer! = nothing,
batchsize::Int64 = 100,
epochs::Int64 = 1000,
kwargs...)
Run quantum state tomography using a variational model L
to fit train_data
. The model can be either a pure state (MPS) or a density operator (LPDO).
Arguments:
train_data
: pairs of basis/outcome:("X"=>0, "Y"=>1, "Z"=>0, …)
.L
: variational model (MPS/LPDO).optimizer
: algorithm used to update the model parameters.observer!
: if provided, keep track of training metrics.batch_size
: number of samples used for one gradient update.epochs
: number of training iterations.target
: target quantum state (if provided, compute fidelities).test_data
: data for computing cross-validation.outputpath
: if provided, save metrics on file.
tomography(train_data::Matrix{Pair{String,Pair{String, Int}}}, L::LPDO;
optimizer::Optimizer,
observer! = nothing,
batchsize::Int64 = 100,
epochs::Int64 = 1000,
kwargs...)
Run quantum process tomography using a variational model L
to fit train_data
. The model can be either a unitary circuit (MPO) or a Choi matrix (LPDO).
Arguments:
train_data
: pairs of preparation/ (basis/outcome):("X+"=>"X"=>0, "Z-"=>"Y"=>1, "Y+"=>"Z"=>0, …)
.L
: variational model (MPO/LPDO).optimizer
: algorithm used to update the model parameters.observer!
: if provided, keep track of training metrics.batch_size
: number of samples used for one gradient update.epochs
: number of training iterations.target
: target quantum process (if provided, compute fidelities).test_data
: data for computing cross-validation.outputpath
: if provided, save metrics on file.
PastaQ.split_dataset
— Functionsplit_dataset(data::Matrix; train_ratio::Float64 = 0.9, randomize::Bool = true)
Split a data set into a train
and test
sets, given a train_ratio
(i.e. the percentage of data in train_data
. If randomize=true
(default), the data
is randomly shuffled before splitting.
Certification
PastaQ.fidelity
— Functionfidelity(ψ::MPS, ϕ::MPS)
Compute the fidelity between two MPS:
F = |⟨ψ̃|ϕ̃⟩|²
where ψ̃
and ϕ̃
are the normalized MPS.
fidelity(ψ::MPS, ρ::Union{MPO, LPDO})
fidelity(ρ::Union{MPO, LPDO}, ψ::MPS)
Compute the fidelity between an MPS and MPO/LPDO:
F = ⟨ψ̃|ρ̃|ψ̃⟩
where ψ̃
and ρ̃
are the normalized MPS and MPO/LDPO.
fidelity(ρ::ITensor, σ::ITensor)
Compute the quantum fidelity between two ITensors, which are treated as density operators from the unprimed to the primed indices (if they are matrix-like).
Matrix-like ITensors should be Hermitian and non-negative.
PastaQ.frobenius_distance
— Functionfrobenius_distance(ρ::Union{MPO, LPDO}, σ::Union{MPO, LPDO})
Compute the trace norm of the difference between two LPDOs and MPOs:
T(ρ,σ) = sqrt(trace[(ρ̃-σ̃)†(ρ̃-σ̃)])
where ρ̃
and σ̃
are the normalized density matrices.
PastaQ.fidelity_bound
— Functionfidelity_bound(ρ::Union{MPO, LPDO}, σ::Union{MPO, LPDO})
Compute the the following lower bound of the fidelity:
F̃(ρ,σ) = trace[ρ̃† σ̃]
where ρ̃
and σ̃
are the normalized density matrices.
The bound becomes tight when the target state is nearly pure.