# Where do we put error correction code in quantum circuit?

First of all : I am a beginner in quantum computing.

I would like to have a resource (or an answer if it is not complicated) explaining where we put the error correction codes in a quantum circuit.

Indeed, I know we have different possible errors that can occur (bit flip, phase flip etc), and we have algorithm to correct them. But what I would like to know is if there are some strategies to where we put the error correction algorithm. Is it after each gate involved of the main algorithm ? Is there a smarter strategy used to do a single correction for a set of gates ?

If the answer is "complicated" I would like to have a resource to learn all this (I find a lot of things for error correction code, but I haven't found anything about where we must do the correction).

• So your question is about fault tolerant quantum computing right? I mean that you want to know how error correction is used in order to be able to run quantum algorithms such that no errors corrupt the output of such algorithm. – Josu Etxezarreta Martinez Nov 6 '18 at 14:53
• @JosuEtxezarretaMartinez indeed ! – StarBucK Nov 6 '18 at 14:56
• The short answer is: everywhere! – DaftWullie Nov 6 '18 at 17:39

Based on your question I think that you were not looking for the correct term. Error correction codes are methods in order to detect and correct possible errors that arise in qubits due to the effect of decoherence.

The term fault-tolerant quantum computing refers to the paradigm of quantum devices that work effectively even when its elementary components are imperfect, and the error correction codes you have been looking for are the base to construct such kind of computations. I encourage you to look for information related to fault tolerance by yourself as it is quite a big area in quantum computing. However, I strongly recommend you the text Fault-tolerant quantum computation by Preskill. In such paper, the author does indeed start speaking about error correction codes, but afterwards goes deep into the fault tolerant concept, and I think that it will solve much of your doubts about the topic.

In fault-tolerant quantum computing, we make a distinction between physical qubits and logical qubits.

The logical qubits are the ones we use in our algorithm. So if our input is a number stored in binary across $$n$$ qubits (as in Shor's algorithm), then these $$n$$ qubits are logical qubits. When we ask for a quantum Fourier transform on a collection of qubits, then these will also be logical qubits. We expect logical qubits and the operations we do on them to be completely error free, just as we do with the bits and operations in normal computers.

The physical qubits are the ones that actually exist, and they are noisy. These are what we use to make logical qubits, but it typically takes many physical qubits to make one logical qubit. This is because of the large redundancy needed to be able to detect and correct errors.

The design of the actual code run on physical qubits will happen in layers. A quantum error correction software engineer will design the logical qubits by writing the program needed to implement the quantum error correcting code. For each operation that someone might need in an algorithm, they will design an error correction compatible version, which performs the operation on the logical qubits in a way that allows its imperfections to be detected and corrected.

Then the programmer will come along and write their program. They won't need to think about physical qubits or error correction at all.

Finally, the compiler will combine everything to create the fault-tolerant version of the program to run on the physical qubits. This will look nothing like what was written by the programmer. It won't look like a constant alternation of things that the programmer wrote, followed by error correction things to clean it up. It will almost completely deal with just detecting and correcting the errors that constantly occur, with minor perturbations to implement the algorithm.

As a reference, I guess it is best to recommend something that explains how operations on logical qubits are implemented on physical qubits via an error correcting code. One of my own papers does this job, by explaining this for a variety of ways to get logical operations in the surface code. It also has references to many works by others in the same area.