merit.jl
Public functions
QuantumACES.Merit
— TypeMerit
Merit parameters for an experimental design.
Fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.noise_param::AbstractNoiseParameters
: Noise parameters.ls_type::Symbol
: Type of least squares estimator for which the merit is reported.tuple_set::Vector{Vector{Int}}
: Set of tuples which arrange the circuit layers.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.tuple_times::Vector{Float64}
: Time taken to implement the circuit corresponding to each tuple, normalised according to the basic tuple set.shot_weights::Vector{Float64}
: Shot weights for each tuple in the set, which add to 1.experiment_numbers::Vector{Int}
: Number of experiments for each tuple in the set.experiment_number::Int
: Total number of experiments.G::Int
: Total number of gates.N::Int
: Number of gate eigenvalues.expectation::Float64
: Expected normalised RMS error for the gate eigenvalue estimator vector.variance::Float64
: Normalised RMS error variance for the gate eigenvalue estimator vector.eigenvalues::Vector{Float64}
: Eigenvalues of the gate eigenvalue estimator covariance matrix.cond_num::Float64
: Condition number of the design matrix, the ratio of the largest and smallest singular values.pinv_norm::Float64
: Pseudoinverse norm of the design matrix, the inverse of the smallest singular value.
QuantumACES.calc_covariance_log
— Methodcalc_covariance_log(d::Design; warning::Bool = true)
Returns the covariance matrix of the circuit log-eigenvalues for the design d
. If warning
is true
, warns that if d.full_covariance
is false
this will only generate the diagonal of the covariance matrix.
QuantumACES.calc_gls_merit
— Methodcalc_gls_merit(d::Design)
Returns the Merit
object for the generalised least squares (GLS) estimator corresponding to the design d
.
QuantumACES.calc_gls_moments
— Methodcalc_gls_moments(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the expectation and variance of the normalised RMS error for the generalised least squares (GLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_ls_merit
— Methodcalc_ls_merit(d::Design, ls_type::Symbol)
Returns the Merit
object for the least squares estimator specified by ls_type
(:gls
, :wls
, or :ols
) corresponding to the design d
.
QuantumACES.calc_ls_moments
— Methodcalc_ls_moments(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}, ls_type::Symbol)
Returns the expectation and variance of the normalised RMS error for the least squares estimator specified by ls_type
(:gls
, :wls
, or :ols
) corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_merit_set
— Methodcalc_ls_merit(d::Design, ls_type::Symbol)
Returns Merit
objects for all three least squares estimators (generalised, weighted, and ordinary least squares) corresponding to the design d
.
QuantumACES.calc_ols_merit
— Methodcalc_ols_merit(d::Design)
Returns the Merit
object for the ordinary least squares (OLS) estimator corresponding to the design d
.
QuantumACES.calc_ols_moments
— Methodcalc_ols_moments(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the expectation and variance of the normalised RMS error for the ordinary least squares (OLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_wls_merit
— Methodcalc_wls_merit(d::Design)
Returns the Merit
object for the weighted least squares (WLS) estimator corresponding to the design d
.
QuantumACES.calc_wls_moments
— Methodcalc_wls_moments(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the expectation and variance of the normalised RMS error for the weighted least squares (WLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.nrmse_pdf
— Methodnrmse_pdf(cov_eigenvalues::Vector{Float64}, nrmse_values::Vector{Float64}; epsilon::Float64 = 1e-5)
Returns the probability density function (PDF) for the normalised RMS error (NRMSE) of the gate eigenvalue estimator vector, which follows a generalised chi-squared distribution and whose covariance matrix has eigenvalues cov_eigenvalues
, at the coordinates specified by nrmse_values
. Does not calculate values when the normal approximation to the PDF is less than a factor of epsilon
of its maximum value.
Calculation follows Eq. 3.2 of Computing the distribution of quadratic forms in normal variables
by J. P. Imhof (1961).
Private functions
QuantumACES.calc_covariance
— Methodcalc_covariance(d::Design, eigenvalues::Vector{Float64}, gate_eigenvalues::Vector{Float64}; warning::Bool = true)
calc_covariance(d::Design, eigenvalues::Vector{Float64}; warning::Bool = true)
calc_covariance(d::Design; warning::Bool = true)
Returns the circuit eigenvalue estimator covariance matrix for the design d
with circuit eigenvalues eigenvalues
and gate eigenvalues gate_eigenvalues
. If warning
is true
, warns that if d.full_covariance
is false
this will only generate the diagonal of the covariance matrix.
QuantumACES.calc_eigenvalues_covariance
— Methodcalc_eigenvalues_covariance(d::Design; warning::Bool = true)
Returns the circuit eigenvalues and circuit eigenvalue estimator covariance matrix for the design d
. If warning
is true
, warns that if d.full_covariance
is false
this will only generate the diagonal of the covariance matrix.
QuantumACES.calc_gls_covariance
— Methodcalc_gls_covariance(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the gate eigenvalue estimator covariance matrix for the generalised least squares (GLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_ls_covariance
— Methodcalc_ls_covariance(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}, ls_type::Symbol)
Returns the gate eigenvalue estimator covariance matrix for the least squares estimator specified by ls_type
(:gls
, :wls
, or :ols
) corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_ols_covariance
— Methodcalc_ols_covariance(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the gate eigenvalue estimator covariance matrix for the ordinary least squares (OLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.calc_wls_covariance
— Methodcalc_wls_covariance(d::Design, covariance_log::SparseMatrixCSC{Float64, Int})
Returns the gate eigenvalue estimator covariance matrix for the weighted least squares (WLS) estimator corresponding to the design d
with circuit log-eigenvalue estimator covariance matrix covariance_log
.
QuantumACES.nrmse_moments
— Methodnrmse_moments(cov_eigenvalues::Vector{Float64})
Returns the expectation and variance of the normalised RMS error, as determined by the eigenvalues cov_eigenvalues
of the gate eigenvalue estimator covariance matrix.
QuantumACES.nrmse_pdf_integrand
— Methodnrmse_pdf_integrand(u::Float64, x::Float64, norm_cov_eigenvalues::Vector{Float64})
Returns the integrand of the Imhof method CDF for the distribution of the NRMSE.
Calculation follows Eq. 3.2 of Computing the distribution of quadratic forms in normal variables
by J. P. Imhof (1961).
QuantumACES.sparse_covariance_inv
— Methodsparse_covariance_inv(covariance_log::SparseMatrixCSC{Float64, Int}, mapping_lengths::Vector{Int})
Returns the inverse of the sparse block diagonal circuit log-eigenvalue estimator covariance matrix covariance_log
, where the block sizes are specified by mapping_lengths
.