weights.jl

Public functions

QuantumACES.compare_ls_optimise_weightsMethod
compare_ls_optimise_weights(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}; gls_options::OptimOptions = OptimOptions(; ls_type = :gls), wls_options::OptimOptions = OptimOptions(; ls_type = :wls), ols_options::OptimOptions = OptimOptions(; ls_type = :ols))

Returns versions of the design d and circuit log-eigenvalue estimator covariance matrix covariance_log after optimising the shot weights with respect to the figure of merit, alongside the figure of merit values at each step and the final merits, for all three least squares estimator types. The optimisation for each is parameterised by the OptimOptions objects gls_options, wls_options, and ols_options, respectively.

source
QuantumACES.gls_optimise_weightsMethod
gls_optimise_weights(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}; options::OptimOptions = OptimOptions())

Returns versions of the design d and circuit log-eigenvalue estimator covariance matrix covariance_log after optimising the shot weights with respect to the generalised least squares (GLS) figure of merit, alongside the figure of merit values at each step. The optimisation is parameterised by the OptimOptions object options.

source
QuantumACES.ols_optimise_weightsMethod
ols_optimise_weights(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}; options::OptimOptions = OptimOptions())

Returns versions of the design d and circuit log-eigenvalue estimator covariance matrix covariance_log after optimising the shot weights with respect to the ordinary least squares (OLS) figure of merit, alongside the figure of merit values at each step. The optimisation is parameterised by the OptimOptions object options.

source
QuantumACES.optimise_weightsMethod
optimise_weights(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}; options::OptimOptions = OptimOptions())

Returns versions of the design d and circuit log-eigenvalue estimator covariance matrix covariance_log after optimising the shot weights with respect to the figure of merit, alongside the figure of merit values at each step. The optimisation is parameterised by the OptimOptions object options, which in particular specifies the least squares estimator type for which the figure of merit is calculated.

source
QuantumACES.wls_optimise_weightsMethod
wls_optimise_weights(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}; options::OptimOptions = OptimOptions())

Returns versions of the design d and circuit log-eigenvalue estimator covariance matrix covariance_log after optimising the shot weights with respect to the weighted least squares (WLS) figure of merit, alongside the figure of merit values at each step. The optimisation is parameterised by the OptimOptions object options.

source

Private functions

QuantumACES.calc_gls_merit_grad_logMethod
calc_gls_merit_grad_log(d::Design, shot_weights::Vector{Float64}, covariance_log_unweighted_inv::SparseMatrixCSC{Float64, Int})

Returns the gradient of the generalised least squares (GLS) figure of merit for the design d with respect to the logarithms of the shot weights shot_weights, using the inverse of the unweighted (by the shot weights factor) covariance matrix of the circuit log-eigenvalue estimator covariance_log_unweighted_inv.

source
QuantumACES.calc_ols_merit_grad_logMethod
calc_ols_merit_grad_log(d::Design, shot_weights::Vector{Float64}, ols_estimator::Matrix{Float64}, ols_estimator_covariance::Matrix{Float64}, ols_gram_covariance::Matrix{Float64})

Returns the gradient of the ordinary least squares (OLS) figure of merit for the design d with respect to the logarithms of the shot weights shot_weights, using the OLS estimator matrix ols_estimator, scaled by the unweighted covariance matrix in ols_estimator_covariance, and the OLS Gram matrix also scaled by the unweighted covariance matrix in ols_gram_covariance.

source
QuantumACES.calc_wls_merit_grad_logMethod
calc_wls_merit_grad_log(d::Design, shot_weights::Vector{Float64}, covariance_log_unweighted::SparseMatrixCSC{Float64, Int})

Returns the gradient of the weighted least squares (WLS) figure of merit for the design d with respect to the logarithms of the shot weights shot_weights, using the unweighted (by the shot weights factor) covariance matrix of the circuit log-eigenvalue estimator covariance_log_unweighted.

source
QuantumACES.get_merit_gradMethod
get_merit_grad(sigma_tr::Float64, sigma_tr_grad::Vector{Float64}, sigma_sq_tr::Float64, sigma_sq_tr_grad::Vector{Float64}, N::Int)

Returns the gradient of the figure of merit with respect to the shot weights given the trace of the gate eigenvalue estimator covariance matrix sigma_tr and its square sigma_sq_tr, the gradient with respect to the shot weights sigma_tr_grad and the gradient of the square sigma_sq_tr_grad, and the number of gate eigenvalues N.

source
QuantumACES.get_shot_weights_factorMethod
get_shot_weights_factor(shot_weights::Vector{Float64}, tuple_times::Vector{Float64}, mapping_lengths::Vector{Int})

Returns the shot weights factor for the sparse block diagonal circuit (log-)eigenvalue estimator covariance matrix for the shot weights shot_weights and tuple times tuple_times, where the block sizes are specified by mapping_lengths.

source
QuantumACES.get_shot_weights_factor_invMethod
get_shot_weights_factor_inv(shot_weights::Vector{Float64}, tuple_times::Vector{Float64}, mapping_lengths::Vector{Int})

Returns the shot weights inverse factor for the sparse block diagonal circuit (log-)eigenvalue estimator covariance matrix for the shot weights shot_weights and tuple times tuple_times, where the block sizes are specified by mapping_lengths.

source
QuantumACES.get_shot_weights_local_gradMethod
get_shot_weights_local_grad(shot_weights::Vector{Float64}, tuple_times::Vector{Float64})

Returns the local gradient factor corresponding to each tuple's block in the covariance matrix, at shot weights shot_weights and tuple times tuple_times.

source
QuantumACES.get_shot_weights_log_matrixMethod
get_shot_weights_log_matrix(shot_weights::Vector{Float64})

Returns the matrix that transforms the gradient of the figure of merit with respect to the shot weights shot_weights into the gradient of the figure of merit with respect to the logarithms of the shot weights.

source