design.jl
Public functions
QuantumACES.Design — TypeDesignExperimental 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:TupleSetDataobject that generates the tuple set.mapping_ensemble::Vector{Vector{Mapping}}: Vector of theMappingobjects 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 indexMappingobjects, 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 ofMappingobjects 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{Layer}}: Vector ofLayerobjects that prepare qubits in Pauli eigenstates for each experiment in the set, for each tuple in the set.meas_ensemble::Vector{Vector{Layer}}: Vector ofLayerobjects 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, and the covariance matrix dictionary.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 — TypeMappingMapping 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 — TypePauliBoolean representation of a Pauli operator.
Fields
pauli::Vector{Bool}: The Pauli operator stored as a Boolean vector. The firstqubit_numelements represent Pauli X on each qubit, the nextqubit_numelements 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.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, d::Design; 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:TupleSetDataobject that generates the tuple set.d::Design: Old design object whose parameters are used to generate the design for the circuitc.
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.N_warn::Integer = 10^5: Number of circuit eigenvalues above which to warn the user about certain keyword argument choices.full_covariance::Bool = (c.gate_data.N < N_warn ? true : false): Iftrue, generates parameters to construct the full covariance matrix, else iffalse, only generates parameters to construct the terms on the diagonal.add_circuit::Bool = false: If tuple set data has not been supplied, the circuit itself is added to the repeat tuple set.repeat_points::Integer = 1: If tuple set data has not been supplied, the each repeat number is augmented to haverepeat_pointsrepeat numbers.weight_experiments::Bool = true: Whether to weight the shot weights for a tuple by the number of experiments for that tuple.diagnostics::Bool = false: Whether to print diagnostic information.save_data::Bool = false: Whether to save the design data.
QuantumACES.get_combined_design — Methodget_combined_design(d::Design; diagnostics::Bool = false)Returns a copy of the design d where the three parameters describing Pauli X, Y, and Z basis measurements have been combined into a single parameter for each qubit, printing diagnostics if diagnostics is true.
QuantumACES.get_diag_design — Methodget_diag_design(d::Design; diagnostics::Bool = false)Returns a copy of the design d where the covariance matrix dictionary generates a diagonal covariance matrix, printing diagnostics if diagnostics is true.
QuantumACES.get_eigenvalues — Methodget_eigenvalues(d::Design)
get_eigenvalues(d::Design, gate_eigenvalues::Vector{Float64})Returns the circuit eigenvalues of the design d, optionally using the gate eigenvalues gate_eigenvalues.
QuantumACES.get_full_design — Methodget_full_design(d::Design; diagnostics::Bool = false)Returns a copy of the design d where the covariance matrix dictionary generates the full covariance matrix, printing diagnostics if diagnostics is true.
QuantumACES.get_gate_eigenvalues — Methodget_gate_eigenvalues(d::Design)Returns the gate eigenvalues of the design d.
QuantumACES.get_gate_probabilities — Methodget_gate_probabilities(d::Design)Returns the gate error probabilities of the design d.
QuantumACES.get_marginal_gate_eigenvalues — Methodget_marginal_gate_eigenvalues(d::Design)Returns the gate eigenvalues of the design d marginalised over gate orbits.
QuantumACES.get_marginal_gate_probabilities — Methodget_marginal_gate_probabilities(d::Design)Returns the gate error probabilities of the design d marginalised over gate orbits.
QuantumACES.get_relative_gate_eigenvalues — Methodget_relative_gate_eigenvalues(d::Design)Returns the gate eigenvalues of the design d marginalised over gate orbits which can be estimated to relative precision.
QuantumACES.get_relative_gate_probabilities — Methodget_relative_gate_probabilities(d::Design)Returns the gate error probabilities of the design d marginalised over gate orbits which can be estimated to relative precision.
QuantumACES.update_noise — Methodupdate_noise(d::Design, noise_param::AbstractNoiseParameters)
update_noise(d::Design, gate_probabilities::Dict{Gate, Vector{Float64}})Returns a copy of the design d where the circuit has been updated with noise generated according to noise_param, or the gate probabilities gate_probabilities.
Private functions
QuantumACES.calc_consistency_set — Methodcalc_consistency_set(mapping_set::Vector{Mapping})Returns a list for each mapping in mapping_set of all other mappings with which it is simultaneously preparable and measurable, and hence tuple-consistent.
QuantumACES.calc_covariance_dict — Methodcalc_covariance_dict(c::AbstractCircuit, mapping_set::Vector{Mapping}, experiment_set::Vector{Vector{Int}}, full_covariance::Bool)Returns a dictionary with the requisite information to calculate the sparse circuit eigenvalue estimator covariance matrix for the arranged circuit c, with mappings mapping_set, when estimated by the experiments in experiment_set. If full_covariance is true, then this constructs the full covariance matrix, whereas if full_covariance is false, then this constructs only the diagonal terms of the covariance matrix.
BEWARE: This currently assumes that circuit eigenvalues for Paulis supported on $n$ qubits require preparing exactly and only $2^n$ sign configurations. Errors will occur if this is not the case, and they are not guaranteed to be noisy. If creating a circuit where this is not the case, you will need to provide new methods for this function.
QuantumACES.calc_experiment_set — Methodcalc_experiment_set(mapping_set::Vector{Mapping}, consistency_set::Vector{Vector{Int}})Returns a set of experiments which simultaneously estimate the circuit eigenvalues corresponding to the mappings in mapping_set, whose tuple-consistency relations are described by consistency_set.
QuantumACES.calc_mapping — Methodcalc_mapping(initial::Pauli, gate_index_dict::Dict{Gate, Int}, c::AbstractCircuit)Returns a Mapping object for the Pauli initial when mapped by the circuit c with gate index dictionary gate_index_dict.
QuantumACES.calc_mapping_set — Methodcalc_mapping_set(c::AbstractCircuit)Returns a vector of Mapping objects for each single-qubit Pauli on the qubits in the circuit c, and each two-qubit Pauli supported on some gate in the circuit c.
QuantumACES.get_eigenvalues_ensemble — Methodget_eigenvalues_ensemble(d::Design)
get_eigenvalues_ensemble(d::Design, gate_eigenvalues::Vector{Float64})Returns the circuit eigenvalue ensemble of the design d, optionally using the gate eigenvalues gate_eigenvalues.
QuantumACES.get_experiment_layers — Methodget_experiment_layers(c::AbstractCircuit, mapping_set::Vector{Mapping}, experiment_set::Vector{Vector{Int}})Returns circuit layers that prepare and measure the initial and final Paulis as given by the mappings in mapping_set, for each experiment in experiment set. If c has a partition field, this is used to generate all necessary sign configurations for the preparation layers.
QuantumACES.get_meas_layer — Methodget_meas_layer(final::Pauli, final_support::Vector{Int})Returns a layer which measures the Pauli final, supported on the qubits in final_support.
QuantumACES.get_pauli_prep_set — Methodget_pauli_prep_set(gates::Vector{Gate}, n::Integer)Returns all weight-1 Paulis on all n qubits, as well as the weight-2 Paulis supported on some gate in gates.
QuantumACES.get_prep_layer — Methodget_prep_layer(initial::Pauli, initial_support::Vector{Int})Returns a layer which prepares the Pauli initial, supported on the qubits in initial_support.
QuantumACES.update_design_row! — Methodupdate_design_row!(design_row::Vector{Int}, pauli::Pauli, l::Layer, gate_index_dict::Dict{Gate, Int})Updates the design matrix row design_row according to the Pauli pauli for each gate in the layer l, using the gate index dictionary gate_index_dict.