circuit.jl

Public functions

QuantumACES.CircuitType
Circuit

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 if add_prep and noisy measurements if add_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 by gate_index.
  • add_prep::Bool: Whether to treat preparations as noisy and characterise the associated noise, defaulting to false; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • add_meas::Bool: Whether to treat measurements as noisy and characterise the associated noise, defaulting to true; a full-rank design cannot be produced if both add_prep and add_meas are true.
source
QuantumACES.RotatedPlanarCircuitType
RotatedPlanarCircuit

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 if add_prep and noisy measurements if add_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 by gate_index.
  • add_prep::Bool: Whether to treat preparations as noisy and characterise the associated noise, defaulting to false; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • add_meas::Bool: Whether to treat measurements as noisy and characterise the associated noise, defaulting to true; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • 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.
source
QuantumACES.RotatedPlanarParametersType
RotatedPlanarParameters

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.
source
QuantumACES.UnrotatedPlanarCircuitType
UnrotatedPlanarCircuit

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 if add_prep and noisy measurements if add_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 by gate_index.
  • add_prep::Bool: Whether to treat preparations as noisy and characterise the associated noise, defaulting to false; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • add_meas::Bool: Whether to treat measurements as noisy and characterise the associated noise, defaulting to true; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • 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.
source
QuantumACES.UnrotatedPlanarParametersType
UnrotatedPlanarParameters

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.
source
QuantumACES.get_circuitMethod
get_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 to false; a full-rank design cannot be produced if both add_prep and add_meas are true.
  • add_meas::Bool = true: Whether to treat measurements as noisy and characterise the associated noise, defaulting to true; a full-rank design cannot be produced if both add_prep and add_meas are true.
source
QuantumACES.get_layer_timesMethod
get_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.

source
QuantumACES.get_rotated_paramMethod
get_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 setting vertical_dist = dist and horizontal_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.
source
QuantumACES.get_unrotated_paramMethod
get_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 setting vertical_dist = dist and horizontal_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.
source
QuantumACES.prepare_circuitMethod
prepare_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 if add_prep and measurements if add_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 by gate_index.
source
QuantumACES.update_noiseMethod
update_noise(c::AbstractCircuit, noise_param::AbstractNoiseParameters)

Returns a copy of c where the circuit has been updated with noise generated according to noise_param.

source

Private functions

QuantumACES.apply_tupleMethod
apply_tuple(c::AbstractCircuit, circuit_tuple::Vector{Int})

Returns a copy of the circuit c arranged by the tuple circuit_tuple.

source
QuantumACES.get_gatesMethod
get_gates(circuit::Vector{Vector{Gate}})
get_gates(circuit::Vector{Layer})

Returns the unique gates in the circuit circuit.

source
QuantumACES.index_gatesMethod
index_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.

source
QuantumACES.label_circuitMethod
label_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.

source
QuantumACES.unwrap_circuitMethod
unwrap_circuit(circuit::Vector{Layer})

Returns a copy of the circuit circuit where each layer has been unwrapped into a vector of gates.

source