Public API
Documentation for the public API of QuantumACES.jl
.
To use internal API, which is documented in the internal API section, import the module by running the following.
import QuantumACES as ACES
QuantumACES.jl
QuantumACES.QuantumACES
— ModuleQuantumACES.jl
is a package for designing and simulating scalable and performant Pauli noise characterisation experiments for stabiliser circuits with averaged circuit eigenvalue sampling (ACES). It is particularly interested in characterising the noise associated with fault-tolerant gadgets in the context of topological quantum error correcting codes, such as surface code syndrome extraction circuits.
QuantumACES.AbstractCircuit
— TypeAbstractCircuit
Circuits should be stored in a subtype T <: AbstractCircuit
.
Circuits should be generated by a method of get_circuit
, and prepare_circuit
is a helpful function for writing such a method.
To specify the preparation of sign configurations for Pauli eigenstates, either provide the partition
field or modify get_experiment_layers
.
Necessary fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.circuit_tuple::Vector{Int}
: Tuple which arranges the order of the circuit layers; this is initialised as trivial.qubit_num::Int
: Number of qubits in the circuit.unique_layer_indices::Vector{Int}
: Unique layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.layer_types::Vector{Symbol}
: Types of the layers in the circuit, used for layer times and dynamical decoupling.layer_times::Vector{Float64}
: Times taken to implement each layer in the circuit, as well as measurement and reset.gates::Vector{Gate}
: Gates in the circuit arranged by the tuple.total_gates::Vector{Gate}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.noise_param::AbstractNoiseParameters
: Noise parameters.gate_probabilities::Dict{Gate, Vector{Float64}}
: Pauli error probabilities for each gate, stored as a dictionary.gate_eigenvalues::Vector{Float64}
: Eigenvalues for each gate, stored as a vector whose order is determined bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, which should default tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, which should default totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.
Optional fields
partition::Tuple{Vector{Int}, Vector{Int}}
: A partition of the qubits into two sets such that two-qubit gates act only between the sets, which allows for easy preparation of sign configurations for Pauli eigenstates; for example, data and ancilla qubits for a syndrome extraction circuit.
QuantumACES.AbstractCircuitParameters
— TypeAbstractCircuitParameters
Circuit parameters should be stored in a subtype T <: AbstractCircuitParameters
.
Then add a method to get_circuit
that generates a circuit according to these parameters. Such a circuit should either be a Circuit
type, or a subtype T <: AbstractCircuit
.
Necessary fields
layer_time_dict::Dict{Symbol, Float64}
: Dictionary of the times taken to implement the different types of layers in the circuit, including the time for measurement and reset.circuit_name::String
: Name of the circuit, which should implicitly describe parameter settings.
QuantumACES.AbstractNoiseParameters
— TypeAbstractNoiseParameters
Noise parameters should be stored in a subtype T <: AbstractNoiseParameters
.
Noise models should be generated by a method of get_gate_probabilities
, which generates Pauli error probabilities for the supplied gates according to some supplied noise parameters.
Necessary fields
noise_name::String
: Name of the noise model, which should implicitly describe parameter settings.
QuantumACES.AbstractScalingData
— TypeAbstractScalingData
Scaling data for the figure of merit should be stored in a subtype T <: AbstractScalingData
.
Necessary fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.noise_param::AbstractNoiseParameters
: Noise parameters.tuple_set::Vector{Vector{Int}}
: Set of tuples which arrange the circuit layers.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.shot_weights::Vector{Float64}
: Shot weights for each tuple in the set, which add to 1.ls_type::Symbol
: Type of least squares estimator for which the scaling is calculated.
tableau.jl
QuantumACES.Gate
— TypeGate
A gate in a stabiliser circuit.
Fields
type::String
: String describing the gate type.index::Int32
: The index labelling the unique layer occurrences of the gate in a circuit.targets::Vector{Int16}
: The qubit target or targets of the gate.
Supported gates
H
: Hadamard gate.S
: Phase gate.CX
orCNOT
: Controlled-X gate; the first qubit is the control and the second qubit is the target.CZ
: Controlled-Z gate.I
: Identity gate.Z
: Pauli Z gate.X
: Pauli X gate.Y
: Pauli Y gate.II
: Two-qubit identity gate.AB
: Two-qubit Pauli gate, whereA
andB
are PaulisZ
,X
, orY
.SQRT_AB
: Two-qubit Pauli rotation, whereA
andB
are PaulisZ
,X
, orY
.SQRT_AB_DAG
: Two-qubit Pauli rotation, whereA
andB
are PaulisZ
,X
, orY
.PZ+
: Prepare the Pauli +Z eigenstate.PZ-
: Prepare the Pauli -Z eigenstate.PX+
: Prepare the Pauli +X eigenstate.PX-
: Prepare the Pauli -X eigenstate.PY+
: Prepare the Pauli +Y eigenstate.PY-
: Prepare the Pauli -Y eigenstate.M
orMZ
: Measure in the computational Pauli Z basis.MX
: Measure in the Pauli X basis.MY
: Measure in the Pauli Y basis.R
: Reset to the computational Z basis.
QuantumACES.Layer
— TypeLayer
A layer of gates in a stabiliser circuit. Gates in a layer are simultaneously implemented by the device, and act on disjoint sets of qubits such that they trivially commute with each other.
Fields
layer::Vector{Gate}
: The gates in the layer.qubit_num::Int16
: The number of qubits in the circuit.
QuantumACES.Tableau
— TypeTableau
A tableau representation of a stabiliser state.
Stabiliser circuit simulations follow Improved simulation of stabilizer circuits
by S. Aaronson and D. Gottesman (2004).
Fields
tableau::Matrix{Bool}
: The tableau representation of the stabiliser state.qubit_num::Int16
: The number of qubits in the stabiliser state.
QuantumACES.apply!
— Methodapply!(t::Tableau, l::Layer; return_measurements::Bool = false)
Perform on the tableau t
all gates in the layer l
, and return the list of measurement outcomes if return_measurements
is true
.
QuantumACES.make_layer
— Methodmake_layer(gate_type::String, range::Vector{Int}, n::Int)
Returns a layer of single-qubit gate_type
gates acting on the qubits in range
, where the layer acts on n
qubits.
QuantumACES.make_layer
— Methodmake_layer(gate_type::String, range_set::Vector{Vector{Int}}, n::Int)
Returns a layer of gate_type
gates, each acting on the qubits in range_set
, where the layer acts on n
qubits.
QuantumACES.make_layer
— Methodmake_layer(gate_types::Vector{String}, ranges::Vector{Vector{Int}}, n::Int)
Returns a layer of single-qubit gates, with gate types specified by gate_types
and the qubits upon which they act specified by ranges
, where the layer acts on n
qubits.
QuantumACES.pad_layer
— Methodpad_layer(l::Layer)
Returns a copy of the layer l
padded by single-qubit identity gates that act on each of the qubits not already acted upon by some gate in the layer.
noise.jl
QuantumACES.DepolarisingParameters
— TypeDepolarisingParameters
Parameterises a depolarising Pauli noise model.
Fields
r_1::Float64
: Single-qubit gate entanglement infidelity, the sum of all 3 non-identity Pauli error probabilities.r_2::Float64
: Two-qubit gate entanglement infidelity, the sum of all 15 non-identity Pauli error probabilities.r_m::Float64
: Measurement entanglement infidelity, the measurement error probability.noise_name::String
: Noise parameter name for saving data.
QuantumACES.LognormalParameters
— TypeLognormalParameters
Parameterises a log-normally random Pauli noise model.
Fields
r_1::Float64
: Average single-qubit gate entanglement infidelity, the sum of all 3 non-identity Pauli error probabilities.r_2::Float64
: Average two-qubit gate entanglement infidelity, the sum of all 15 non-identity Pauli error probabilities.r_m::Float64
: Average measurement entanglement infidelity, the measurement error probability.total_std_log::Float64
: Approximate standard deviation of the logarithm of the entanglement infidelity across all gate types.seed::UInt64
: Random seed used to generate the noise.noise_name::String
: Noise parameter name for saving data.
QuantumACES.get_dep_param
— Methodget_dep_param(r_1::Float64, r_2::Float64, r_m::Float64)
Return a DepolarisingParameters
object that parameterises a depolarising Pauli noise model with single-qubit, two-qubit, and measurement infidelities r_1
, r_2
, and r_m
, respectively.
QuantumACES.get_gate_probabilities
— Methodget_gate_probabilities(total_gates::Vector{Gate}, noise_param::DepolarisingParameters)
get_gate_probabilities(total_gates::Vector{Gate}, noise_param::LognormalParameters)
Returns a dictionary of the Pauli error probabilities for each gate in total_gates
generated according to the noise parameters noise_param
.
The order in which Pauli
stores Pauli operators as bit strings orders the Pauli error probabilities for each gate. For single-qubit gates, the Pauli error probabilities are ordered as I
, X
, Z
, Y
. For two-qubit gates, the Pauli error probabilities are ordered as II
, XI
, IX
, XX
, ZI
, YI
, ZX
, YX
, IZ
, XZ
, IY
, XY
, ZZ
, YZ
, ZY
, YY
.
QuantumACES.get_log_param
— Methodget_log_param(r_1::Float64, r_2::Float64, r_m::Float64, total_std_log::Float64; seed::Union{UInt64, Nothing} = nothing)
Return a LognormalParameters
object that parameterises a log-normally random Pauli noise model with average single-qubit, two-qubit, and measurement infidelities r_1
, r_2
, and r_m
, respectively, approximate standard deviation of the logarithm of the entanglement infidelity total_std_log
, and random seed seed
, which is randomly generated if not supplied.
circuit.jl
QuantumACES.Circuit
— TypeCircuit
Circuit information, including noise parameters.
Fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.circuit_tuple::Vector{Int}
: Tuple which arranges the order of the circuit layers; this is initialised as trivial.qubit_num::Int
: Number of qubits in the circuit.unique_layer_indices::Vector{Int}
: Unique layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.layer_types::Vector{Symbol}
: Types of the layers in the circuit, used for layer times and dynamical decoupling.layer_times::Vector{Float64}
: Times taken to implement each layer in the circuit, as well as measurement and reset.gates::Vector{Gate}
: Gates in the circuit arranged by the tuple.total_gates::Vector{Gate}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.noise_param::AbstractNoiseParameters
: Noise parameters.gate_probabilities::Dict{Gate, Vector{Float64}}
: Pauli error probabilities for each gate, stored as a dictionary.gate_eigenvalues::Vector{Float64}
: Eigenvalues for each gate, stored as a vector whose order is determined bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.
QuantumACES.RotatedPlanarCircuit
— TypeRotatedPlanarCircuit
Syndrome extraction circuit for a rotated surface code.
Fields
circuit_param::RotatedPlanarParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.circuit_tuple::Vector{Int}
: Tuple which arranges the order of the circuit layers; this is initialised as trivial.qubit_num::Int
: Number of qubits in the circuit.unique_layer_indices::Vector{Int}
: Unique layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.layer_types::Vector{Symbol}
: Types of the layers in the circuit, used for layer times and dynamical decoupling.layer_times::Vector{Float64}
: Times taken to implement each layer in the circuit, as well as measurement and reset.gates::Vector{Gate}
: Gates in the circuit arranged by the tuple.total_gates::Vector{Gate}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.noise_param::AbstractNoiseParameters
: Noise parameters.gate_probabilities::Dict{Gate, Vector{Float64}}
: Pauli error probabilities for each gate, stored as a dictionary.gate_eigenvalues::Vector{Float64}
: Eigenvalues for each gate, stored as a vector whose order is determined bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.partition::Tuple{Vector{Int}, Vector{Int}}
: Partition of the qubits (data, ancilla), allowing for easy preparation of sign configurations for Pauli eigenstates.qubits::Vector{Tuple{Int, Int}}
: Code qubit lattice locations.inverse_indices::Dict{Tuple{Int, Int}, Int}
: Inverse mapping from the qubit lattice locations to their indices.data_indices::Vector{Int}
: Data qubit indices.ancilla_indices::Vector{Int}
: Ancilla qubit indices.ancilla_X_indices::Vector{Int}
: Ancilla X-check qubit indices.ancilla_Z_indices::Vector{Int}
: Ancilla Z-check qubit indices.qubit_layout::Matrix{String}
: Diagram of the layout of the code qubits.
QuantumACES.RotatedPlanarParameters
— TypeRotatedPlanarParameters
Parameters for the syndrome extraction circuit of a rotated surface code.
Fields
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.check_type::Symbol
: Type of stabiliser used in the circuit, either:xzzx
or:standard
.gate_type::Symbol
: Type of two-qubit gate used in the circuit, either:cx
or:cz
.dynamically_decouple::Bool
: Whether to dynamically decouple the circuit;true
is currently only supported for:xzzx
and:cz
.pad_identity::Bool
: Whether to pad layers with single-qubit identity gates.layer_time_dict::Dict{Symbol, Float64}
: Dictionary of layer times.circuit_name::String
: Name of the circuit used for saving data.
QuantumACES.UnrotatedPlanarCircuit
— TypeUnrotatedPlanarCircuit
Syndrome extraction circuit for a unrotated surface code.
Fields
circuit_param::UnrotatedPlanarParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.circuit_tuple::Vector{Int}
: Tuple which arranges the order of the circuit layers; this is initialised as trivial.qubit_num::Int
: Number of qubits in the circuit.unique_layer_indices::Vector{Int}
: Unique layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.layer_types::Vector{Symbol}
: Types of the layers in the circuit, used for layer times and dynamical decoupling.layer_times::Vector{Float64}
: Times taken to implement each layer in the circuit, as well as measurement and reset.gates::Vector{Gate}
: Gates in the circuit arranged by the tuple.total_gates::Vector{Gate}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.noise_param::AbstractNoiseParameters
: Noise parameters.gate_probabilities::Dict{Gate, Vector{Float64}}
: Pauli error probabilities for each gate, stored as a dictionary.gate_eigenvalues::Vector{Float64}
: Eigenvalues for each gate, stored as a vector whose order is determined bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.partition::Tuple{Vector{Int}, Vector{Int}}
: Partition of the qubits (data, ancilla), allowing for easy preparation of sign configurations for Pauli eigenstates.qubits::Vector{Tuple{Int, Int}}
: Code qubit lattice locations.inverse_indices::Dict{Tuple{Int, Int}, Int}
: Inverse mapping from the qubit lattice locations to their indices.data_indices::Vector{Int}
: Data qubit indices.ancilla_indices::Vector{Int}
: Ancilla qubit indices.ancilla_X_indices::Vector{Int}
: Ancilla X-check qubit indices.ancilla_Z_indices::Vector{Int}
: Ancilla Z-check qubit indices.qubit_layout::Matrix{String}
: Diagram of the layout of the code qubits.
QuantumACES.UnrotatedPlanarParameters
— TypeUnrotatedPlanarParameters
Parameters for the syndrome extraction circuit of an unrotated surface code.
Fields
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.gate_type::Symbol
: Type of two-qubit gate used in the circuit, which must be:cx
.pad_identity::Bool
: Whether to pad layers with single-qubit identity gates.layer_time_dict::Dict{Symbol, Float64}
: Dictionary of layer times.circuit_name::String
: Name of the circuit used for saving data.
QuantumACES.get_circuit
— Methodget_circuit(rotated_param::RotatedPlanarParameters, noise_param::AbstractNoiseParameters; kwargs...)
get_circuit(unrotated_param::UnrotatedPlanarParameters, noise_param::AbstractNoiseParameters; kwargs...)
Returns a circuit object, a subtype T <: AbstractCircuit
, parameterised by the supplied circuit and noise parameters.
Arguments
rotated_param::RotatedPlanarParameters
: Parameters for a rotated surface code.unrotated_param::UnrotatedPlanarParameters
: Parameters for an unrotated surface code.noise_param::AbstractNoiseParameters
: Noise parameters for the circuit.
Keyword arguments
add_prep::Bool = false
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool = true
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.
QuantumACES.get_layer_times
— Methodget_layer_times(layer_types::Vector{Symbol}, layer_time_dict::Dict{Symbol, Float64})
Returns the times taken to implement each layer in the circuit based on their types in layer_types
and the times specified in `layertimedict, including the time for measurement and reset at the end.
QuantumACES.get_rotated_param
— Methodget_rotated_param(vertical_dist::Int, horizontal_dist::Int; kwargs...)
get_rotated_param(dist::Int; kwargs...)
Returns a RotatedPlanarParameters
object that parameterises the syndrome extraction circuit of a rotated surface code.
Default gate layer times are estimated from Suppressing quantum errors by scaling a surface code logical qubit
by Google Quantum AI (2023).
Arguments
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.dist::Int
: Distance of the code; this is equivalent to settingvertical_dist = dist
andhorizontal_dist = dist
.
Keyword arguments
check_type::Symbol = :xzzx
: Type of stabiliser used in the circuit, either:xzzx
or:standard
.gate_type::Symbol = :cz
: Type of two-qubit gate used in the circuit, either:cx
or:cz
.dynamically_decouple::Bool = true
: Whether to dynamically decouple the circuit;true
is currently only supported for:xzzx
and:cz
.pad_identity::Bool = true
: Whether to pad layers with single-qubit identity gates.single_qubit_time::Float64 = 29.0
: Time taken to implement a single-qubit gate in nanoseconds.two_qubit_time::Float64 = 29.0
: Time taken to implement a two-qubit gate in nanoseconds.meas_reset_time::Float64 = 660.0
: Time taken to perform measurement and reset at the end of the circuit in nanoseconds.dynamical_decoupling_time::Float64 = 29.0
: Time taken to implement a dynamical decoupling layer in nanoseconds.
QuantumACES.get_unrotated_param
— Methodget_unrotated_param(vertical_dist::Int, horizontal_dist::Int; kwargs...)
get_unrotated_param(dist::Int; kwargs...)
Returns an UnrotatedPlanarParameters
object that parameterises the syndrome extraction circuit of a unrotated surface code.
Default gate layer times are estimated from Suppressing quantum errors by scaling a surface code logical qubit
by Google Quantum AI (2023).
Arguments
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.dist::Int
: Distance of the code; this is equivalent to settingvertical_dist = dist
andhorizontal_dist = dist
.
Keyword arguments
gate_type::Symbol = :cx
: Type of two-qubit gate used in the circuit, which must be:cx
.pad_identity::Bool = true
: Whether to pad layers with single-qubit identity gates.single_qubit_time::Float64 = 29.0
: Time taken to implement a single-qubit gate in nanoseconds.two_qubit_time::Float64 = 29.0
: Time taken to implement a two-qubit gate in nanoseconds.dynamical_decoupling_time::Float64 = 29.0
: Time taken to implement a dynamical decoupling layer in nanoseconds.meas_reset_time::Float64 = 660.0
: Time taken to perform measurement and reset at the end of the circuit in nanoseconds.
QuantumACES.prepare_circuit
— Methodprepare_circuit(circuit::Vector{Layer}, qubit_num::Int, layer_types::Vector{Symbol}, layer_times::Vector{Float64}, noise_param::AbstractNoiseParameters; add_prep::Bool = false, add_meas::Bool = true)
Returns a labelled copy of the circuit as well as a number of required fields for subtypes T <: AbstractCircuit
.
Arguments
circuit::Vector{Layer}
: Circuit.qubit_num::Int
: Number of qubits in the circuit.layer_types::Vector{Symbol}
: Types of the layers in the circuit.layer_times::Vector{Float64}
: Times taken to implement each layer in the circuit, including measurement and reset at the end.noise_param::AbstractNoiseParameters
: Noise parameters.
Keyword arguments
add_prep::Bool = false
: Whether to treat preparations as noisy and aim to characterise them.add_meas::Bool = true
: Whether to treat measurements as noisy and aim to characterise them.
Returns
circuit::Vector{Layer}
: Circuit with labelled gates.unique_layer_indices::Vector{Int}
: Indices of the unique layers in the circuit.gates::Vector{Gate}
: Gates in the circuit.total_gates::Vector{Gate}
: Total gates in the circuit, including preparations ifadd_prep
and measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gate in the original circuit.N::Int
: Number of gate eigenvalues.gate_probabilities::Dict{Gate, Vector{Float64}}
: Pauli error probabilities for each gate, stored as a dictionary.gate_eigenvalues::Vector{Float64}
: Eigenvalues for each gate, stored as a vector whose order is determined bygate_index
.
QuantumACES.update_noise
— Methodupdate_noise(c::AbstractCircuit, noise_param::AbstractNoiseParameters)
Returns a copy of c
where the circuit has been updated with noise generated according to noise_param
.
tuples.jl
QuantumACES.TupleSetData
— TypeTupleSetData
Data parameterising a tuple set.
Fields
tuple_set::Vector{Vector{Int}}
: The main tuple set, whose tuples are not repeated.repeat_tuple_set::Vector{Vector{Int}}
: The repeated tuple set, whose tuples are repeatedrepeat_numbers
times.repeat_numbers::Vector{Int}
: The number of repetitions for each tuple in the repeated tuple setrepeat_tuple_set
.repeat_indices::Vector{Int}
: Indexes the repetition number inrepeat_numbers
that describes the number of repetitions for each tuple inrepeat_tuple_set
.
QuantumACES.get_basic_tuple_set
— Methodget_basic_tuple_set(c::AbstractCircuit)
Returns the basic tuple set for the circuit c
.
QuantumACES.get_tuple_set
— Methodget_tuple_set(tuple_set_data::TupleSetData)
Returns the tuple set corresponding to the data tuple_set_data
.
QuantumACES.get_tuple_set_data
— Methodget_tuple_set_data(c::AbstractCircuit; init_scaling::Float64 = 0.2)
get_tuple_set_data(c::AbstractCircuit, tuple_set::Vector{Vector{Int}}; init_scaling::Float64 = 0.2)
Returns the tuple set data corresponding to the circuit c
, with the non-repeated tuples either being the supplied tuple_set
or the basic tuple set for c
. The repeat numbers are initialised to be inversely proportional to the average noise on the gates in the layers, implicitly assuming depolarising noise, scaled by a factor init_scaling
which is empirically helpful.
design.jl
QuantumACES.Design
— TypeDesign
Experimental design for a noise characterisation experiment for a circuit.
Fields
c::AbstractCircuit
: Circuit characterised by the design.full_covariance::Bool
: Iftrue
, generates parameters to construct the full covariance matrix incovariance_dict_ensemble
, else iffalse
, only generates parameters to construct the terms on the diagonal.matrix::SparseMatrixCSC{Int32, Int32}
: Sparse M x N design matrix, corresponding to M circuit eigenvalues and N gate eigenvalues.tuple_set::Vector{Vector{Int}}
: Set of tuples which arrange the circuit layers.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.mapping_ensemble::Vector{Vector{Mapping}}
: Vector of theMapping
objects for each of the circuit eigenvalue for the Paulis corresponding to that tuple, for each tuple in the set.experiment_ensemble::Vector{Vector{Vector{Int}}}
: Vector of the experiments that indexMapping
objects, which correspond to simultaneously preparable and measurable circuit eigenvalues, for each tuple in the set.covariance_dict_ensemble::Vector{Dict{CartesianIndex{2}, Tuple{Mapping, Int}}}
: Dictionary ofMapping
objects describing the non-zero entries of the sparse circuit eigenvalue estimator covariance matrix, alongside the number of times the entry is estimated by the experiment set, for each tuple in the set.prep_ensemble::Vector{Vector{Vector{Layer}}}
: Vector ofLayer
objects that prepare qubits in Pauli eigenstates for each experiment in the set, indeed a vector preparing the necessary sign configurations, for each tuple in the set.meas_ensemble::Vector{Vector{Layer}}
: Vector ofLayer
objects that measure qubits in Pauli bases for each experiment in the set, for each tuple in the set.tuple_times::Vector{Float64}
: Time taken to implement the circuit arranged by each tuple in the set, normalised according to the time factor for 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.calculation_times::Matrix{Float64}
: Time taken to generate components of the design for each tuple, which correspond to generating: the mappings, the sets of tuple-consistent Pauli preparations, the experiment sets, the covariance matrix dictionary, and the circuits.overall_time::Float64
: Overall time taken to generate the design.optimisation_time::Float64
: Time taken to optimise the design.ls_type::Symbol
: Type of least squares for which the shot weights were optimised.
QuantumACES.Mapping
— TypeMapping
Mapping of a Pauli operator by some circuit.
Fields
initial::Pauli
: Initial Pauli operator before the action of the circuit.final::Pauli
: Final Pauli operator after the action of the circuit.design_row::SparseVector{Int32, Int32}
: Design matrix row for the circuit eigenvalue corresponding to the initial Pauli and the circuit used for the mapping.spread_track::Vector{Vector{Int16}}
: Track of the support of the Pauli as it is acted upon by the layers of the circuit.
QuantumACES.Pauli
— TypePauli
Boolean representation of a Pauli operator.
Fields
pauli::Vector{Bool}
: The Pauli operator stored as a Boolean vector. The firstqubit_num
elements represent Pauli X on each qubit, the nextqubit_num
elements represent Pauli Z on each qubit, and the final element represents the sign.qubit_num::Int16
: The number of qubits on which the Pauli operator acts; the length of the vector is2 * qubit_num + 1
.
QuantumACES.complete_design
— Methodcomplete_design(d::Design; diagnostics::Bool = false)
Returns a copy of the design d
where the covariance matrix dictionary generates the full covariance matrix. Prints diagnostics if diagnostics
is true
.
QuantumACES.generate_design
— Methodgenerate_design(c::AbstractCircuit, tuple_set::Vector{Vector{Int}}; kwargs...)
generate_design(c::AbstractCircuit, tuple_set_data::TupleSetData; kwargs...)
generate_design(c::AbstractCircuit; kwargs...)
Returns a Design
object containing all relevant information describing the experimental design, including the design matrix.
Arguments
c::AbstractCircuit
: Circuit for which the design matrix is to be generated.tuple_set::Vector{Vector{Int}}
: Tuple set arranging the circuit layers that is used to generate the experimental design.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.
Keyword arguments
shot_weights::Union{Vector{Float64}, Nothing} = nothing
: Shot weights for each tuple in the set, which must add to 1. Whennothing
, automatically generates the default shot weights.full_covariance::Bool = true
: Iftrue
, generates parameters to construct the full covariance matrix, else iffalse
, only generates parameters to construct the terms on the diagonal.N_warn::Int = 3 * 10^4
: Number of circuit eigenvalues above which to warn the user about certain keyword argument choices.diagnostics::Bool = false
: Whether to print diagnostic information.save_data::Bool = false
: Whether to save the design data.
QuantumACES.update_noise
— Methodupdate_noise(d::Design, noise_param::AbstractNoiseParameters)
Returns a copy of design
where the circuit has been updated with noise generated according to noise_param
.
merit.jl
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).
weights.jl
QuantumACES.compare_ls_optimise_weights
— Methodcompare_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.
QuantumACES.gls_optimise_weights
— Methodgls_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
.
QuantumACES.ols_optimise_weights
— Methodols_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
.
QuantumACES.optimise_weights
— Methodoptimise_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.
QuantumACES.wls_optimise_weights
— Methodwls_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
.
optimise.jl
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
.
scaling.jl
QuantumACES.DepolarisingPlanarScaling
— TypeDepolarisingPlanarScaling
Scaling data for an experimental design for the syndrome extraction circuit of a surface code with depolarising Pauli noise.
Fields
dist_range::Vector{Int}
: Code distances.merit_scaling::Vector{Merit}
: Merit of the design for a range of code distances.G_fit::Function
: Gate number fit.G_params::Vector{Int}
: Gate number fit parameters; $a + bd + cd^2$.N_fit::Function
: Gate eigenvalue number fit.N_params::Vector{Int}
: Gate eigenvalue number fit parameters; $a + bd + cd^2$.trace_fit::Function
: Trace of the gate eigenvalue estimator covariance matrix fit.trace_params::Vector{Float64}
: Trace of the gate eigenvalue estimator covariance matrix fit parameters; $a + bd + cd^2$.trace_sq_fit::Function
: Trace of the gate eigenvalue estimator covariance matrix squared fit.trace_sq_params::Vector{Float64}
: Trace of the gate eigenvalue estimator covariance matrix squared fit parameters; $a + bd + cd^2$.expectation_fit::Function
: Normalised RMS error expectation fit.variance_fit::Function
: Normalised RMS error variance fit.circuit_param::AbstractCircuitParameters
: Code parameters.noise_param::DepolarisingParameters
: Depolarising noise parameters.tuple_set::Vector{Vector{Int}}
: Set of tuples which arrange the circuit layers.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.shot_weights::Vector{Float64}
: Shot weights for each tuple in the set, which add to 1.ls_type::Symbol
: Type of least squares estimator for which the merits were calculated.calculation_times::Matrix{Float64}
: Time taken to generate the design and calculate the merit, respectively, for each distance.overall_time::Float64
: The overall time taken to calculate the merit scaling data for depolarising noise.
QuantumACES.LognormalPlanarScaling
— TypeLognormalPlanarScaling
Scaling data for an experimental design for the syndrome extraction circuit of a surface code with log-normal random Pauli noise.
Fields
dist_range::Vector{Int}
: Code distances.N_fit::Function
: Gate eigenvalue number fit.N_params::Vector{Int}
: Gate eigenvalue number fit parameters; $a + bd + cd^2$.expectation_scaling::Vector{Vector{Float64}}
: Expected normalised RMS error for a range of code distances.expectation_fit::Function
: Mean expected normalised RMS error fit.variance_scaling::Vector{Vector{Float64}}
: Normalised RMS error variance for a range of code distances.variance_fit::Function
: Mean normalised RMS error variance fit.eigenvalues_scaling::Vector{Vector{Vector{Float64}}}
: Eigenvalues of the gate log-eigenvalue estimator covariance matrix for a range of code distances.circuit_param::AbstractCircuitParameters
: Code parameters.noise_param::LognormalParameters
: Log-normal random noise parameters.seeds::Vector{UInt64}
: Seeds for the log-normal noise parameters.tuple_set::Vector{Vector{Int}}
: Set of tuples which arrange the circuit layers.tuple_set_data::TupleSetData
:TupleSetData
object that generates the tuple set.shot_weights::Vector{Float64}
: Shot weights for each tuple in the set, which add to 1.ls_type::Symbol
: Type of least squares estimator for which the merits were calculated.calculation_times::Matrix{Float64}
: The time taken to generate the design and calculate the figures of merit for random instances of log-normal Pauli noise, and for depolarising Pauli noise, respectively.overall_time::Float64
: The overall time taken to calculate the merit scaling for log-normal random noise.
QuantumACES.calc_depolarising_planar_scaling
— Methodcalc_depolarising_planar_scaling(d::Design, dist_max::Int; kwargs...)
calc_depolarising_planar_scaling(d::Design, dist_range::Vector{Int}; kwargs...)
Returns the scaling data as a DepolarisingPlanarScaling
object for the figure of merit of the design d
for the syndrome extraction circuit of a surface code with depolarising Pauli noise, as a function of the distance of the code.
Arguments
d::Design
: Design for which the merit scaling is calculated.dist_max::Int
: Maximum code distance for which the merit scaling is calculated.dist_range::Vector{Int}
: Vode distances for which the merit scaling is calculated.
Keyword arguments
ls_type::Symbol = :none
: Type of least squares estimator used to calculate the merit scaling, which defaults to the least squares estimator type of the design, or if that is not specified,:wls
.diagnostics::Bool = true
: Whether to print diagnostic information.save_data::Bool = false
: Whether to save the merit scaling data.
QuantumACES.calc_lognormal_planar_scaling
— Methodcalc_lognormal_planar_scaling(d::Design, dist_max::Int; kwargs...)
calc_lognormal_planar_scaling(d::Design, dist_range::Vector{Int}; kwargs...)
Returns the scaling data as a LognormalPlanarScaling
object for the figure of merit of the design d
for the syndrome extraction circuit of a surface code with log-normal random Pauli noise, as a function of the distance of the code.
Arguments
d::Design
: Design for which the merit scaling is calculated.dist_max::Int
: Maximum code distance for which the merit scaling is calculated.dist_range::Vector{Int}
: Code distances for which the merit scaling is calculated.
Keyword arguments
ls_type::Symbol = :none
: Type of least squares estimator used to calculate the merit scaling, which defaults to the least squares estimator type of the design, or if that is not specified,:wls
.precision::Float64 = 1e-3
: Precision to which the figure of merit is estimated, corresponding to the target standard error of the mean.max_repetitions::Int = 10000
: Maximum number of random instances of log-normal Pauli noise over which the figure of merit is calculated.min_repetitions::Int = 100
: Minimum number of random instances of log-normal Pauli noise over which the figure of merit is calculated.print_repetitions::Int = 100
: Number of random instances of log-normal Pauli noise between printing diagnostics.seed::Union{UInt64, Nothing} = nothing
: Seeds used to generate instances of log-normal Pauli noise.diagnostics::Bool = true
: Whether to print diagnostic information.save_data::Bool = false
: Whether to save the merit scaling data.
simulate.jl
QuantumACES.ACESData
— TypeACESData
ACES noise characterisation experiment simulation results.
Fields
d::Design
: Experimental design.budget_set::Vector{Int}
: Measurement budgets.shots_set::Vector{Int}
: Measurement shots corresponding to the measurement budgets inbudget_set
.repetitions::Int
: Number of times to repeat the ACES estimation procedure.seeds::Vector{UInt64}
: Seeds for each of the repetitions.eigenvalues::Vector{Float64}
: Circuit eigenvalues.covariance::SparseMatrixCSC{Float64, Int32}
: Circuit eigenvalue estimator covariance matrix.est_eigenvalues_coll::Matrix{Vector{Float64}}
: Estimated circuit eigenvalues for each of the measurement budgets and repetitions.fgls_gate_eigenvalues_coll::Matrix{Vector{Float64}}
: FGLS estimated gate eigenvalues for each of the measurement budgets and repetitions.gls_gate_eigenvalues_coll::Matrix{Vector{Float64}}
: GLS estimated gate eigenvalues for each of the measurement budgets and repetitions, which uses the true circuit eigenvalue estimator covariance matrix.wls_gate_eigenvalues_coll::Matrix{Vector{Float64}}
: WLS estimated gate eigenvalues for each of the measurement budgets and repetitions.ols_gate_eigenvalues_coll::Matrix{Vector{Float64}}
: OLS estimated gate eigenvalues for each of the measurement budgets and repetitions.fgls_gate_probabilities_coll::Matrix{Dict{Gate, Vector{Float64}}}
: FGLS estimated gate probability distributions for each of the measurement budgets and repetitions.gls_gate_probabilities_coll::Matrix{Dict{Gate, Vector{Float64}}}
: GLS estimated gate probability distributions for each of the measurement budgets and repetitions.wls_gate_probabilities_coll::Matrix{Dict{Gate, Vector{Float64}}}
: WLS estimated gate probability distributions for each of the measurement budgets and repetitions.ols_gate_probabilities_coll::Matrix{Dict{Gate, Vector{Float64}}}
: OLS estimated gate probability distributions for each of the measurement budgets and repetitions.fgls_gate_norm_coll::Matrix{Float64}
: Normalised RMS error between the FGLS estimated gate eigenvalues and the true gate eigenvalues for each of the measurement budgets and repetitions.gls_gate_norm_coll::Matrix{Float64}
: Normalised RMS error between the GLS estimated gate eigenvalues and the true gate eigenvalues for each of the measurement budgets and repetitions.wls_gate_norm_coll::Matrix{Float64}
: Normalised RMS error between the WLS estimated gate eigenvalues and the true gate eigenvalues for each of the measurement budgets and repetitions.ols_gate_norm_coll::Matrix{Float64}
: Normalised RMS error between the OLS estimated gate eigenvalues and the true gate eigenvalues for each of the measurement budgets and repetitions.calculation_times::Matrix{Float64}
: Time taken to simulate sampling and estimate the gate eigenvalues with FGLS, GLS, WLS, and OLS for each repetition.overall_time::Float64
: Overall time taken to simulate ACES across all repetitions.
QuantumACES.simulate_aces
— Methodsimulate_aces(d::Design, budget_set::Vector{Int}; kwargs...)
Simulates ACES noise characterisation experiments for the experimental design d
across each of the measurement budgets in budget_set
.
WARNING: Seeding has the same features as in Stim. The behaviour of the same random seed will differ across different versions of Stim. Also, when measurement shots are sampled in batches, which occurs when max_samples
is exceeded, the results will differ from when all shots are sampled at once.
Arguments
d::Design
: Experimental design.budget_set::Vector{Int}
: Measurement budgets for which to simulate ACES.
Keyword arguments
repetitions::Int = 1
: Number of simulation repetitions.seed::Union{UInt64, Nothing} = nothing
: the seed to use for the random number generator.N_warn::Int = 3 * 10^4
: Number of circuit eigenvalues above which to warn the user about certain keyword argument choices.max_samples::Int = 10^10
: Maximum number of Stim samples collected in a single simulation.force_gc::Bool = false
: Whether to force garbage collection before and after each Stim simulation; this was added to prevent occasional segfaults but massively slows down the simulation, and currently does not appear to be necessary.diagnostics::Bool = true
: Whether to print diagnostics.detailed_diagnostics::Bool = false
: Whether to print detailed diagnostics.save_data::Bool = false
: Whether to save the data.save_interval::Int = 50
: Repetition interval at which to save the data.clear_design::Bool = false
: Whether to clear the saved design data after saving the full simulation data.
kwargs.jl
QuantumACES.OptimOptions
— TypeOptimOptions
Keyword arguments for optimise_design
, and specifically the optimisation functions within it, including for the gradient descent function optimise_weights
, the repetition number optimisation function optimise_repetitions
, and the tuple set optimisation function optimise_tuple_set
.
General options
ls_type::Symbol = :wls
: The type of least squares estimator for which we optimise the design, which can be:gls
,:wls
, or:ols
.save_data::Bool = false
: Whether to automatically save the optimised design.
Gradient descent options
learning_rate::Float64 = (ls_type == :ols ? 1.0 : 10.0^(3/4))
: Learning rate for the gradient descent algorithm.momentum::Float64 = 0.99
: Momentum for the gradient descent algorithm.learning_rate_scale_factor::Float64 = 10.0^(1/4)
: Factor by which to reduce the learning rate if the gradient descent algorithm repeatedly steps in directions that reduce the figure of merit.shot_weights_clip::Float64 = 1e-5
: If any tuple has shot weight below this threshold, the algorithm greedily considers pruning it from the tuple set.max_steps::Int = 400
: Maximum number of gradient descent steps to take.convergence_threshold::Float64 = 1e-5
: Convergence threshold for the gradient descent algorithm.convergence_steps::Int = 5
: Number of steps over which to check convergence.grad_diagnostics::Bool = false
: Whether to display gradient descent diagnostics.
Reptition number optimisation options
max_cycles::Int = 50
: Maximum number of cycles to use in the cyclic coordinate descent algorithm for optimising repetition numbers.rep_diagnostics::Bool = true
: Whether to display repetition number optimisation diagnostics.
Tuple set optimisation options
excursion_number::Int = 5
: Number of excurisons used to optimise the tuple set.excursion_length::Int = 5
: Number of tuples added by each excursion past themax_tuple_number
, so that at the end of an excursion the tuple set will have up tomax_tuple_number + excursion_length
tuples.max_tuple_number::Int = 35
: Maximum number of tuples in the optimised tuple set.max_tuple_length::Int = 20
: Maximum length of random tuples.tuple_length_zipf_power::Float64 = 1.0
: Zipf power to use when Zipf-randomly choosing the length of random tuples.repeat_zipf_powers::Vector{Float64} = [Inf; 2.0]
: Zipf power to use, chosen uniformly at random from the vector, when Zipf-randomly choosing how many times to repeat entries that will be appended to the end of a random tuple during its generation.mirror_values::Vector{Bool} = [false; true]
: Whether to mirror the tuple, chosen uniformly at random from the vector, when generating random tuples.trial_factor::Int = 20
: Number of random tuples trialled for each tuple the excursion needs to add to the tuple set to grow it to themax_tuple_number
.grow_greedy::Bool = true
: Whether the excursions add tuples to the set greedily according to the figure of merit, or to add them even if this reduces the figure of merit.seed::Union{UInt64, Nothing} = nothing
: Seed used to randomly generate tuples.tuple_diagnostics::Bool = true
: Whether to display tuple set optimisation diagnostics.
utils.jl
QuantumACES.get_mapping_string
— Methodget_mapping_string(m::Mapping, c::AbstractCircuit; two_qubit_only::Bool = false)
Returns the string representation of the mapping m
for the circuit c
, including eigenvalues.
QuantumACES.get_pauli_string
— Methodget_pauli_string(p::Pauli)
Returns the string representation of the Pauli p
.
QuantumACES.get_support
— Methodget_support(p::Pauli)
Returns the support of the Pauli p
.
QuantumACES.pretty_print
— Methodpretty_print(aces_data::ACESData, merit_set::Tuple{Merit, Merit, Merit})
Prints the z-scores of the normalised RMS errors of the gate eigenvalue estimator vector for the GLS, WLS, and OLS estimators in aces_data
using the predicted means and variances for each in merit_set
.
QuantumACES.pretty_print
— Methodpretty_print(d::Design)
Prints the tuple set and shot weight data of the design d
in a readable format.
QuantumACES.pretty_print
— Methodpretty_print(merit_array::Matrix{Float64})
Prints merit_array
, produced by compare_ls_optimise_weights
, in a readable format.
io.jl
QuantumACES.aces_data_filename
— Methodaces_data_filename(aces_data::ACESData)
aces_data_filename(d::Design, budget_set::Vector{Int})
aces_data_filename(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, full_covariance::Bool, ls_type::Symbol, budget_set::Vector{Int})
Returns a string describing the filename corresponding to the ACES data.
QuantumACES.delete_aces
— Methoddelete_aces(aces_data::ACESData)
Deletes the file corresponding to the ACES data aces_data
.
QuantumACES.delete_design
— Methoddelete_design(d::Design)
Deletes the file corresponding to the design d
.
QuantumACES.delete_scaling
— Methoddelete_scaling(scaling_data::AbstractScalingData)
Deletes the file corresponding to the scaling data scaling_data
.
QuantumACES.design_filename
— Methoddesign_filename(d::Design)
design_filename(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, full_covariance::Bool, ls_type::Symbol)
Returns a string describing the filename corresponding to the supplied design data.
QuantumACES.enter_folder
— Methodenter_folder(folder::String)
If not currently in the folder folder
, enter it.
QuantumACES.exit_folder
— Methodexit_folder(folder::String)
If currently in the folder folder
, exit it.
QuantumACES.load_aces
— Methodload_aces(d::Design, budget_set::Vector{Int})
load_aces(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, full_covariance::Bool, ls_type::Symbol, budget_set::Vector{Int})
Loads the ACES data whose filename is specified by the supplied variables.
QuantumACES.load_design
— Methodload_design(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, full_covariance::Bool, ls_type::Symbol)
Loads the design whose filename is specified by the supplied variables.
QuantumACES.load_scaling
— Methodload_scaling(d::Design, ls_type::Symbol)
load_scaling(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, ls_type::Symbol)
Loads the scaling data whose filename is specified by the supplied variables.
QuantumACES.save_aces
— Methodsave_aces(aces_data::ACESData; clear_design::Bool = false)
Saves the ACES data aces_data
with the appropriate filename, and deletes the design file if it exists and clear_design
is true
.
QuantumACES.save_design
— Methodsave_design(d::Design)
Saves the design d
with the appropriate filename.
QuantumACES.save_scaling
— Methodsave_scaling(scaling_data::AbstractScalingData)
Saves the scaling data scaling_data
with the appropriate filename.
QuantumACES.scaling_filename
— Methodscaling_filename(scaling_data::AbstractScalingData)
scaling_filename(d::Design, ls_type::Symbol)
scaling_filename(circuit_param::AbstractCircuitParameters, noise_param::AbstractNoiseParameters, tuple_number::Int, repeat_numbers::Vector{Int}, ls_type::Symbol)
Returns a string describing the filename for the scaling data corresponding to the supplied design data.