The Steane Module

The Steane Module implements Quantum Error Correction and Quantum Fault Tolerance using the Steane 7-qubit code. The 7-qubit code encodes the state \(|\phi\rangle\) as

\[|\tilde{\phi}\rangle = (1+X_0X_4X_5X_6)(1+X_1X_3X_5X_6)(1+X_2X_3X_4X_6)|\phi\rangle.\]
For Syndrome Detection, the Steane code measures 6 operators:
\[M_a = X_0X_4X_5X_6,\]
\[M_b = X_1X_3X_5X_6,\]
\[M_c = X_2X_3X_4X_6,\]
\[N_a = Z_0Z_4Z_5Z_6,\]
\[N_b = Z_1Z_3Z_5Z_6,\]
and
\[N_c = Z_2Z_3Z_4Z_6.\]
More details about each aspect of the Steane code are provided below.

class Steane.SteaneEncoder[source]

Bases: BaseFaultTolerance.Encoder

A class for implementing non-fault tolerant preparation of the Steane \(|0\rangle\) state. As described at the top of this page, the \(|0\rangle\) state is encoded as

\[|\tilde{0}\rangle = (1+X_0X_4X_5X_6)(1+X_1X_3X_5X_6)(1+X_2X_3X_4X_6)|0\rangle.\]
The circuit representation of the initialization process is:

_images/SteaneEncoding.png

Methods

createEncoderCircuit :

Creates a circuit encoding the \(|0\rangle\) state

createEncoderDag :

Creates a DAG encoding the \(|0\rangle\) state

getEncoderCircuit :

Adds gates encoding the \(|0\rangle\) state to a circuit

getEncoderDag :

Adds gates encoding the \(|0\rangle\) state to a DAG

createEncoderCircuit(numQubits)

Creates a circuit encoding the specified number of qubits to the encoded \(|0\rangle\) state.

Parameters
numQubitsint

The number of qubits to initialize to the encoded \(|0\rangle\) state.

createEncoderDag(numQubits)

Creates a DAG encoding the specified number of qubits to the encoded \(|0\rangle\) state.

Parameters
numQubitsint

The number of qubits to initialize to the encoded \(|0\rangle\) state.

getEncoderCircuit(circuit, qregs, cregs=None, ancillas=None)

Encodes the specified Quantum Registers to the encoded \(|0\rangle\) state for the given circuit.

Parameters
dagDAGCircuit

The circuit for which to create the encoding.

qregslist(QuantumRegister)

The Quantum Registers to encode to the \(|0\rangle\).

cregslist(ClassicalRegister), Optional

The Classical Registers used to encode to the \(|0\rangle\), if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to encode to the \(|0\rangle\), if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the ancillas[i] ancilla register.

getEncoderDag(dag, qregs, cregs=None, ancillas=None)

Encodes the specified Quantum Registers to the encoded \(|0\rangle\) state for the given DAG.

Parameters
dagDAGCircuit

The circuit for which to create the encoding.

qregslist(QuantumRegister)

The Quantum Registers to encode to the \(|0\rangle\).

cregslist(ClassicalRegister), Optional

The Classical Registers used to encode to the \(|0\rangle\), if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to encode to the \(|0\rangle\), if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the ancillas[i] ancilla register.

class Steane.SteaneErrorCorrector[source]

Bases: BaseFaultTolerance.ErrorCorrector

A class for implementing non-fault tolerant error correction for the Steane Code. This class combines SteaneSyndromeDetection and SteaneSyndromeCorrection into a single class for ease of use.

Methods

errorCorrectCircuit :

Implements error correction for the given circuit.

errorCorrecDag :

Implements error correction for the given DAG.

errorCorrectCircuit(circuit, qregs, cregs=None, ancillas=None)

Creates gates implementing fault tolerant error correction for the given qubits in the given circuit.

Parameters
circuitQuantumCircuit

The circuit for which to perform error correction.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform error correction.

cregslist(ClassicalRegister)

The Classical Registers used to perform error correction, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome correction process for the qregs[i] quantum register will use the cregs[i] classical register.

errorCorrectDag(dag, qregs, cregs=None, ancillas=None)

Creates gates implementing non-fault tolerant error correction for the given qubits in the given DAG.

Parameters
dagDAGCircuit

The dag for which to perform error correction.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform error correction.

cregslist(ClassicalRegister)

