utils.jl
Public functions
QuantumACES.calc_pauli — Methodcalc_pauli(initial::Pauli, circuit::Vector{Layer})Returns the Pauli to which the initial Pauli initial is mapped after the circuit circuit is applied.
QuantumACES.display_circuit — Methoddisplay_circuit(stim_circuit_string::String; without_noise::Bool = true)
display_circuit(qiskit_circuit::Py)Displays the supplied Stim or Qiskit circuit stim_circuit_string or qiskit_circuit, and if without_noise is true, displays the Stim circuit without Pauli noise channels. Be careful: Python arrays stored in PythonCall index from 0, so it is easy to index into the wrong Qiskit circuit.
QuantumACES.eig_to_pair_idx — Methodeig_to_pair_idx(d::Design, eigenvalue_idx::Integer)
eig_to_pair_idx(d::Design, eigenvalue_indices::Vector{Int})Returns the (tuple_idx, mapping_idx) pair of indices for each eigenvalue index eigenvalue_idx corresponding to the design d.
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_paulis — Methodget_paulis(n::Integer)Returns a list of all n-qubit Paulis ordered lexicographically according to their bit string representation described in Pauli. 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_random_pauli — Methodget_random_pauli(n::Integer)Returns the string representation of a random n-qubit Pauli.
QuantumACES.get_stim_circuit — Methodget_stim_circuit(c::AbstractCircuit)
get_stim_circuit(c::AbstractCircuit, circuit_tuple::Vector{Int})
get_stim_circuit(c::AbstractCircuit, gate_probabilities::Dict{Gate, Vector{Float64}})
get_stim_circuit(c::AbstractCircuit, circuit_tuple::Vector{Int}, gate_probabilities::Dict{Gate, Vector{Float64}})
get_stim_circuit(d::Design)
get_stim_circuit(d::Design, gate_probabilities::Dict{Gate, Vector{Float64}})
get_stim_circuit(d_rand::RandDesign)
get_stim_circuit(d_rand::RandDesign, gate_probabilities::Dict{Gate, Vector{Float64}})Returns the Stim circuit for the circuit c, stored in the design d, or randomised design d_rand, optionally applying the tuple circuit_tuple with the gate probabilities gate_probabilities.
QuantumACES.get_support — Methodget_support(p::Pauli)Returns the support of the Pauli p.
QuantumACES.pair_to_eig_idx — Methodpair_to_eig_idx(d::Design, pair_idx::Tuple{Int, Int})
pair_to_eig_idx(d::Design, pair_indices::Vector{Tuple{Int, Int}})Returns the eigenvalue index eigenvalue_idx corresponding to the pair index (tuple_idx, mapping_idx) corresponding to the design d.
QuantumACES.parse_bitstring — Methodparse_bitstring(uint8_vector::Vector{UInt8}, bit_num::Integer)Returns the UInt8 vector uint8_vector parsed into a bitstring of length bit_num.
QuantumACES.parse_qiskit_dict — Methodparse_qiskit_dict(counts::Dict{String, Int}, shots::Integer, qiskit_qubit_num::Integer; qiskit_qubit_map::Union{Vector{Int}, Nothing} = nothing)Returns a parsed Stim-compatible matrix of UInt8 circuit outcomes determined from the dictionary counts output by Qiskit with shots shots, where the circuit acts on qiskit_qubit_num qubits, and if qiskit_qubit_map is not nothing, checks that the measurement outcomes for the qubits not included in the map are 0.
QuantumACES.parse_uint8_vector — Methodparse_uint8_vector(bitstring::String)Returns the bitstring bitstring parsed into a UInt8 vector.
QuantumACES.pauli_to_string — Methodpauli_to_string(p::Pauli)Returns the string representation of the Pauli p.
QuantumACES.pretty_print — Methodpretty_print(io::IO, aces_data::ACESData, merit::Merit; projected::Bool = false)
pretty_print(aces_data::ACESData, merit::Merit; projected::Bool = false)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 predictions in the merit data merit, or for the projected gate eigenvalue estimator vector if projected is true.
QuantumACES.pretty_print — Methodpretty_print(io::IO, d::Design)
pretty_print(d::Design)Prints the tuple set and shot weight data of the design d in a readable format.
QuantumACES.pretty_print — Methodpretty_print(c::AbstractCircuit)
pretty_print(c::AbstractCircuit, circuit_tuple::Vector{Int})Prints the circuit c using Stim in a readable format, optionally rearranged by the tuple circuit_tuple.
QuantumACES.string_to_pauli — Methodstring_to_pauli(pauli_string::String)Returns the Pauli corresponding to the string representation pauli_string.
Private functions
QuantumACES.batch_shots — Methodbatch_shots(shots::Integer, measurements::Integer, max_samples::Integer)Returns the shots divided into batches for sampling from Stim.
QuantumACES.calc_gate_orbits — Methodcalc_gate_orbits(gate::Gate; ignore_sign::Bool = true)Returns the Pauli orbits generated by the gate gate, for all Paulis supported on that gate, ignoring the sign of the Pauli operators if ignore_sign is true.
QuantumACES.calc_orbit — Methodcalc_orbit(initial::Pauli, gate::Gate; ignore_sign::Bool = true)Returns the Pauli orbit generated by the gate gate acting on the Pauli initial, ignoring the sign of the Pauli operators if ignore_sign is true.
QuantumACES.get_orbit_indices — Methodget_orbit_indices(gate_orbits::Vector{Vector{Pauli}})Returns the Pauli orbit indices for each of the Pauli orbits in gate_orbits.
QuantumACES.project_simplex — Methodproject_simplex(probabilities::Vector{Float64})Returns a copy of the probability distribution probabilities projected into the probability simplex according to the Euclidean norm.
QuantumACES.scs_project_nonnegative — Methodscs_project_nonnegative(vector::Vector{Float64}, precision_matrix::SparseMatrixCSC{Float64, Int}; precision::Real = 1e-8, diagnostics::Bool = false)Returns a copy of the vector vector projected into the nonnegative orthant according to the quadratic form defined by the precision matrix precision_matrix using the solver SCS, with the specified precision precision, and printing diagonstics if diagnostics is true.