utils.jl

Public functions

QuantumACES.calc_pauliMethod
calc_pauli(initial::Pauli, circuit::Vector{Layer})

Returns the Pauli to which the initial Pauli initial is mapped after the circuit circuit is applied.

source
QuantumACES.display_circuitMethod
display_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.

source
QuantumACES.eig_to_pair_idxMethod
eig_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.

source
QuantumACES.get_mapping_stringMethod
get_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.

source
QuantumACES.get_paulisMethod
get_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.

source
QuantumACES.get_stim_circuitMethod
get_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.

source
QuantumACES.pair_to_eig_idxMethod
pair_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.

source
QuantumACES.parse_bitstringMethod
parse_bitstring(uint8_vector::Vector{UInt8}, bit_num::Integer)

Returns the UInt8 vector uint8_vector parsed into a bitstring of length bit_num.

source
QuantumACES.parse_qiskit_dictMethod
parse_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.

source
QuantumACES.pretty_printMethod
pretty_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.

source
QuantumACES.pretty_printMethod
pretty_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.

source
QuantumACES.pretty_printMethod
pretty_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.

source

Private functions

QuantumACES.batch_shotsMethod
batch_shots(shots::Integer, measurements::Integer, max_samples::Integer)

Returns the shots divided into batches for sampling from Stim.

source
QuantumACES.calc_gate_orbitsMethod
calc_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.

source
QuantumACES.calc_orbitMethod
calc_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.

source
QuantumACES.get_orbit_indicesMethod
get_orbit_indices(gate_orbits::Vector{Vector{Pauli}})

Returns the Pauli orbit indices for each of the Pauli orbits in gate_orbits.

source
QuantumACES.project_simplexMethod
project_simplex(probabilities::Vector{Float64})

Returns a copy of the probability distribution probabilities projected into the probability simplex according to the Euclidean norm.

source
QuantumACES.scs_project_nonnegativeMethod
scs_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.

source