The Classical Registers used to perform error correction, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome correction process for the qregs[i] quantum register will use the cregs[i] classical register.

class Steane.SteaneFaultTolerantEncoder(numRepeats)[source]

Bases: BaseFaultTolerance.FaultTolerantEncoder

A class for implementing fault tolerant ecoding of the Steane encoded \(|0\rangle\) state. NOT FINISHED.

Parameters
numRepeatsint

The number of times to try to create the \(|0\rangle\) state before giving up.

Methods

createEncoderCircuit :

Creates a circuit encoding the \(|0\rangle\) state

createEncoderDag :

Creates a DAG encoding the \(|0\rangle\) state

getEncoderCircuit :

Adds gates encoding the \(|0\rangle\) state to a circuit

getEncoderDag :

Adds gates encoding the \(|0\rangle\) state to a DAG

createEncoderCircuit(numQubits)

Creates a circuit fault-tolerantly encoding the specified number of qubits to the encoded \(|0\rangle\) state.

Parameters
numQubitsint

The number of qubits to initialize to the encoded \(|0\rangle\) state.

createEncoderDag(numQubits)

Creates a DAG fault-tolerantly encoding the specified number of qubits to the encoded \(|0\rangle\) state.

Parameters
numQubitsint

The number of qubits to initialize to the encoded \(|0\rangle\) state.

getEncoderCircuit(circuit, qregs, cregs1=None, ancillas1=None, cregs2=None, ancillas2=None)

Fault-tolerantly encodes the specified Quantum Registers to the encoded \(|0\rangle\) state for the given circuit.

Parameters
dagDAGCircuit

The circuit for which to create the encoding.

qregslist(QuantumRegister)

The Quantum Registers to encode to the \(|0\rangle\).

cregslist(ClassicalRegister), Optional

The Classical Registers used to encode to the \(|0\rangle\), if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to encode to the \(|0\rangle\), if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the ancillas[i] ancilla register.

getEncoderDag(dag, qregs, cregs1=None, ancillas1=None, cregs2=None, ancillas2=None)

Fault-tolerantly encodes the specified Quantum Registers to the encoded \(|0\rangle\) state for the given DAG.

Parameters
dagDAGCircuit

The circuit for which to create the encoding.

qregslist(QuantumRegister)

The Quantum Registers to encode to the \(|0\rangle\).

cregslist(ClassicalRegister), Optional

The Classical Registers used to encode to the \(|0\rangle\), if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to encode to the \(|0\rangle\), if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the encoding process for the qregs[i] quantum register will use the ancillas[i] ancilla register.

class Steane.SteaneFaultTolerantGates[source]

Bases: BaseFaultTolerance.FaultTolerantGates

A class for implementing fault tolerant gates for the Steane Code. The current implemented gates are \(X,\) \(H,\) \(S,\) and CNOT. These gates can all be implemented bitwise. The figures below show the implementations for these four gates.

_images/SteaneX.png

The fault tolerant X gate.

_images/SteaneH.png

The fault tolerant H gate.

_images/SteaneS.png

The fault tolerant S gate.

_images/SteaneCNOT.png

The fault tolerant CNOT gate.

Methods

addGateCircuit :

Adds a fault tolerant gate to the given circuit.

addGateDag :

Adds a fault tolerant gate to the given DAG.

addGateCircuit(circuit, gate, qregs, cregs=None, ancillas=None)

Adds the specified number of fault tolerant implementations of a quantum gate to the given circuit.

Parameters
circuitQuantumCircuit

The circuit on which to perform the fault tolerant gate.

gateGate

The non-fault tolerant gate for which to implement a fault tolerant version.

qregslist(list(QuantumRegister))

The Quantum Registers to on which to perform the fault tolerant gate. Each qregs[i] represents the list of quantum registers which correspond to the ith input to the non-fault tolerant version of the gate in question. Note that each qregs[i] must have the same length.

cregslist(list(ClassicalRegister)), Optional

The Classical Registers used to perform syndrome detection, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs[0]) and the syndrome detection process for the qregs[i][j] quantum register will use the cregs[j] classical register.

ancillaslist(list(AncillaRegister)), list(list(QuantumRegister)), Optional

The Ancilla Registers used to perform syndrome detection,, if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(qregs[0]) and the syndrome detection process for the qregs[i][j] quantum register will use the ancillas[j] ancilla register.

addGateDag(dag, gate, qregs, cregs=None, ancillas=None)

