optimise.jl
Public functions
QuantumACES.optimise_design
— Methodoptimise_design(c::AbstractCircuit; options::OptimOptions = OptimOptions())
optimise_design(c::AbstractCircuit, tuple_set_data::TupleSetData; options::OptimOptions = OptimOptions())
Returns an optimised experimental design for the circuit c
initialised with the tuple set data tuple_set_data
. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.optimise_repetitions
— Methodoptimise_repetitions(c::AbstractCircuit, tuple_set_data::TupleSetData; options::OptimOptions = OptimOptions())
Returns the tuple set data after optimising the repetition numbers in the supplied tuple set data tuple_set_data
for the circuit c
. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.optimise_tuple_set
— Methodoptimise_tuple_set(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 tuple set of the design with repeated excursions that grow and prune the tuple set. The optimisation is parameterised by the OptimOptions
object options
.
Private functions
QuantumACES.grow_design
— Methodgrow_design(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}, circuit_tuple::Vector{Int})
Returns versions of the design d
and circuit log-eigenvalue estimator covariance matrix covariance_log
after adding the tuple circuit_tuple
to the tuple set of the design.
QuantumACES.grow_design_excursion
— Methodgrow_design_excursion(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 tuple set of the design with an excursion that grows the tuple set. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.optimal_expectation
— Methodoptimal_expectation(tuple_set_data::TupleSetData, expectation_dict::Dict{Vector{Int}, Float64}, c::AbstractCircuit; options::OptimOptions = OptimOptions())
Returns the optimised figure of merit, and a dictionary of stored values, for the circuit c
with tuple set data tuple_set_data
, with optimised shot weights. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.prune_design
— Methodprune_design(d::Design, covariance_log::SparseMatrixCSC{Float64, Int}, prune_idx::Int; update_weights::Bool = true)
Returns versions of the design d
and circuit log-eigenvalue estimator covariance matrix covariance_log
after removing the tuple at index prune_idx
from the tuple set of the design. If update_weights
is false
, do not update the shot weight factor for the covariance matrix.
QuantumACES.prune_design_excursion
— Methodprune_design_excursion(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 tuple set of the design with an excursion that prunes the tuple set. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.random_tuple
— Methodrandom_tuple(c::AbstractCircuit, tuple_length::Int, s::Float64, mirror::Bool)
Returns a random tuple for the circuit c
with length tuple_length
. The generation is parameterised by the Zipf power s
and the tuple is mirrored if mirror
is true
. Adds random indices to the tuple, repeated a number of times following a generalised Zipf distribution. For dynamically decoupled circuits, this function ensures that two-qubit gate layers are always followed by some other layer in the tuple.
QuantumACES.sample_zipf
— Methodsample_zipf(N::Int, s::Float64)
Returns a sample from a generalised Zipf distribution supported on 1 to N
parameterised by the power s
.
QuantumACES.step_repetitions
— Methodstep_repetitions(tuple_set_data::TupleSetData, expectation_dict::Dict{Vector{Int}, Float64}, step_tracker::Vector{Int}, coordinate_idx::Int, c::AbstractCircuit; options::OptimOptions = OptimOptions())
Returns the tuple set data, a dictionary of stored figure of merit, and the step tracker after stepping the repetition number for the tuple set data tuple_set_data
at the index coordinate_idx
for the circuit c
. The optimisation is parameterised by the OptimOptions
object options
.
QuantumACES.tuple_append!
— Methodtuple_append!(circuit_tuple::Vector{Int}, tuple_length::Int, s::Float64, unique_indices::Vector{Int}, two_qubit_indices::Vector{Int}, other_indices::Vector{Int})
Appends a random index from unique_indices
to the tuple circuit_tuple
, repeated a number of times determined by a Zipf distribution on 1 to tuple_length
with power s
. Ensures that two-qubit layers, whose indices are given by two_qubit_indices
, are always followed by other layers in the tuple, whose indices are given by other_indices
.
QuantumACES.tuple_append!
— Methodtuple_append!(circuit_tuple::Vector{Int}, tuple_length::Int, s::Float64, unique_indices::Vector{Int})
Appends a random index from unique_indices
to the tuple circuit_tuple
, repeated a number of times determined by a Zipf distribution on 1 to tuple_length
with power s
.