rand_design.jl
Public functions
QuantumACES.RandDesign
— TypeRandDesign
Pauli frame randomised experimental ensemble for an experimental design.
Fields
d::Design
: Experimental design.pauli_randomisation_ensemble::Vector{Vector{Vector{Vector{String}}}}
: For each tuple, experiment, and randomisation, a vector of Pauli frame randomisations between each layer in the randomised circuit.pauli_sign_ensemble::Vector{Vector{Vector{Vector{Bool}}}}
: For each tuple, experiment, and randomisation, a vector of signs for the Paulis estimated by the randomised experiment.covariance_pauli_sign_ensemble::Vector{Vector{Vector{Vector{Bool}}}}
: For each tuple, experiment, and randomisation, a vector of signs for the covariance Paulis estimated by the randomised experiment.job_indices::Vector{Vector{NTuple{3, Int}}}
: For each job, a vector of indices (tuple, experiment, randomisation) for each circuit in the job.randomisations::Vector{Int}
: Number of randomisations for the experiment set corresponding to each tuple in the design.shot_budget::Int
: Shot budget for the randomised experimental ensemble.experiment_shots::Int
: Number of shots for each experiment in the randomised experimental ensemble.seed::UInt64
: Random seed used to generate the randomised experimental ensemble.
QuantumACES.generate_rand_design
— Methodgenerate_rand_design(d::Design, randomisations::Vector{Int}, shot_budget::Integer, experiment_shots::Integer; kwargs...)
generate_rand_design(d::Design, min_randomisations::Integer, target_shot_budget::Integer, experiment_shots::Integer; kwargs...)
Returns a RandDesign
object describing a Pauli frame randomised experimental ensemble for the design d
. Supply either the number of randomisations randomisations
and shot budget shot_budget
output by get_randomisations
, as well as the number of shots for each experiment experiment_shots
, or the arguments of that function, namely the minimum number of randomisations min_randomisations
, target shot budget target_shot_budget
, and number of shots for each experiment experiment_shots
.
Arguments
d::Design
: Experimental design.randomisations::Vector{Int}
: Number of randomisations for each tuple in the design.shot_budget::Integer
: Shot budget for the randomised experimental ensemble.min_randomisations::Integer
: Minimum number of randomisations for each tuple in the design.target_shot_budget::Integer
: Target shot budget for the randomised experimental ensemble.experiment_shots::Integer
: Number of shots for each experiment in the randomised experimental ensemble.
Keyword arguments
job_circuit_number::Integer = 200
: Number of circuits in each job.seed::Union{UInt64, Nothing} = nothing
: Random seed for the randomisation.diagnostics::Bool = false
: Whether to print diagnostics.save_data::Bool = false
: Whether to save the randomised design.
QuantumACES.get_design
— Methodget_design(d_rand::RandDesign)
Returns the design corresponding to the randomised design d_rand
.
QuantumACES.get_meas_budget
— Methodget_meas_budget(d_rand::RandDesign)
Returns the measurement budget corresponding to the randomised design d_rand
.
QuantumACES.get_randomisations
— Methodget_randomisations(d::Design, min_randomisations::Integer, target_shot_budget::Integer, experiment_shots::Integer; p_norm::Real = 2)
Returns the number of randomisations for each tuple in the experimental design d
, given a target shot budget target_shot_budget
, number of shots for each experiment experiment_shots
, and minimum number of randomisations min_randomisations
. The number of randomisations is greedily optimised to minimise the p_norm
-norm to the shot weights associated with the experimental design.
Typically, the 2-norm works better for smaller shot budgets, and the 1-norm works better for larger shot budgets. The number of randomisations corresponds to unnormalised shot weights randomisations .* d.experiment_numbers
.
QuantumACES.get_stim_qiskit_ensemble
— Methodget_stim_qiskit_ensemble(d_rand::RandDesign, qiskit_qubit_num::Integer, qiskit_qubit_map::Vector{Int})
Returns the Stim and Qiskit circuits for the randomised ensemble d_rand
.
The Qiskit circuits act on qiskit_qubit_num
qubits, which in general must be at least maximum(qiskit_qubit_map) + 1
, and the mapping of the qubits upon which the circuits act to the qubits in the Qiskit circuits is controlled by qiskit_qubit_map
, which is a vector whose length is the number of qubits upon which the circuits act.
Private functions
QuantumACES.append_qiskit!
— Methodappend_qiskit!(qiskit_circuit::Py, l::Layer, qiskit_qubit_map::Vector{Int})
Appends the gates in the layer l
to the Qiskit circuit qiskit_circuit
, using the mapping to Qiskit qubits given by qiskit_qubit_map
.
QuantumACES.append_qiskit_gate!
— Methodappend_qiskit_gate!(qiskit_circuit, gate_type::String, gate_targets::Vector{Vector{Int}})
Appends the gates of the type gate_type
to the Qiskit circuit qiskit_circuit
with the targets specified by gate_targets
.
QuantumACES.calc_mapping_signs
— Methodcalc_mapping_signs(experiment_mappings::Vector{Mapping}, randomised_circuit::Vector{Layer})
Returns the signs of the Paulis corresponding to the mappings in experiment_mappings
for the randomised circuit randomised_circuit
.
QuantumACES.get_pauli_layer
— Methodget_pauli_layer(pauli_string::String, n::Int16)
Returns a layer of Pauli gates corresponding to the supplied Pauli string pauli_string
on n
qubits.`
QuantumACES.get_randomised_circuit
— Methodget_randomised_circuit(prep_layer::Layer, tuple_circuit::Vector{Layer}, meas_layer::Layer, pauli_randomisation::Vector{String})
Returns the randomised circuit corresponding to the preparation layer prep_layer
, tuple circuit tuple_circuit
, measurement layer meas_layer
, interspersed with the Pauli frame randomisation layers specified by pauli_randomisation
.
QuantumACES.get_stim_qiskit_circuit
— Methodget_stim_qiskit_circuit(randomised_circuit::Vector{Layer}, gate_probabilities::Dict{Gate, Vector{Float64}}, qiskit_qubit_num::Integer, qiskit_qubit_map::Vector{Int}, noisy_prep::Bool, noisy_meas::Bool; extra_fields::Dict{Symbol, Any} = Dict{Symbol, Any}())
Generate the Stim circuit string and Qiskit circuit for a Pauli frame randomised circuit randomised_circuit
.
The Stim circuit features noise on each of the non-randomisation gates specified by gate_probabilities
, as well as noisy preparations if noisy_prep
is true
, and noisy measurements if noisy_meas
is true
. Qubit coordinates are specified by extra_fields
if it contains a CodeParameters
object.
The Qiskit circuit acts on qiskit_qubit_num
qubits, which in general must be at least maximum(qiskit_qubit_map) + 1
, and the mapping of the qubits upon which the circuit acts to the qubits in the Qiskit circuit is controlled by qiskit_qubit_map
, which is a vector whose length is the number of qubits upon which the circuit acts.