Adds the specified number of fault tolerant implementations of a quantum gate to the given DAG.

Parameters
dagDAGCircuit

The dag on which to perform the fault tolerant gate.

gateGate

The non-fault tolerant gate for which to implement a fault tolerant version.

qregslist(list(QuantumRegister))

The Quantum Registers to on which to perform the fault tolerant gate. Each qregs[i] represents the list of quantum registers which correspond to the ith input to the non-fault tolerant version of the gate in question. Note that each qregs[i] must have the same length.

cregslist(list(ClassicalRegister)), Optional

The Classical Registers used to perform syndrome detection, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs[0]) and the syndrome detection process for the qregs[i][j] quantum register will use the cregs[j] classical register.

ancillaslist(list(AncillaRegister)), list(list(QuantumRegister)), Optional

The Ancilla Registers used to perform syndrome detection,, if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(qregs[0]) and the syndrome detection process for the qregs[i][j] quantum register will use the ancillas[j] ancilla register.

class Steane.SteaneSyndromeCorrector[source]

Bases: BaseFaultTolerance.SyndromeCorrector

A class for implementing fault tolerant syndrome correction for the Steane code. The circuit representation for Syndrome Correction is shown below:

_images/SteaneSyndromeCorrection.png

Methods

syndromeCorrectCircuit :

Implements syndrome correction for the given circuit.

syndromeCorrectDag :

Implements syndrome correction for the given DAG.

syndromeCorrectCircuit(circuit, qregs, cregs)

Creates gates implementing fault tolerant syndrome correction for the given qubits in the given circuit.

Parameters
circuitQuantumCircuit

The circuit for which to perform syndrome correction.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform syndrome correction.

cregslist(ClassicalRegister)

The Classical Registers used to perform syndrome correction, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome correction process for the qregs[i] quantum register will use the cregs[i] classical register.

syndromeCorrectDag(dag, qregs, cregs)

Creates gates implementing fault tolerant syndrome correction for the given qubits in the given DAG.

Parameters
dagDAGCircuit

The dag for which to perform syndrome correction.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform syndrome correction.

cregslist(ClassicalRegister)

The Classical Registers used to perform syndrome correction, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome correction process for the qregs[i] quantum register will use the cregs[i] classical register.

class Steane.SteaneSyndromeDetector[source]

Bases: BaseFaultTolerance.SyndromeDetector

A class for implementing non-fault tolerant syndrome detection for the Steane Code. Syndrome detection works by measuring six stabilizer operators, \(M_a,\) \(M_b,\) \(M_c,\) \(N_a,\) \(N_b,\) and \(N_c,\) defined at the top of this page. The circuit representation of the syndrome detection process is:

_images/SteaneSyndromeDetection.png

Methods

syndromeDetectCircuit :

Implements syndrome detection for the given circuit.

syndromeDetectDag :

Implements syndrome detection for the given DAG.

syndromeDetectCircuit(circuit, qregs, cregs=None, ancillas=None)

Creates gates implementing non-fault tolerant syndrome detection for the given qubits in the given circuit.

Parameters
circuitQuantumCircuit

The circuit for which to perform syndrome detection.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform syndrome detection.

cregslist(ClassicalRegister), Optional

The Classical Registers used to perform syndrome detection, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome detection process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to perform syndrome detection,, if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the syndrome detection process for the qregs[i] quantum register will use the ancillas[i] ancilla register.

syndromeDetectDag(dag, qregs, cregs=None, ancillas=None)

Creates gates implementing non-fault tolerant syndrome detection for the given qubits in the given DAG.

Parameters
dagDAGCircuit

The DAG for which to perform syndrome detection.

qregslist(QuantumRegister)

The Quantum Registers to on which to perform syndrome detection.

cregslist(ClassicalRegister), Optional

The Classical Registers used to perform syndrome detection, if classical registers are needed. If cregs is provided, it must satisfy len(cregs) == len(qregs) and the syndrome detection process for the qregs[i] quantum register will use the cregs[i] classical register.

ancillaslist(AncillaRegister), list(QuantumRegister), Optional

The Ancilla Registers used to perform syndrome detection,, if ancilla registers are needed. If ancillas is provided, it must satisfy len(ancillas) == len(cregs) == len(qregs) and the syndrome detection process for the qregs[i] quantum register will use the ancillas[i] ancilla register.