tableau.jl
Public functions
QuantumACES.Gate
— TypeGate
A gate in a stabiliser circuit.
Fields
type::String
: String describing the gate type.index::Int32
: The index labelling the unique layer occurrences of the gate in a circuit.targets::Vector{Int16}
: The qubit target or targets of the gate.
Supported gates
H
: Hadamard gate.S
: Phase gate.S_DAG
: Conjugate phase gate.CX
orCNOT
: Controlled-X gate; the first qubit is the control and the second qubit is the target.CZ
: Controlled-Z gate.I
: Identity gate.Z
: Pauli Z gate.X
: Pauli X gate.Y
: Pauli Y gate.II
: Two-qubit identity gate.AB
: Two-qubit Pauli gate, whereA
andB
are PaulisZ
,X
, orY
.SQRT_AB
: Two-qubit Pauli rotation, whereA
andB
are PaulisZ
,X
, orY
.SQRT_AB_DAG
: Two-qubit Pauli rotation, whereA
andB
are PaulisZ
,X
, orY
.PZ
: Prepare the Pauli Z eigenstate.PX
: Prepare the Pauli X eigenstate.PY
: Prepare the Pauli Y eigenstate.M
orMZ
: Measure in the computational Pauli Z basis.MX
: Measure in the Pauli X basis.MY
: Measure in the Pauli Y basis.R
: Reset in the computational Z basis.
QuantumACES.Layer
— TypeLayer
A layer of gates in a stabiliser circuit. Gates in a layer are simultaneously implemented by the device, and act on disjoint sets of qubits such that they trivially commute with each other.
Fields
layer::Vector{Gate}
: The gates in the layer.qubit_num::Int16
: The number of qubits in the circuit.
QuantumACES.Tableau
— TypeTableau
A tableau representation of a stabiliser state.
Stabiliser circuit simulations follow Improved simulation of stabilizer circuits
by S. Aaronson and D. Gottesman (2004).
Fields
tableau::Matrix{Bool}
: The tableau representation of the stabiliser state.qubit_num::Int16
: The number of qubits in the stabiliser state.
QuantumACES.apply!
— Methodapply!(t::Tableau, l::Layer; return_measurements::Bool = false)
Perform on the tableau t
all gates in the layer l
, and return the list of measurement outcomes if return_measurements
is true
.
QuantumACES.get_one_qubit_gates
— Methodget_one_qubit_gates()
Returns a list of the supported single-qubit gate types.
QuantumACES.get_two_qubit_gates
— Methodget_two_qubit_gates(; stim_supported::Bool = false)
Returns a list of the supported two-qubit gate types, restricting to those also supported by Stim if stim_supported
is true
.
QuantumACES.is_additive
— Methodis_additive(g::Gate; strict::Bool = false)
Returns true
if the noise associated with the gate g
can only be estimated to additive precision, and false
otherwise. If strict
is true
, this is true
only for state preparation and measurement noise, as is proper, otherwise it is also true
for mid-circuit measurement and reset noise, and measurement idle noise.
QuantumACES.is_meas_idle
— Methodis_meas_idle(g::Gate)
Returns true
if the gate g
is a measurement idle gate, and false
otherwise.
QuantumACES.is_mid_meas
— Methodis_mid_meas(g::Gate)
Returns true
if the gate g
is a mid-circuit measurement gate, and false
otherwise.
QuantumACES.is_mid_meas_reset
— Methodis_mid_meas_reset(g::Gate)
Returns true
if the gate g
is a mid-circuit measurement or reset gate, and false
otherwise.
QuantumACES.is_mid_reset
— Methodis_mid_reset(g::Gate)
Returns true
if the gate g
is a mid-circuit reset gate, and false
otherwise.
QuantumACES.is_one_qubit
— Methodis_one_qubit(g::Gate)
Returns true
if the gate g
is a supported single-qubit gate, and false
otherwise.
QuantumACES.is_pauli
— Methodis_pauli(g::Gate)
Returns true
if the gate g
is a Pauli gate, and false
otherwise.
QuantumACES.is_spam
— Methodis_spam(g::Gate)
Returns true
if the gate g
is a state preparation or measurement gate, and false
otherwise.
QuantumACES.is_state_meas
— Methodis_state_meas(g::Gate)
Returns true
if the gate g
is a state measurement gate, and false
otherwise.
QuantumACES.is_state_prep
— Methodis_state_prep(g::Gate)
Returns true
if the gate g
is a state preparation gate, and false
otherwise.
QuantumACES.is_two_qubit
— Methodis_two_qubit(g::Gate; stim_supported::Bool = false)
Returns true
if the gate g
is a supported two-qubit gate, and false
otherwise. If stim_supported
is true
, restrict to those gates also supported by Stim.
QuantumACES.make_layer
— Methodmake_layer(gate_type::String, range::Vector{Int}, n::Integer; index::Integer = 0)
Returns a layer of single-qubit gate_type
gates acting on the qubits in range
, where the layer acts on n
qubits, optionally specifying the gate index index
.
QuantumACES.make_layer
— Methodmake_layer(gate_type::String, range_set::Vector{Vector{Int}}, n::Integer; index::Integer = 0)
Returns a layer of gate_type
gates, each acting on the qubits in range_set
, where the layer acts on n
qubits, optionally specifying the gate index index
.
QuantumACES.make_layer
— Methodmake_layer(gate_types::Vector{String}, ranges::Vector{Vector{Int}}, n::Integer; index::Integer = 0)
Returns a layer of single-qubit gates, with gate types specified by gate_types
and the qubits upon which they act specified by ranges
, where the layer acts on n
qubits, optionally specifying the gate index index
.
QuantumACES.pad_layer
— Methodpad_layer(l::Layer)
Returns a copy of the layer l
padded by single-qubit identity gates that act on each of the qubits not already acted upon by some gate in the layer.
Private functions
QuantumACES.cx!
— Methodcx!(t::Tableau, control::Integer, target::Integer)
Perform a controlled-X gate on the tableau t
with control qubit control
and target qubit target
.
QuantumACES.cz!
— Methodcz!(t::Tableau, control::Integer, target::Integer)
Perform a controlled-Z gate on the tableau t
with control qubit control
and target qubit target
. The gate is symmetric, so the control and target qubits can be swapped.
QuantumACES.hadamard!
— Methodhadamard!(t::Tableau,target::Integer)
Perform a Hadamard gate on the tableau t
with target qubit target
.
QuantumACES.measure!
— Methodmeasure!(t::Tableau, target::Integer)
Measure the tableau t
at the target qubit target
, and return the measurement outcome.
QuantumACES.phase!
— Methodphase!(t::Tableau,target::Integer)
Perform a phase gate on the tableau t
with target qubit target
.
QuantumACES.reset!
— Methodreset!(t::Tableau, target::Integer)
Reset the tableau t
at the target qubit target
by measuring in the computational basis and flipping the phase if the measurement outcome is -1.
QuantumACES.row_phase
— Methodrow_phase(x_1::Bool, z_1::Bool, x_2::Bool, z_2::Bool)
Calculate a phase for row_sum!
.
QuantumACES.row_sum!
— Methodrow_sum!(t::Tableau, target::Integer, control::Integer)
In the tableau t
, add the control row control
to the target row target
, while tracking the phase bit of the target row.
QuantumACES.sqrt_zz!
— Methodsqrt_zz!(t::Tableau, control::Integer, target::Integer)
Perform a π/2 ZZ Pauli rotation gate on the tableau t
with control qubit control
and target qubit target
. The gate is symmetric, so the control and target qubits can be swapped.
QuantumACES.sqrt_zz_dag!
— Methodsqrt_zz_dag!(t::Tableau, control::Integer, target::Integer)
Perform a -π/2 ZZ Pauli rotation gate on the tableau t
with control qubit control
and target qubit target
. The gate is symmetric, so the control and target qubits can be swapped.
QuantumACES.x!
— Methodx!(t::Tableau,target::Integer)
Perform a Pauli X gate on the tableau t
with target qubit target
, noting that $X = H S^2 H$.
QuantumACES.y!
— Methody!(t::Tableau,target::Integer)
Perform a Pauli Z gate on the tableau t
with target qubit target
, noting that $Y = S H S^2 H S^3$.
QuantumACES.z!
— Methodz!(t::Tableau,target::Integer)
Perform a Pauli Z gate on the tableau t
with target qubit target
, noting that $Z = S^2$.