circuit.jl
Public functions
QuantumACES.Circuit
— TypeCircuit
Circuit information, including noise parameters.
Fields
circuit_param::AbstractCircuitParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.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 layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.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}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.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 bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.
QuantumACES.RotatedPlanarCircuit
— TypeRotatedPlanarCircuit
Syndrome extraction circuit for a rotated surface code.
Fields
circuit_param::RotatedPlanarParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.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 layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.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}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.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 bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.partition::Tuple{Vector{Int}, Vector{Int}}
: Partition of the qubits (data, ancilla), allowing for easy preparation of sign configurations for Pauli eigenstates.qubits::Vector{Tuple{Int, Int}}
: Code qubit lattice locations.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.qubit_layout::Matrix{String}
: Diagram of the layout of the code qubits.
QuantumACES.RotatedPlanarParameters
— TypeRotatedPlanarParameters
Parameters for the syndrome extraction circuit of a rotated surface code.
Fields
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.check_type::Symbol
: Type of stabiliser used in the circuit, either:xzzx
or:standard
.gate_type::Symbol
: Type of two-qubit gate used in the circuit, either:cx
or:cz
.dynamically_decouple::Bool
: Whether to dynamically decouple the circuit;true
is currently only supported for:xzzx
and:cz
.pad_identity::Bool
: Whether to pad layers with single-qubit identity gates.layer_time_dict::Dict{Symbol, Float64}
: Dictionary of layer times.circuit_name::String
: Name of the circuit used for saving data.
QuantumACES.UnrotatedPlanarCircuit
— TypeUnrotatedPlanarCircuit
Syndrome extraction circuit for a unrotated surface code.
Fields
circuit_param::UnrotatedPlanarParameters
: Circuit parameters.circuit::Vector{Layer}
: Circuit arranged by the tuple.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 layer indices of the circuit, which become meaningless and are removed the circuit is arranged by the tuple.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}
: Gates in the original circuit, which includes noisy preparations ifadd_prep
and noisy measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gates in the original circuit.N::Int
: Number of gate eigenvalues.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 bygate_index
.add_prep::Bool
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.partition::Tuple{Vector{Int}, Vector{Int}}
: Partition of the qubits (data, ancilla), allowing for easy preparation of sign configurations for Pauli eigenstates.qubits::Vector{Tuple{Int, Int}}
: Code qubit lattice locations.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.qubit_layout::Matrix{String}
: Diagram of the layout of the code qubits.
QuantumACES.UnrotatedPlanarParameters
— TypeUnrotatedPlanarParameters
Parameters for the syndrome extraction circuit of an unrotated surface code.
Fields
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.gate_type::Symbol
: Type of two-qubit gate used in the circuit, which must be:cx
.pad_identity::Bool
: Whether to pad layers with single-qubit identity gates.layer_time_dict::Dict{Symbol, Float64}
: Dictionary of layer times.circuit_name::String
: Name of the circuit used for saving data.
QuantumACES.get_circuit
— Methodget_circuit(rotated_param::RotatedPlanarParameters, noise_param::AbstractNoiseParameters; kwargs...)
get_circuit(unrotated_param::UnrotatedPlanarParameters, noise_param::AbstractNoiseParameters; kwargs...)
Returns a circuit object, a subtype T <: AbstractCircuit
, parameterised by the supplied circuit and noise parameters.
Arguments
rotated_param::RotatedPlanarParameters
: Parameters for a rotated surface code.unrotated_param::UnrotatedPlanarParameters
: Parameters for an unrotated surface code.noise_param::AbstractNoiseParameters
: Noise parameters for the circuit.
Keyword arguments
add_prep::Bool = false
: Whether to treat preparations as noisy and characterise the associated noise, defaulting tofalse
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.add_meas::Bool = true
: Whether to treat measurements as noisy and characterise the associated noise, defaulting totrue
; a full-rank design cannot be produced if bothadd_prep
andadd_meas
aretrue
.
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 measurement and reset at the end.
QuantumACES.get_rotated_param
— Methodget_rotated_param(vertical_dist::Int, horizontal_dist::Int; kwargs...)
get_rotated_param(dist::Int; kwargs...)
Returns a RotatedPlanarParameters
object that parameterises the syndrome extraction circuit of a rotated surface code.
Default gate layer times are estimated from Suppressing quantum errors by scaling a surface code logical qubit
by Google Quantum AI (2023).
Arguments
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.dist::Int
: Distance of the code; this is equivalent to settingvertical_dist = dist
andhorizontal_dist = dist
.
Keyword arguments
check_type::Symbol = :xzzx
: Type of stabiliser used in the circuit, either:xzzx
or:standard
.gate_type::Symbol = :cz
: Type of two-qubit gate used in the circuit, either:cx
or:cz
.dynamically_decouple::Bool = true
: Whether to dynamically decouple the circuit;true
is currently only supported for:xzzx
and:cz
.pad_identity::Bool = true
: Whether to pad layers with single-qubit identity gates.single_qubit_time::Float64 = 29.0
: Time taken to implement a single-qubit gate in nanoseconds.two_qubit_time::Float64 = 29.0
: Time taken to implement a two-qubit gate in nanoseconds.meas_reset_time::Float64 = 660.0
: Time taken to perform measurement and reset at the end of the circuit in nanoseconds.dynamical_decoupling_time::Float64 = 29.0
: Time taken to implement a dynamical decoupling layer in nanoseconds.
QuantumACES.get_unrotated_param
— Methodget_unrotated_param(vertical_dist::Int, horizontal_dist::Int; kwargs...)
get_unrotated_param(dist::Int; kwargs...)
Returns an UnrotatedPlanarParameters
object that parameterises the syndrome extraction circuit of a unrotated surface code.
Default gate layer times are estimated from Suppressing quantum errors by scaling a surface code logical qubit
by Google Quantum AI (2023).
Arguments
vertical_dist::Int
: Vertical (Z) distance of the code.horizontal_dist::Int
: Horizontal (X) distance of the code.dist::Int
: Distance of the code; this is equivalent to settingvertical_dist = dist
andhorizontal_dist = dist
.
Keyword arguments
gate_type::Symbol = :cx
: Type of two-qubit gate used in the circuit, which must be:cx
.pad_identity::Bool = true
: Whether to pad layers with single-qubit identity gates.single_qubit_time::Float64 = 29.0
: Time taken to implement a single-qubit gate in nanoseconds.two_qubit_time::Float64 = 29.0
: Time taken to implement a two-qubit gate in nanoseconds.dynamical_decoupling_time::Float64 = 29.0
: Time taken to implement a dynamical decoupling layer in nanoseconds.meas_reset_time::Float64 = 660.0
: Time taken to perform measurement and reset at the end of the circuit in nanoseconds.
QuantumACES.prepare_circuit
— Methodprepare_circuit(circuit::Vector{Layer}, qubit_num::Int, layer_types::Vector{Symbol}, layer_times::Vector{Float64}, noise_param::AbstractNoiseParameters; add_prep::Bool = false, add_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.qubit_num::Int
: Number of qubits in the 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, including measurement and reset at the end.noise_param::AbstractNoiseParameters
: Noise parameters.
Keyword arguments
add_prep::Bool = false
: Whether to treat preparations as noisy and aim to characterise them.add_meas::Bool = true
: Whether to treat measurements as noisy and aim to characterise them.
Returns
circuit::Vector{Layer}
: Circuit with labelled gates.unique_layer_indices::Vector{Int}
: Indices of the unique layers in the circuit.gates::Vector{Gate}
: Gates in the circuit.total_gates::Vector{Gate}
: Total gates in the circuit, including preparations ifadd_prep
and measurements ifadd_meas
.gate_index::Dict{Gate, Int}
: Index of the gate eigenvalues for each gate in the original circuit.N::Int
: Number of gate eigenvalues.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 bygate_index
.
QuantumACES.update_noise
— Methodupdate_noise(c::AbstractCircuit, noise_param::AbstractNoiseParameters)
Returns a copy of c
where the circuit has been updated with noise generated according to noise_param
.
Private functions
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.get_gates
— Methodget_gates(circuit::Vector{Vector{Gate}})
get_gates(circuit::Vector{Layer})
Returns the unique gates in the circuit circuit
.
QuantumACES.index_gates
— Methodindex_gates(gates::Vector{Gate}, n::Integer, add_prep::Bool, add_meas::Bool)
Returns a dictionary indexing the gates in gates
, adding preparations and measurements on all n
qubits to the gates add_prep
and add_meas
are true
, respectively, as well as the total collection of gates once these have been added and the number of gate eigenvalues.
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.rotated_planar_circuit
— Methodrotated_planar_circuit(rotated_param::RotatedPlanarParameters)
Returns fields used to construct the syndrome extraction circuit of a rotated surface code in the form of a RotatedPlanarCircuit
object, based on the supplied parameters rotated_param
.
QuantumACES.unrotated_planar_circuit
— Methodunrotated_planar_circuit(unrotated_param::UnrotatedPlanarParameters)
Returns fields used to construct the syndrome extraction circuit of an unrotated surface code in the form of a UnrotatedPlanarCircuit
object, based on the supplied parameters unrotated_param
.
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.