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.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.PZ-
: Prepare the Pauli -Z eigenstate.PX+
: Prepare the Pauli +X eigenstate.PX-
: Prepare the Pauli -X eigenstate.PY+
: Prepare the Pauli +Y 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 to 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.make_layer
— Methodmake_layer(gate_type::String, range::Vector{Int}, n::Int)
Returns a layer of single-qubit gate_type
gates acting on the qubits in range
, where the layer acts on n
qubits.
QuantumACES.make_layer
— Methodmake_layer(gate_type::String, range_set::Vector{Vector{Int}}, n::Int)
Returns a layer of gate_type
gates, each acting on the qubits in range_set
, where the layer acts on n
qubits.
QuantumACES.make_layer
— Methodmake_layer(gate_types::Vector{String}, ranges::Vector{Vector{Int}}, n::Int)
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.
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₁::Bool, z₁::Bool, x₂::Bool, z₂::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$.