circuit.jl
Public functions
QuantumACES.Circuit
— TypeCircuit
Circuit information, including noise parameters.
Fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit.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 non-measurement gate layer indices of the circuit.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}
: Total gates in the circuit, including preparations ifnoisy_prep
and measurements ifnoisy_meas
.gate_data::GateData
: Gate data for the circuit.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 by the gate order intotal_gates
and indexed bygate_data
.noisy_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 bothnoisy_prep
andnoisy_meas
aretrue
.noisy_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 bothnoisy_prep
andnoisy_meas
aretrue
.extra_fields::Dict{Symbol, Any}
: Extra data for the circuit, including code parameters for syndrome extraction circuits stored as a:code_param
field which is aCodeParameters
object.
QuantumACES.CodeParameters
— TypeCodeParameters
Code parameters for syndrome extraction circuits.
Note that these expect the qubits to be arranged such that the data qubits are first, followed by the ancilla qubits, and these parameters should be checked with check_code_parameters
.
Fields
qubits::Vector{Tuple{Int, Int}}
: Code qubit lattice locations.qubit_layout::Matrix{String}
: Diagram of the layout of the code qubits.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.check_x_indices::Vector{Tuple{Vector{Int}, Vector{Int}}}
: Pairs of (ancilla, data) qubit indices for each of the X checks.check_z_indices::Vector{Tuple{Vector{Int}, Vector{Int}}}
: Pairs of (ancilla, data) qubit indices for each of the Z checks.init_x_indices::Vector{Int}
: Logical X initialisation qubit indices for which to initialise in the X basis.init_z_indices::Vector{Int}
: Logical Z initialisation qubit indices for which to initialise in the X basis.logical_x_indices::Vector{Int}
: Logical X operator qubit indices.logical_z_indices::Vector{Int}
: Logical Z operator qubit indices.
QuantumACES.EmptyCircuitParameters
— TypeEmptyCircuitParameters
Empty circuit parameters.
QuantumACES.get_circuit
— Methodget_circuit(circuit::Vector{Layer}, layer_types::Vector{Symbol}, layer_times::Vector{Float64}, noise_param::AbstractNoiseParameters; kwargs...)
Returns a Circuit
object given the supplied circuit and noise parameters.
Arguments
circuit::Vector{Layer}
: 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, as well as measurement and reset.noise_param::AbstractNoiseParameters
: Noise parameters for the circuit.
Keyword arguments
circuit_param::AbstractCircuitParameters = EmptyCircuitParameters()
: Circuit parameters.extra_fields::Dict{Symbol, Any} = Dict{Symbol, Any}()
: Extra fields, including forCodeParameters
.noisy_prep::Bool = false
: Whether to treat preparations as noisy and characterise the associated noise; a full-rank design cannot be produced if bothnoisy_prep
andnoisy_meas
aretrue
.noisy_meas::Bool = true
: Whether to treat measurements as noisy and characterise the associated noise; a full-rank design cannot be produced if bothnoisy_prep
andnoisy_meas
aretrue
.combined::Bool = haskey(noise_param.params, :combined) ? noise_param.params[:combined] : false,
: Whether to treat Pauli X, Y, and Z basis SPAM noise as the same.strict::Bool = false
: Whether to be strict about which gates count as estimable to relative precision.
QuantumACES.get_combined_circuit
— Methodget_combined_circuit(c::AbstractCircuit)
Returns a copy of the circuit c
where the three parameters describing Pauli X, Y, and Z basis measurements have been combined into a single parameter for each qubit.
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 final measurement and reset.
QuantumACES.update_noise
— Methodupdate_noise(c::AbstractCircuit, noise_param::AbstractNoiseParameters)
update_noise(c::AbstractCircuit, gate_probabilities::Dict{Gate, Vector{Float64}})
Returns a copy of c
where the circuit has been updated with noise generated according to noise_param
, or the gate probabilities gate_probabilities
.
Private functions
QuantumACES.EmptyNoiseParameters
— TypeEmptyNoiseParameters
Empty noise parameters.
QuantumACES.apply_tuple
— Methodapply_tuple(c::AbstractCircuit, circuit_tuple::Vector{Int})
Returns a copy of the circuit c
arranged by the tuple circuit_tuple
.
QuantumACES.check_circuit
— Methodcheck_circuit(circuit::Vector{Layer}, circuit_tuple::Vector{Int}, qubit_num::Integer, layer_types::Vector{Symbol}, layer_times::Vector{Float64})
Checks the provided circuit parameters are consistent with each other.
QuantumACES.check_code_parameters
— Methodcheck_code_parameters(code_param::CodeParameters, qubit_num::Integer)
Checks the provided code parameters are consistent with each other.
QuantumACES.get_gates
— Methodget_gates(circuit::Vector{Vector{Gate}})
get_gates(circuit::Vector{Layer})
Returns the unique gates in the circuit circuit
.
QuantumACES.get_total_gates
— Methodget_total_gates(circuit::Vector{Layer}, noisy_prep::Bool, noisy_meas::Bool)
Returns the total gates in the circuit circuit
, including preparations if noisy_prep
and measurements if noisy_meas
each on all of the qubits, as well as a separate list of the added measurement gates.
QuantumACES.label_circuit
— Methodlabel_circuit(circuit::Vector{Vector{Gate}})
label_circuit(circuit::Vector{Layer})
Returns a labelled copy of the circuit circuit
, with indices indicating the unique layer appearances of each gate in the circuit. This function should only be applied to the original circuit before it is arranged by a tuple.
QuantumACES.prepare_circuit
— Methodprepare_circuit(circuit::Vector{Layer}, noise_param::AbstractNoiseParameters; noisy_prep::Bool = false, noisy_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.noise_param::AbstractNoiseParameters
: Noise parameters.
Keyword arguments
noisy_prep::Bool = false
: Whether to treat preparations as noisy and aim to characterise them.noisy_meas::Bool = true
: Whether to treat measurements as noisy and aim to characterise them.combined::Bool
: Whether to treat Pauli X, Y, and Z basis SPAM noise as the same.strict::Bool = false
: Whether to be strict about which gates count as estimable to relative precision.
Returns
circuit::Vector{Layer}
: Circuit with labelled gates.unique_layer_indices::Vector{Int}
: Unique non-measurement gate layer indices of the circuit.gates::Vector{Gate}
: Gates in the circuit.total_gates::Vector{Gate}
: Total gates in the circuit, including preparations ifnoisy_prep
and measurements ifnoisy_meas
.gate_data::GateData
: Gate data for the circuit.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 by the gate order intotal_gates
and indexed bygate_data
.
QuantumACES.unwrap_circuit
— Methodunwrap_circuit(circuit::Vector{Layer})
Returns a copy of the circuit circuit
where each layer has been unwrapped into a vector of gates.