Measurement-Free QEC
This example demonstrates how to use tensor network to simulate a error correction process. We use the $[[7,1,3]]$ steane code and the measurement-free QEC[Heußen] as an example. There are non-clifford gates in the quantum circuit, so we use tensor network to simulate the process.
Measurement-Free Quantum Error Correction
Traditional quantum error correction involves several key procedures. First, the encoding procedure involves mapping the logical quantum information into a larger, redundant quantum state using QEC codes such as the Shor code or the surface code. Usually, those quantum code are defined by stabilizers. Then, the syndrome extraction is the process that we extract the value of the stabilizers into ancilla qubits. And we measure the ancilla qubits to detect the value of stabilizers. After detection, the error syndromes are identified, which indicates the presence and location of errors in the quantum state. Next, the error correction procedure uses quantum gates to apply operations that reverse the effects of errors, effectively restoring the quantum state to its original form.
In the measurement-free QEC protocol, we embed the classical truth table of the error correction into the quantum circuit directly. For example, if we measure the stabilizer 1 and 2 to ancilla qubit 1 and 2, and if they are both in state $|1\rangle$, we know that there is an X error on the first qubit. We can encode this information into the quantum circuit directly by a multi-controlled-X gate.
Since such multi-controlled gate is non-clifford, we can't simulate it with clifford circuit simulator.
Definition of Stabilizers and Encoding Circuits
using TensorQEC, TensorQEC.Yao
using TensorQEC.OMEinsum
st = stabilizers(SteaneCode())
6-element Vector{PauliString{7}}:
XIXIXIX
IXXIIXX
IIIXXXX
ZIZIZIZ
IZZIIZZ
IIIZZZZ
Generate the encoding circuits of the stabilizers by encode_stabilizers
. qcen
is the encoding circuit, data_qubits
are the qubits that we should put initial qubtis in, and code
is the structure records information of the encoding circuit.
qcen, data_qubits, code = encode_stabilizers(st)
vizcircuit(qcen)
Syndrome Extraction and Measurement-Free Error Correction
First, we generate the steane measurement circuit by measure_circuit_steane
and st_pos
records the ancilla qubits that store the measurement results of the stabilizers.
qcm,st_pos, num_qubits = measure_circuit_steane(qcen,data_qubits[1],st,3)
vizcircuit(qcm)
Then we generate truth table for the error correction by make_table
. For more detials on truth table, please check Inference with Truth Table.
table = make_table(st, 1)
┌────────────────────┬────────────────┐
│ Sydrome │ Error │
├────────────────────┼────────────────┤
│ [1, 3] │ 5 => Z │
│ [4, 5, 6] │ 7 => X │
│ [5] │ 2 => X │
│ [4, 5] │ 3 => X │
│ [4] │ 1 => X │
│ [1] │ 1 => Z │
│ [6] │ 4 => X │
│ [2, 3] │ 6 => Z │
│ [1, 3, 4, 6] │ 5 => Z, 5 => X │
│ [3, 6] │ 4 => Z, 4 => X │
│ [1, 4] │ 1 => Z, 1 => X │
│ [1, 2] │ 3 => Z │
│ [1, 2, 3] │ 7 => Z │
│ [4, 6] │ 5 => X │
│ [5, 6] │ 6 => X │
│ [3] │ 4 => Z │
│ ⋮ │ ⋮ │
└────────────────────┴────────────────┘
5 rows omitted
Now we use correct_circuit
to generate the measurement-free correction circuit by encoding the truth table on the quantum circuit directly.
qccr = correct_circuit(table, collect(st_pos), num_qubits)
vizcircuit(qccr)
Circuit Simulation with Tensor Networks
We connect the encoding circuit, the measurement circuit, and the correction circuit to form a full circuit. And we apply a Y error on the third qubit after encoding.
qcf=chain(subroutine(num_qubits, qcen, 1:7),put(27,3=>Y),qcm,qccr,subroutine(num_qubits, qcen', 1:7))
vizcircuit(qcf)
Then we transform the circuit to a tensor network and optimize its contraction order. QCInfo
records the information of the quantum circuit, including the data qubits and the number of qubits. fidelity_tensornetwork
constructs the tensor network to calculate the fidelity after error correction.
tn = fidelity_tensornetwork(qcf, QCInfo(data_qubits, 27))
TensorNetwork
Time complexity: 2^334.0
Space complexity: 2^0.0
Read-write complexity: 2^11.326991174900817
Finally, we optimize the contraction order and contract the tensor network to get the infidelity after error correction.
optnet = optimize_code(tn, TreeSA(; ntrials=1, niters=5), OMEinsum.MergeVectors())
infidelity = 1 - abs(contract(optnet)[1])
1.0
This page was generated using Literate.jl.
- HeußenHeußen, S., Locher, D. F., & Müller, M. (2024). Measurement-Free Fault-Tolerant Quantum Error Correction in Near-Term Devices. PRX Quantum, 5(1), 010333. https://doi.org/10.1103/PRXQuantum.5.010333