This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Quantum Circuits for Stabilizer Error Correcting Codes: A Tutorial

Arijit Mondal and Keshab K. Parhi, Fellow, IEEE
Email: {monda109, parhi}@umn.edu
Department of Electrical and Computer Engineering, University of Minnesota
Abstract

Quantum computers have the potential to provide exponential speedups over their classical counterparts. Quantum principles are being applied to fields such as communications, information processing, and artificial intelligence to achieve quantum advantage. However, quantum bits are extremely noisy and prone to decoherence. Thus, keeping the qubits error free is extremely important toward reliable quantum computing. Quantum error correcting codes have been studied for several decades and methods have been proposed to import classical error correcting codes to the quantum domain. However, circuits for such encoders and decoders haven’t been explored in depth. This paper serves as a tutorial on designing and simulating quantum encoder and decoder circuits for stabilizer codes. We present encoding and decoding circuits for five-qubit code and Steane code, along with verification of these circuits using IBM Qiskit. We also provide nearest neighbour compliant encoder and decoder circuits for the five-qubit code.

Index Terms:
Quantum ECCs, Quantum computation, Hamming code, Steane code, CSS code, Stabilizer codes, Quantum encoders and decoders, Syndrome detection, Nearest neighbor compliant circuits.

I Introduction

Quantum computing is a rapidly-evolving technology which exploits the fundamentals of quantum mechanics towards solving tasks which are too complex for current classical computers. Quantum computers have the potential to achieve exponential speedups over their classical counterparts [1, 2]. In 1981, Feynman suggested that a quantum computer would have the power to simulate systems which are not feasible for classical computers [3, 4]. In 1994, Shor proposed a quantum algorithm to find the prime factors of an integer in polynomial time [5]. Grover proposed an algorithm which was able to search a particular element in an unsorted database with a high probability, with significantly higher efficiency than any known classical algorithm in 1996 [6]. Subsequently, several quantum algorithms aimed at achieving better efficiencies than their classical counterparts were proposed. However, practical realization of these algorithms requires quantum computers, which are slowly evolving. IBM recently demonstrated a 433 qubit quantum computer [7], and expects to deliver a quantum computer having more than a thousand qubits within one year. The path towards a powerful quantum computer which can perform Shor’s factorization or Grover’s search algorithm may not be a distant reality. However, a fundamental issue needs to addressed. As we pack more number of qubits into quantum processors, we need to have a reliable method of processing to mitigate noise and quantum decoherence.

The phenomenon through which quantum mechanical systems attain interference among each other is known as quantum coherence. Quantum coherence is essential to perform quantum computations on quantum information. However, quantum systems are inherently susceptible to noise and decoherence which necessitates building fault tolerant systems which can overcome noise and decoherence. Thus, quantum error correcting codes (ECCs) become a necessity for quantum computing systems. There were various challenges in the way of designing a quantum ECC framework. It is well known that measurement destroys superpositions in any quantum system. Additionally, since the quantum errors are continuous in nature, the design of an ECC for quantum systems was difficult. To make things more complicated, the no-go theorems in the quantum realm make it challenging to design an ECC system analogous to classical domain [8, 9, 10, 11, 12]. Quantum ECCs were believed to be impossible till 1995, when Shor demonstrated a 9-qubit ECC which was capable of correcting a single qubit error for the first time [13]. In 1996, Gottesman proposed a stabilizer framework which was widely used for the construction of quantum ECCs from classical ECCs [14, 15]. Calderbank-Shor-Steane (CSS) codes were proposed independently by Calderbank-Shor [16] and Steane [17]. These codes were used to derive quantum codes from binary classical linear codes which satisfy a dual-containing criterion. The necessary and sufficient conditions for a quantum ECC to be able to recover from a set of errors were given in [18]. Topological quantum codes like toric code were constructed for applications on quantum circuits arranged in a torus [19]. Subsequently, surface codes were introduced using stabilizer formalism in [20].

Pre-shared entangled qubits were proposed toward constructing stabilizer codes over non-Abelian groups in [21]. This is done by extending the non-Abelian group into an Abelian group by using extended operators which commute with each other. These entanglement-assisted (EA) stabilizer codes contain qubits over the extended operators which are assumed to be at the receiver end throughout, and entangled with the transmitted set of qubits. It was later shown that EA stabilizer codes increase the error correcting capability of quantum ECCs [22]. The advantage of the stabilizer framework lies in its ability to construct quantum ECCs from any classical binary ECC. The optimal number of pre-shared entangled qubits required for an EA stabilizer code was expressed analytically, along with an encoding procedure in [23]. Quantum analog of classical low-density parity-check (LDPC) codes were constructed using quasi-cyclic binary LDPC codes in [24]. Algebraic codes like Reed Solomon (RS) codes were also explored in the quantum domain by the authors in [25], [26], and [27] using self-orthogonal classical RS codes. Purely quantum polar codes based on recursive channel combining and splitting construction were studied in [28]. EA stabilizer codes were extended to qudit systems in [29]. Recently, a universal decoding scheme was conceived for quantum stabilizer codes (QSCs) by adapting ’guessing random additive noise decoding’ (GRAND) philosophy from classical domain codes [30]. However, it becomes necessary to design actual encoder and decoder circuits for these quantum ECCs, so that reliable quantum computing systems can be built. The CSS framework is particularly interesting due to its simplicity. It provides a method for importing any classical ECC into the quantum domain, as long as the dual-containing criterion is satisfied. A chronological list of some of the primary advances in quantum ECCs is shown in Fig. 1.

Refer to caption
Figure 1: Chronological list of some of the primary advances in quantum ECC.

The contributions of this paper are as follows. First, we revisit the systematic method for construction of encoder and decoder circuits for stabilizer codes. We identify and analyze the key concepts for the construction of an encoder for stabilizer codes, demonstrated in [15] through a five-qubit code [31, 32]. The concepts are then used to formulate an algorithm for the construction of an encoder circuit for a general stabilizer code. For the decoder design, we use a syndrome measurement circuit, and depending on the measured syndromes, we may apply the appropriate error correction using suitable Pauli gates. Second, we present encoder and decoder circuits for two stabilizer codes: the five-qubit code and the Steane code. Third, we provide nearest neighbour compliant (NNC) circuits for the encoding and syndrome measurement of five-qubit code [38]. Fourth, we present simulation results using IBM Qiskit [34] and verify the circuits.

The rest of the paper is organized as follows. Section II presents a brief description of quantum gates and quantum circuits. Section III reviews Shor’s 9-qubit code [13], stabilizer formalism, and CSS codes. In Section IV, we provide a systematic method of construction of the encoder and decoder circuits for a general stabilizer code. Using the above knowledge, we present design of encoding and syndrome measurement circuits for the five-qubit code and Steane code in Sections V and VI, respectively. In Section VII, we provide nearest neighbour compliant circuits for the five-qubit code. We discuss the results and comparisons in Section VIII, followed by conclusions in Section IX.

II Pauli matrices and quantum gates

In two-level quantum systems, the two-dimensional unit of quantum information is called a quantum bit (qubit). The state of a qubit is represented by |ψ=a|0+b|1,|\psi\rangle=a|0\rangle+b|1\rangle, where a,ba,b\in\mathbb{C} and |a|2+|b|2=1|a|^{2}+|b|^{2}=1. |0|0\rangle and |1|1\rangle are basis states of the state space. The evolution of a quantum mechanical system is fully described by a unitary transformation. State |ψ1|\psi_{1}\rangle of a quantum system at time t1t_{1} is related to t2t_{2} by a unitary operator UU that depends only on the time instances t1t_{1} and t2t_{2}, i.e., |ψ2=U|ψ1|\psi_{2}\rangle=U|\psi_{1}\rangle. The unitary operators or matrices which act on the qubit belong to 2×2\mathbb{C}^{2\times 2}. We have a Pauli group which represents the unitary matrices given by

Π={±I2,±iI2,±X,±iX,±Y,±iY,±Z,±iZ}\Pi=\{\pm I_{2},\pm iI_{2},\pm X,\pm iX,\pm Y,\pm iY,\pm Z,\pm iZ\} (1)

where I2=[1001],X=[0110],Y=[0ii0],Z=[1001]I_{2}=\left[\begin{array}[]{cc}1&0\\ 0&1\end{array}\right],\,X=\left[\begin{array}[]{cc}0&1\\ 1&0\end{array}\right],\,Y=\left[\begin{array}[]{cc}0&-i\\ i&0\end{array}\right],\,Z=\left[\begin{array}[]{cc}1&0\\ 0&-1\end{array}\right].

A quantum circuit consists of an initial set of qubits as inputs which evolve through time to a final state, comprising of the outputs of the quantum circuit. Quantum states evolve through unitary operations which are represented by quantum gates. Quantum gates can be single qubit gates which act on a single qubit, or they can be multiple qubit gates which act on multi-qubit states to produce a new multi-qubit state. The single qubit gates include the bit flip gate XX, phase flip gate ZZ, Hadamard gate HH, YY gate, and the phase gate SS. The unitary operations related to the single qubit gates are as follows:

X\displaystyle X =[0110],Z=[1001],H=12[1111],\displaystyle=\left[\begin{array}[]{cc}0&1\\ 1&0\end{array}\right],Z=\left[\begin{array}[]{cc}1&0\\ 0&-1\end{array}\right],H=\frac{1}{\sqrt{2}}\left[\begin{array}[]{cc}1&1\\ 1&-1\end{array}\right], (8)
Y\displaystyle Y =[0ii0],S=[100i]\displaystyle=\left[\begin{array}[]{cc}0&-i\\ i&0\end{array}\right],S=\left[\begin{array}[]{cc}1&0\\ 0&i\end{array}\right] (13)

The multi-qubit gates include controlled-XX (CNOT), controlled-ZZ (CZ), controlled-YY gates, and the CCNOT (Toffoli gate). They act on 2-qubit pr 3-qubit states and are given by the following unitary transformations:

CNOT=[1000010000010010],CZ=[1000010000100001],CNOT=\left[\begin{array}[]{cccc}1&0&0&0\\ 0&1&0&0\\ 0&0&0&1\\ 0&0&1&0\end{array}\right],CZ=\left[\begin{array}[]{cccc}1&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&-1\end{array}\right], (14)
CY=[10000100000i00i0]CY=\left[\begin{array}[]{cccc}1&0&0&0\\ 0&1&0&0\\ 0&0&0&-i\\ 0&0&i&0\end{array}\right] (15)
CCNOT=[1000000001000000001000000001000000001000000001000000000100000010]CCNOT=\left[\begin{array}[]{cccccccc}1&0&0&0&0&0&0&0\\ 0&1&0&0&0&0&0&0\\ 0&0&1&0&0&0&0&0\\ 0&0&0&1&0&0&0&0\\ 0&0&0&0&1&0&0&0\\ 0&0&0&0&0&1&0&0\\ 0&0&0&0&0&0&0&1\\ 0&0&0&0&0&0&1&0\end{array}\right] (16)

Symbolic representations of various 1-qubit, 2-qubit, and 3-qubit gates are shown in Fig. 2.

Refer to caption
Figure 2: Symbolic representations of various 1-qubit and 2-qubit gates.

III Shor’s 9-qubit ECC, stabilizer formalism, and CSS codes

Shor’s 9-qubit code was the first ever quantum ECC capable of correcting a single qubit error [13]. Gottesman proposed a general methodology to construct quantum ECCs [15]. This method is known as the stabilizer construction and the codes thus generated are known as stabilizer codes. Calderbank-Shor [16] and Steane [17] proposed a method to derive quantum codes from binary classical linear codes which satisfy a dual-containing criterion. We will discuss the above in detail in this section.

III-A Shor’s 9-qubit Quantum ECC

Shor’s 9-qubit code consists of a combination of 3-qubit bit flip and 3-qubit phase flip codes. First, we will provide a brief description of the working of these 3-qubit codes. From classical ECCs, we know about repetition codes. For a rate 1/3 repetition code, 0 is transmitted as 000000 and 11 is transmitted as 111111. The redundancies ensure that if a single error has occurred, a majority detector can detect and correct the error. Analogous to repetition code, we have a 3-qubit bit flip code and a 3-qubit phase flip code. However, due to the no-cloning theorem in quantum domain, we cannot create copies of a certain qubit state. Next, we will describe how this limitation is overcome towards the design of the 3-qubit bit flip and phase flip codes.

III-A1 3-qubit bit flip code

We can design a 3-qubit quantum code [35] capable of correcting a single bit flip error as shown in Fig. 3. Two ancilla qubits are initialized to |0|0\rangle analogous to redundant bits in a 3-bit repetition code. A single qubit is thus encoded into a 3-qubit state. The basis states |0|0\rangle and |1|1\rangle are encoded using encoding as shown below:

|0CNOT(3,2)CNOT(3,1)|000,|0\rangle\xrightarrow{CNOT(3,2)CNOT(3,1)}|000\rangle, (17)
|1CNOT(3,2)CNOT(3,1)|111|1\rangle\xrightarrow{CNOT(3,2)CNOT(3,1)}|111\rangle (18)

For an arbitrary normalized state |ϕ=a|0+b|1|\phi\rangle=a|0\rangle+b|1\rangle, where a,ba,b\in\mathbb{C}, the encoding operation results in the state |ψ|\psi\rangle given by

|ψ=a|000+b|111|\psi\rangle=a|000\rangle+b|111\rangle (19)

The notation CNOT(x,y)CNOT(x,y) implies a CNOTCNOT gate acting on qubits indexed xx and yy, with xx as control and yy as target qubit. The qubits are numbered from top to bottom. It should be noted that in CNOT(3,2)CNOT(3,1), the rightmost operation happens first and the leftmost operation is performed last.

Refer to caption
Figure 3: 3-qubit bit flip encoder.

The syndrome computation circuit is shown in Fig. 4. Two ancilla qubits initialized to |0|0\rangle are used to compute the syndrome. We perform the operation CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5) on the state 𝒰|ψ|00\mathcal{U}|\psi\rangle|00\rangle to obtain 𝒰|ψ|s\mathcal{U}|\psi\rangle|s\rangle as shown in Fig. 4. The two qubit syndrome state is given by |s|s\rangle.

Refer to caption
Figure 4: 3-qubit bit flip syndrome computation.

Let’s take an example to demonstrate the syndrome detection. Let the error be 𝒰=I2I2X\mathcal{U}=I_{2}\otimes I_{2}\otimes X, leading to the erroneous state 𝒰|ψ=a|001+b|110\mathcal{U}|\psi\rangle=a|001\rangle+b|110\rangle. Performing the operation CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5) on 𝒰|ψ|00\mathcal{U}|\psi\rangle|00\rangle, we have [29],

(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))\displaystyle(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))
𝒰|ψ|00\displaystyle\mathcal{U}|\psi\rangle|00\rangle
=\displaystyle= (CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))\displaystyle(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))
(a|001+b|110)|00\displaystyle(a|001\rangle+b|110\rangle)|00\rangle
=\displaystyle= (CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))\displaystyle(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))
(a|00100+b|11000)\displaystyle(a|00100\rangle+b|11000\rangle)
=\displaystyle= a|00101+b|11001\displaystyle a|00101\rangle+b|11001\rangle
=\displaystyle= 𝒰|ψ|01\displaystyle\mathcal{U}|\psi\rangle|01\rangle
=\displaystyle= 𝒰|ψ|s\displaystyle\mathcal{U}|\psi\rangle|s\rangle

Thus, the syndrome is |s=|01.|s\rangle=|01\rangle. The syndromes |11,|11\rangle, |10|10\rangle, and |01|01\rangle correspond to errors in the first, second and third qubits respectively. Here, since the syndrome is |01|01\rangle, the third qubit is in error.

III-A2 3-qubit phase flip code

A 3-qubit phase flip code encodes a single qubit into a 3-qubit state as shown in Fig. 5. Basis states |0|0\rangle and |1|1\rangle are encoded as shown below:

|0H3CNOT(3,2)CNOT(3,1)|+++,|0\rangle\xrightarrow{H^{\otimes 3}CNOT(3,2)CNOT(3,1)}|+++\rangle, (20)
|1H3CNOT(3,2)CNOT(3,1)||1\rangle\xrightarrow{H^{\otimes 3}CNOT(3,2)CNOT(3,1)}|---\rangle (21)

where |±=|0±|12|\pm\rangle=\frac{|0\rangle\pm|1\rangle}{\sqrt{2}}. Any arbitrary normalized state |ϕ=a|0+b|1|\phi\rangle=a|0\rangle+b|1\rangle gets encoded to state |ψ|\psi\rangle using the above encoding operation as

|ψ=a|++++b||\psi\rangle=a|+++\rangle+b|---\rangle (22)

The unitary operator H3CNOT(3,2)CNOT(3,1)H^{\otimes 3}CNOT(3,2)CNOT(3,1) is applied to the message state |ϕ|\phi\rangle along with two ancilla bits initially in the state |0|0\rangle to perform the encoding.

Refer to caption
Figure 5: 3-qubit phase flip encoder.

The syndrome detection circuit is shown in Fig. 6. The syndrome is computed by performing the operation (H3I22)(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))(H3I22)(H^{\otimes 3}\otimes I_{2}^{\otimes 2})(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))(H^{\otimes 3}\otimes I_{2}^{\otimes 2}) on the state 𝒰|ψ|00\mathcal{U}|\psi\rangle|00\rangle to obtain 𝒰|ψ|s\mathcal{U}|\psi\rangle|s\rangle, where |s|s\rangle is the two qubit syndrome state.

Refer to caption
Figure 6: 3-qubit phase flip syndrome computation.

We now consider an example to demonstrate the syndrome detection. Let the error be ZI2I2Z\otimes I_{2}\otimes I_{2}. Thus, the erroneous state is U|ψ=a|+++b|+U|\psi\rangle=a|-++\rangle+b|+--\rangle. The first step (H3I22)(H^{\otimes 3}\otimes I_{2}^{\otimes 2}) converts U|ψ|00U|\psi\rangle|00\rangle to U1|ψ|00=a|10000+b|01100U_{1}|\psi\rangle|00\rangle=a|10000\rangle+b|01100\rangle. Next, the operation (CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5)) converts U1|ψ|00U_{1}|\psi\rangle|00\rangle to U2|ψ|sU_{2}|\psi\rangle|s\rangle as follows:

(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))\displaystyle(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))
U1|ψ|00\displaystyle U_{1}|\psi\rangle|00\rangle
=\displaystyle= (CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))\displaystyle(CNOT(1,4)CNOT(2,4)CNOT(1,5)CNOT(3,5))
(a|10000+b|01100)\displaystyle(a|10000\rangle+b|01100\rangle)
=\displaystyle= a|10011+b|01111\displaystyle a|10011\rangle+b|01111\rangle
=\displaystyle= a|100|11+b|011|11\displaystyle a|100\rangle|11\rangle+b|011\rangle|11\rangle
=\displaystyle= (a|100+b|011)|11\displaystyle(a|100\rangle+b|011\rangle)|11\rangle

Next, the operation (H3I22)(H^{\otimes 3}\otimes I_{2}^{\otimes 2}) converts (a|100+b|011)|11(a|100\rangle+b|011\rangle)|11\rangle to (a|+++b|+)|11=U|ψ|11=U|ψ|s(a|-++\rangle+b|+--\rangle)|11\rangle=U|\psi\rangle|11\rangle=U|\psi\rangle|s\rangle. Thus, the syndrome is |s=|11|s\rangle=|11\rangle. The syndromes |11,|11\rangle, |10|10\rangle, and |01|01\rangle correspond to phase errors in the first, second and third qubits respectively. Here, since the syndrome is |11|11\rangle, the first qubit has a phase error.

The 3-qubit bit flip code is good at correcting a single bit flip. However, it cannot correct phase errors. It is in fact more prone to phase flip errors since phase flips in any of the qubits are indistinguishable from each other. Similarly, the 3-qubit phase flip code cannot correct bit flip errors. Hence, it was believed for a long time that a general quantum ECC capable of correcting both type of errors was not feasible, until Shor [13] proposed a 9 qubit code capable of correcting a bit flip and a phase flip simultaneously. We will discuss the encoding and decoding of this 9-qubit code in the following paragraphs.

The encoding circuit for the 9-qubit code is shown in Fig. 7. The encoding process can be broken into the following steps:

Step 1: Phase flip coding: After applying the CNOT gates we have the following state

|ψ1=a|000+b|111|\psi_{1}\rangle=a|000\rangle+b|111\rangle (23)

Next, we have three Hadamard gates resulting in the state

|ψ2\displaystyle|\psi_{2}\rangle =a[(|0+|12)(|0+|12)(|0+|12)]\displaystyle=a\left[\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\right]
+b[(|0|12)(|0|12)(|0|12)]\displaystyle+b\left[\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)\right]

Step 2: Bit flip coding: After adding the ancillas, we have the state

|ψ3=\displaystyle|\psi_{3}\rangle= a22[((|0+|1)|00)((|0+|1)|00)\displaystyle\frac{a}{2\sqrt{2}}[\left((|0\rangle+|1\rangle)|00\rangle\right)\left((|0\rangle+|1\rangle)|00\rangle\right)
((|0+|1)|00)]+b22[((|0|1)|00)\displaystyle\left((|0\rangle+|1\rangle)|00\rangle\right)]+\frac{b}{2\sqrt{2}}[\left((|0\rangle-|1\rangle)|00\rangle\right)
((|0|1)|00)((|0|1)|00)]\displaystyle\left((|0\rangle-|1\rangle)|00\rangle\right)\left((|0\rangle-|1\rangle)|00\rangle\right)]

Next the CNOT gates are applied to achieve the encoded state

|ψt=\displaystyle|\psi_{t}\rangle= a22[(|000+|111)(|000+|111)(|000+|111)]\displaystyle\frac{a}{2\sqrt{2}}\left[\left(|000\rangle+|111\rangle\right)\left(|000\rangle+|111\rangle\right)\left(|000\rangle+|111\rangle\right)\right]
+b22[(|000|111)(|000|111)(|000|111)]\displaystyle+\frac{b}{2\sqrt{2}}\left[\left(|000\rangle-|111\rangle\right)\left(|000\rangle-|111\rangle\right)\left(|000\rangle-|111\rangle\right)\right]
Refer to caption
Figure 7: Encoder for Shor’s 9-qubit code.

The decoding circuit for the 9-qubit code is shown in Fig. 8. Let us assume that there is a bit and a phase flip on the 4th4^{\mathrm{th}} qubit. Thus the combined state of the received qubits can be represented as:

|ψr\displaystyle|\psi_{r}\rangle =a[(|000+|1112)(|100|0112)\displaystyle=a\Bigg{[}\left(\frac{|000\rangle+|111\rangle}{\sqrt{2}}\right)\left(\frac{|100\rangle-|011\rangle}{\sqrt{2}}\right)
(|000+|1112)]+b[(|000|1112)\displaystyle\left(\frac{|000\rangle+|111\rangle}{\sqrt{2}}\right)\Bigg{]}+b\Bigg{[}\left(\frac{|000\rangle-|111\rangle}{\sqrt{2}}\right)
(|100+|0112)(|000|1112)]\displaystyle\left(\frac{|100\rangle+|011\rangle}{\sqrt{2}}\right)\left(\frac{|000\rangle-|111\rangle}{\sqrt{2}}\right)\Bigg{]}

The evolution of states for the decoding can be described in the following steps:

Step 1: After the application of the first two CNOT gates, we have

|ψs1\displaystyle|\psi_{s_{1}}\rangle =a[(|000+|1002)(|111|0112)\displaystyle=a\Bigg{[}\left(\frac{|000\rangle+|100\rangle}{\sqrt{2}}\right)\left(\frac{|111\rangle-|011\rangle}{\sqrt{2}}\right)
(|000+|1002)]+b[(|000|1002)\displaystyle\left(\frac{|000\rangle+|100\rangle}{\sqrt{2}}\right)\Bigg{]}+b\Bigg{[}\left(\frac{|000\rangle-|100\rangle}{\sqrt{2}}\right)
(|111+|0112)(|000|1002)]\displaystyle\left(\frac{|111\rangle+|011\rangle}{\sqrt{2}}\right)\left(\frac{|000\rangle-|100\rangle}{\sqrt{2}}\right)\Bigg{]}

Step 2: Next, the CCNOT (Toffoli) gates are applied resulting in the state

|ψs2=\displaystyle|\psi_{s_{2}}\rangle= a[(|000+|1002)(|011|1112)\displaystyle a\Bigg{[}\left(\frac{|000\rangle+|100\rangle}{\sqrt{2}}\right)\left(\frac{|011\rangle-|111\rangle}{\sqrt{2}}\right)
(|000+|1002)]+b[(|000|1002)\displaystyle\left(\frac{|000\rangle+|100\rangle}{\sqrt{2}}\right)\Bigg{]}+b\Bigg{[}\left(\frac{|000\rangle-|100\rangle}{\sqrt{2}}\right)
(|011+|1112)(|000|1002)]\displaystyle\left(\frac{|011\rangle+|111\rangle}{\sqrt{2}}\right)\left(\frac{|000\rangle-|100\rangle}{\sqrt{2}}\right)\Bigg{]}
=a[((|0+|1)|002)((|0|1)|112)\displaystyle=a\Bigg{[}\left(\frac{(|0\rangle+|1\rangle)|00\rangle}{\sqrt{2}}\right)\left(\frac{(|0\rangle-|1\rangle)|11\rangle}{\sqrt{2}}\right)
((|0+|1)|002)]+b[((|0|1)|002)\displaystyle\left(\frac{(|0\rangle+|1\rangle)|00\rangle}{\sqrt{2}}\right)\Bigg{]}+b\Bigg{[}\left(\frac{(|0\rangle-|1\rangle)|00\rangle}{\sqrt{2}}\right)
((|0+|1)|112)((|0|1)|002)]\displaystyle\left(\frac{(|0\rangle+|1\rangle)|11\rangle}{\sqrt{2}}\right)\left(\frac{(|0\rangle-|1\rangle)|00\rangle}{\sqrt{2}}\right)\Bigg{]}

Step 3: Applying Hadamard gate on 1st1^{\mathrm{st}}, 4th4^{\mathrm{th}}, and 7th7^{\mathrm{th}} qubits, we have

|ψs3=a|01|14|07+b|11|04|17|\psi_{s_{3}}\rangle=a|0\rangle_{1}|1\rangle_{4}|0\rangle_{7}+b|1\rangle_{1}|0\rangle_{4}|1\rangle_{7} (24)

Step 4: Next, applying CNOT gates, we have

|ψs4=a|01|14|07+b|11|14|07|\psi_{s_{4}}\rangle=a|0\rangle_{1}|1\rangle_{4}|0\rangle_{7}+b|1\rangle_{1}|1\rangle_{4}|0\rangle_{7} (25)

Step 5: Finally, applying the CCNOT (Tofolli) gates, the state is

|ψs5=\displaystyle|\psi_{s_{5}}\rangle= |01|14|07+b|11|14|07\displaystyle|0\rangle_{1}|1\rangle_{4}|0\rangle_{7}+b|1\rangle_{1}|1\rangle_{4}|0\rangle_{7}
=\displaystyle= (a|0+b|1)|1|0\displaystyle(a|0\rangle+b|1\rangle)|1\rangle|0\rangle

As we can see, the first qubit is restored to the a|0+b|1a|0\rangle+b|1\rangle state. This is true independent of the index of the qubit on which the error has occurred.

Refer to caption
Figure 8: Decoder for Shor’s 9-qubit code.

III-B Shor’s 9-qubit code in stabilizer framework

Now, we analyze the 9-qubit code and try to reason why it works, and then we generalize it toward a systematic method of error correction using the idea used in the 9-qubit code. From Fig. 8, we observe that for detecting bit flips in each group of three, we compare the first and third qubit, followed by the first two qubits. A correctly encoded state has the property that the first two qubits have even parity. Equivalently, a codeword is a +1+1 eigen vector of ZZIZZI, and a state with an error on first or second qubit is a 1-1 eigenvector of ZZIZZI. Similarly, first and third qubit should have even parity. Thus a codeword is also +1+1 eigenvector of ZIZZIZ.

For detecting phase errors, we compare the signs of first and second blocks of three, and the signs of first and third blocks of three. Thus, a correctly encoded codeword is a +1+1 eigenvector of XXXXXXIIIXXXXXXIII and XXXIIIXXXXXXIIIXXX. Thus, to correct the code, we need to measure the eigenvalues of the eight operators as shown in the following table.

M1M_{1} ZZ ZZ II II II II II II II
M2M_{2} ZZ II ZZ II II II II II II
M3M_{3} II II II ZZ ZZ II II II II
M4M_{4} II II II ZZ II ZZ II II II
M5M_{5} II II II II II II ZZ ZZ II
M6M_{6} II II II II II II ZZ II ZZ
M7M_{7} XX XX XX XX XX XX II II II
M8M_{8} XX XX XX II II II XX XX XX

The two valid codewords in Shor’s code are eigenvectors of all these operators M1M_{1} through M8M_{8} with eigenvalues +1+1. These generate a group, the stabilizer of the code, which consists of all Pauli operators MM with the property that M|ψ=|ψM|\psi\rangle=|\psi\rangle for all encoded states |ψ|\psi\rangle.

III-C Binary vector space representation for stabilizers

The stabilizers can be written as binary vector spaces, which can be useful to bring connections with classical error correction theory [15]. For this, the stabilizers are written as a pair of (nk)×n(n-k)\times n matrices. The rows correspond to the stabilizers and the columns correspond to the qubits. The first matrix has a 11 wherever there is a XX or YY in the corresponding stabilizer, and 0 everywhere else. The second matrix has a 11 wherever there is a ZZ or YY in the corresponding stabilizer and 0 everywhere else. It is often more convenient to write the two matrices as a single (nk)×2n(n-k)\times 2n matrix with a vertical line separating the two.

III-D Stabilizer formalism

An [[n,k]][[n,k]] quantum code can be used for quantum error correction, where kk logical qubits are encoded using nn physical qubits, leading to a code rate of k/nk/n analogous to classical error correction. It has 2k2^{k} basis codewords, and any linear combination of the basis codewords are also valid codewords. Let the space of valid codewords be denoted by TT. If we consider the tensor product of Pauli operators (with possible overall factors of ±1\pm 1 or ±i\pm i) in equation 1, it forms a group GG under multiplication. The stabilizer SS is an Abelian subgroup of GG, such that the code space TT is the space of vectors fixed by SS [14, 15]. Stabilizer generators are a set of independent set of nkn-k elements from the stabilizer group, in the sense that none of them is a product of any two other generators.

We know that the operators in the Pauli group act on single qubit states which are represented by 22-bit vectors. The operators in Π\Pi have eigen values ±1\pm 1, and either commute or anti-commute with other elements in the group. The set Πn\Pi^{n} is given by the nn-fold tensor products of elements from the Pauli group Π\Pi as shown below,

Πn=\displaystyle\Pi^{n}= {eiϕA1A2An\displaystyle\{e^{i\phi}A_{1}\otimes A_{2}\otimes\cdots\otimes A_{n}
:j{1,2,,n}AjΠ,ϕ{0,π/2,π,3π/2}}\displaystyle:\forall j\in\{1,2,\cdots,n\}A_{j}\in\Pi,\phi\in\{0,\pi/2,\pi,3\pi/2\}\} (26)

The stabilizers form a group with elements MM such that M|ψ=|ψM|\psi\rangle=|\psi\rangle. The stabilizer is Abelian, i.e., every pair of elements in the stabilizer group commute. This can be verified from the following observation. If M|ψ=|ψM|\psi\rangle=|\psi\rangle and N|ψ=|ψN|\psi\rangle=|\psi\rangle, then MN|ψNM|ψ=(MNNM)|ψ=0MN|\psi\rangle-NM|\psi\rangle=(MN-NM)|\psi\rangle=0. Thus, MNNM=0MN-NM=0 or MN=NMMN=NM, showing that every pair of elements in the stabilizer group commute.

Given an Abelian subgroup SS of nn-fold Pauli operators, the code space is defined as

T(S)={|ψ,s.t.M|ψ=|ψ,MS}T(S)=\{|\psi\rangle,s.t.\,M|\psi\rangle=|\psi\rangle,\forall M\in S\} (27)

Suppose MSM\in S and Pauli operator EE anti-commutes with MM. Then, M(E|ψ)=EM|ψ=E|ψM(E|\psi\rangle)=-EM|\psi\rangle=-E|\psi\rangle. Thus, E|ψE|\psi\rangle has eigenvalue 1-1 for MM. Conversely, if Pauli operator EE commutes with MM, M(E|ψ)=EM|ψ=E|ψM(E|\psi\rangle)=EM|\psi\rangle=E|\psi\rangle, thus E|ψE|\psi\rangle has eigenvalue +1+1 for MM. Thus, eigenvalue of an operator MM from a stabilizer group detects errors which anti-commute with MM.

Single qubit operators XX, YY, and ZZ commute with themselves while they anti-commute with each other. For two multiple qubit operators, we need to evaluate how many anti-commutations happen. If the number is odd, the operators anti-commute; else, they commute.

Examples:

  • XX commutes with XX, and anti-commutes with YY and ZZ.

  • XXZX\otimes X\otimes Z commutes with XYXX\otimes Y\otimes X since there are two anti-commuting qubit positions, 2 and 3.

  • YZXY\otimes Z\otimes X anti-commutes with YXXY\otimes X\otimes X , since there is a single anti-commutation at position 2.

III-E CSS framework

The CSS framework [16, 17] is a method to construct quantum ECCs from their classical counterparts. Given two classical codes C1[n,k1,d1]C_{1}[n,k_{1},d_{1}] and C2[n,k2,d2]C_{2}[n,k_{2},d_{2}] which satisfy the dual containing criterion C1C2C_{1}^{\perp}\subset C_{2}, CSS framework can be used to construct quantum codes from such codes.

The CSS codes form a class of stabilizer codes. From the classical theory of error correction, let H1H_{1} and H2H_{2} be the check matrices of the codes C1C_{1} and C2C_{2}. Since C1C2C_{1}^{\perp}\subset C_{2}, codewords of C2C_{2} are basically the elements of C1C_{1}^{\perp}. Hence, we have, H2H1T=0H_{2}H_{1}^{T}=0. The check matrix of a CSS code is given by:

HC1C2=[H10|0H2]H_{C_{1}C_{2}}=\left[\begin{array}[]{ccc}\begin{array}[]{c}H_{1}\\ 0\end{array}&\Bigg{|}&\begin{array}[]{c}0\\ H_{2}\end{array}\end{array}\right] (28)

IV Systematic procedure for encoder design for a stabilizer code

A systematic method for the design of an encoder for a stabilizer code was presented in [15]. The encoder circuit for the five-qubit code proposed in [15] had a few errors which were later addressed in an errata [36]. Taking those into consideration and making slight modifications, the complete procedure for the design of an encoder circuit for a stabilizer code can be summarized as follows:

Step 1: The stabilizers are written in a matrix form using binary vector space formalism as mentioned in Section III-C. Let the parity check matrix thus obtained be HqH_{q}.

Step 2: Our aim is to bring HqH_{q} to the standard form HsH_{s} below:

Hs=[I1A1A2000|BC1C2DI2E]H_{s}=\left[\begin{array}[]{ccc}\begin{array}[]{ccc}I_{1}&A_{1}&A_{2}\\ 0&0&0\end{array}&\Bigg{|}&\begin{array}[]{ccc}B&C_{1}&C_{2}\\ D&I_{2}&E\end{array}\end{array}\right] (29)

where, I1I_{1} and BB are r×rr\times r matrices. ‘rr’ is the rank of the XX portion of HsH_{s}. A1A_{1} and C1C_{1} are r×(nkr)r\times(n-k-r) matrices. A2A_{2} and C2C_{2} are r×kr\times k matrices. DD is a (nkr)×r(n-k-r)\times r matrix. I2I_{2} is a (nkr)×(nkr)(n-k-r)\times(n-k-r) matrix. EE is a (nkr)×k(n-k-r)\times k matrix. I1I_{1} and I2I_{2} are identity matrices.

HqH_{q} is converted to standard form HsH_{s} using Gaussian elimination [15]. The logical operators X¯\overline{X} and Z¯\overline{Z} can be written as

X¯=[0U2U3|V100]\overline{X}=\left[\begin{array}[]{ccc}\begin{array}[]{ccc}0&U_{2}&U_{3}\end{array}&|&\begin{array}[]{ccc}V_{1}&0&0\end{array}\end{array}\right] (30)
Z¯=[000|V10V3]\overline{Z}=\left[\begin{array}[]{ccc}\begin{array}[]{ccc}0&0&0\end{array}&|&\begin{array}[]{ccc}V^{\prime}_{1}&0&V^{\prime}_{3}\end{array}\end{array}\right] (31)

where U2=ETU_{2}=E^{T}, U3=Ik×kU_{3}=I_{k\times k}, V1=ETC1T+C2TV_{1}=E^{T}C_{1}^{T}+C_{2}^{T}, V1=A2TV^{\prime}_{1}=A_{2}^{T}, and V3=Ik×kV^{\prime}_{3}=I_{k\times k}.

Given the parity check matrix in standard form HsH_{s} and X¯\overline{X}, the encoding operation for a stabilizer code can be written as,

|c1c2ck=\displaystyle|c_{1}c_{2}\cdots c_{k}\rangle= X¯1c1X¯2c2X¯kck(MSM)|000\displaystyle\overline{X}_{1}^{c_{1}}\overline{X}_{2}^{c_{2}}\cdots\overline{X}_{k}^{c_{k}}\left(\sum_{M\in S}M\right)|00\cdots 0\rangle (32)
=\displaystyle= X¯1c1X¯2c2X¯kck(I+M1)(I+M2)\displaystyle\overline{X}_{1}^{c_{1}}\overline{X}_{2}^{c_{2}}\cdots\overline{X}_{k}^{c_{k}}(I+M_{1})(I+M_{2})\cdots
(I+Mnk)|000.\displaystyle(I+M_{n-k})|00\cdots 0\rangle. (33)

There are a total of nn qubits. Place qubits initialized to |0|0\rangle at qubit positions i=1i=1 to i=nki=n-k. Place the qubits to be encoded at positions i=nk+1i=n-k+1 to i=ni=n.

We observe the following from HsH_{s} and X¯\overline{X}:

  • We know that a particular logical operator X¯i\overline{X}_{i} is applied only if the qubit at ithi^{\mathrm{th}} position is |1|1\rangle. Thus, applying X¯i\overline{X}_{i} controlled at ithi^{\mathrm{th}} qubit encodes X¯i\overline{X}_{i}.

  • The X¯\overline{X} operators consist of products of only ZZs for the first rr qubits. For the rest of the qubits, X¯\overline{X} consists of products of XX’s only. We know that ZZ acts trivially on |0|0\rangle. Since the first rr qubits are initialized to |0|0\rangle, we can ignore all the ZZs in X¯\overline{X}.

  • The first rr generators in HsH_{s} apply only a single bit flip to the first rr qubits. This implies that when I+MiI+M_{i} is applied, the resulting state would be a sum of |0|0\rangle and |1|1\rangle for the ithi^{\mathrm{th}} qubit. This corresponds to applying HH gates to the first rr qubits, which puts each of the rr qubits in the state 12(|0+|1)\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle).

  • If we apply MiM_{i} conditioned on qubit ii, it implies the application of I+MiI+M_{i}. The reason is as follows. When the control qubit ii is |1|1\rangle, MiM_{i} needs to be applied to the combined qubit state. Since the qubit ii suffers from a bit flip XX only by the stabilizer MiM_{i}, it is already in flipped state when it is |1|1\rangle. Thus, only the rest of the operators in MiM_{i} need to be applied. However, there would be an issue if Hs(i,i+n)H_{s_{(i,i+n)}} is not 0, i.e., there is a YY instead of XX. In that case, adding an SS gate after the HH gate resolves the issue.

Step 3: The observations in Step 2 can be used to devise an algorithm as shown in Algorithm 1 to design the encoding circuit.

Data: HsH_{s}, X¯\overline{X}
Result: Encoding circuit
for i=1i=1 to kk do
       if X¯i,i+nk==1\overline{X}_{i,i+n-k}==1 then
             Place controlled dot at qubit i+nki+n-k 
       end if
      for j=1j=1 to nn do
             if i+nkji+n-k\neq j then
                   if X¯i,j==1\overline{X}_{i,j}==1 then
                         Place XX gate at qubit jj controlled at qubit i+nki+n-k
                   end if
                  
             end if
            
       end for
      
end for
for i=1i=1 to rr do
       if Hs(i,i+n)==0H_{s_{(i,i+n)}}==0 then
             Place HH gate followed by controlled dot at qubit ii 
      else
             Place HH gate followed by SS gate followed by controlled dot at qubit ii 
       end if
      for j=1j=1 to nn do
             if iji\neq j then
                  if Hs(i,j)==1H_{s_{(i,j)}}==1 && Hi,j+n==0H_{i,j+n}==0 then
                         Place XX gate on qubit jj with control at qubit ii 
                   end if
                  if Hs(i,j)==0H_{s_{(i,j)}}==0 && Hi,j+n==1H_{i,j+n}==1 then
                         Place ZZ gate on qubit jj with control at qubit ii 
                   end if
                  if Hs(i,j)==1H_{s_{(i,j)}}==1 && Hi,j+n==1H_{i,j+n}==1 then
                         Place YY gate on qubit jj with control at qubit ii 
                   end if
                  
             end if
            
       end for
      
end for
Algorithm 1 Algorithm to generate encoding circuit from HsH_{s} and X¯\overline{X} (nn = number of physical qubits, kk = number of logical qubits, rr = rank of XX-portion of HsH_{s}).

V 5-qubit perfect code

The five-qubit [31, 32] ECC is the smallest quantum ECC with the ability to correct a single qubit error. It is a cyclic code with a distance of 33. The treatment of the 5-qubit code in the stabilizer formalism was provided in [15]. We will revisit the concept in brief. The stabilizers M1M4M_{1}-M_{4} along with the logical X¯\bar{X} and Z¯\bar{Z} operators for a 5-qubit ECC are given as follows:

M1M_{1} XX ZZ ZZ XX II
M2M_{2} II XX ZZ ZZ XX
M3M_{3} XX II XX ZZ ZZ
M4M_{4} ZZ XX II XX ZZ
X¯\bar{X} XX XX XX XX XX
Z¯\bar{Z} ZZ ZZ ZZ ZZ ZZ

V-A Extended parity-check matrix and encoder design

In [15], the parity check matrix of the five-qubit code using binary formalism was given. Using the binary formalism as described in Section III-C, we can write the extended parity-check matrix as follows:

Hq=[10010010011010001010|01100001100001110001]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{ccccc}1&0&0&1&0\\ 0&1&0&0&1\\ 1&0&1&0&0\\ 0&1&0&1&0\end{array}&\Bigg{|}&\begin{array}[]{ccccc}0&1&1&0&0\\ 0&0&1&1&0\\ 0&0&0&1&1\\ 1&0&0&0&1\end{array}\end{array}\right] (34)

For the encoder design, HqH_{q} is converted to standard form using Gaussian elimination. The standard form was given in [15] directly; however, we describe the steps in detail. Our aim is to bring the above parity check matrix in the standard form through Gaussian elimination as described in Section IV. Applying R3R3+R1R_{3}\rightarrow R_{3}+R_{1} and R4R4+R2R_{4}\rightarrow R_{4}+R_{2}

Hq=[10010010010011000011|01100001100111110111]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{ccccc}1&0&0&1&0\\ 0&1&0&0&1\\ 0&0&1&1&0\\ 0&0&0&1&1\end{array}&\Bigg{|}&\begin{array}[]{ccccc}0&1&1&0&0\\ 0&0&1&1&0\\ 0&1&1&1&1\\ 1&0&1&1&1\end{array}\end{array}\right] (35)

Applying R1R1+R4R_{1}\rightarrow R_{1}+R_{4} and R3R3+R4R_{3}\rightarrow R_{3}+R_{4}, we get the standard form of the parity check matrix as

Hs=[10001010010010100011|11011001101100010111]H_{s}=\left[\begin{array}[]{ccc}\begin{array}[]{ccccc}1&0&0&0&1\\ 0&1&0&0&1\\ 0&0&1&0&1\\ 0&0&0&1&1\end{array}&\Bigg{|}&\begin{array}[]{ccccc}1&1&0&1&1\\ 0&0&1&1&0\\ 1&1&0&0&0\\ 1&0&1&1&1\end{array}\end{array}\right] (36)

We observe that A2=[1111]A_{2}=\left[\begin{array}[]{c}1\\ 1\\ 1\\ 1\end{array}\right], B=[1101001111001011]B=\left[\begin{array}[]{cccc}1&1&0&1\\ 0&0&1&1\\ 1&1&0&0\\ 1&0&1&1\end{array}\right], and C2=[1001]C_{2}=\left[\begin{array}[]{c}1\\ 0\\ 0\\ 1\end{array}\right]

The logical operators can be evaluated using the steps mentioned in Section IV. We get,

X¯=[00001|10010]\overline{X}=\left[\begin{array}[]{ccc}00001&|&10010\end{array}\right] (37)
Z¯=[00000|11111]\overline{Z}=\left[\begin{array}[]{ccc}00000&|&11111\end{array}\right] (38)

From the standard parity-check matrix HsH_{s} and the logical operators X¯\overline{X} and Z¯\overline{Z}, we have,

M1M_{1} YY ZZ II ZZ YY
M2M_{2} II XX ZZ ZZ XX
M3M_{3} ZZ ZZ XX II XX
M4M_{4} ZZ II ZZ YY YY
X¯\bar{X} ZZ II II ZZ XX
Z¯\bar{Z} ZZ ZZ ZZ ZZ ZZ

The basis codewords for this code can be written as

|0¯=MSM|00000|\bar{0}\rangle=\sum_{M\in S}M|00000\rangle (39)
|1¯=X¯|0¯|\bar{1}\rangle=\bar{X}|\bar{0}\rangle (40)

which gives us the encoded |0¯|\bar{0}\rangle as

|0¯\displaystyle|\bar{0}\rangle =|00000+M1|00000+M2|00000+M3|00000\displaystyle=|00000\rangle+M_{1}|00000\rangle+M_{2}|00000\rangle+M_{3}|00000\rangle
+M4|00000+M1M2|00000+M1M3|00000\displaystyle+M_{4}|00000\rangle+M_{1}M_{2}|00000\rangle+M_{1}M_{3}|00000\rangle
+M1M4|00000+M2M3|00000+M2M4|00000\displaystyle+M_{1}M_{4}|00000\rangle+M_{2}M_{3}|00000\rangle+M_{2}M_{4}|00000\rangle
+M3M4|00000+M1M2M3|00000\displaystyle+M_{3}M_{4}|00000\rangle+M_{1}M_{2}M_{3}|00000\rangle
+M1M2M4|00000+M1M3M4|00000\displaystyle+M_{1}M_{2}M_{4}|00000\rangle+M_{1}M_{3}M_{4}|00000\rangle
+M2M3M4|00000+M1M2M3M4|00000\displaystyle+M_{2}M_{3}M_{4}|00000\rangle+M_{1}M_{2}M_{3}M_{4}|00000\rangle
=14(|00000+|10010+|01001+|10100+|01010\displaystyle=\frac{1}{4}(|00000\rangle+|10010\rangle+|01001\rangle+|10100\rangle+|01010\rangle
|11011|00110|11000|11101|00011\displaystyle-|11011\rangle-|00110\rangle-|11000\rangle-|11101\rangle-|00011\rangle
|11110|01111|10001|01100|10111\displaystyle-|11110\rangle-|01111\rangle-|10001\rangle-|01100\rangle-|10111\rangle
+|00101)\displaystyle+|00101\rangle) (41)

and encoded |1¯|\bar{1}\rangle as

|1¯\displaystyle|\bar{1}\rangle =X¯|0¯\displaystyle=\bar{X}|\bar{0}\rangle
=14(|11111|01101|10110|01011|10101\displaystyle=\frac{1}{4}(-|11111\rangle-|01101\rangle-|10110\rangle-|01011\rangle-|10101\rangle
+|00100+|11001+|00111+|00010+|11100\displaystyle+|00100\rangle+|11001\rangle+|00111\rangle+|00010\rangle+|11100\rangle
+|00001+|10000+|01110+|10011+|01000\displaystyle+|00001\rangle+|10000\rangle+|01110\rangle+|10011\rangle+|01000\rangle
|11010)\displaystyle-|11010\rangle) (42)

Following the procedure in IV, we put the input qubit |ψ|\psi\rangle at the 5th5^{\mathrm{th}} spot followed by n1n-1 qubits initialized to |0|0\rangle state. Next, the logical operators are encoded according the Algorithm 1. Thereafter, the stabilizers corresponding to the rows of standard form of the parity check matrix HsH_{s} are applied according the Algorithm 1. The encoder circuit thus designed is shown in Fig. 9.

Refer to caption
Figure 9: Encoder for the five-qubit code.

Next, we observe that there are four ZZ gates which are acting on state |0|0\rangle, making those ZZ gates redundant. After removing those ZZ gates, the modified encoding circuit is shown in Fig. 10.

Refer to caption
Figure 10: Modified encoder for the five-qubit code.

On observing carefully, we notice that this circuit is slightly different from the encoder provided in [15]. In the circuit in [15], there is a subtle error due to which the stabilizers don’t commute. To be specific, the HH gate (or HH followed by SS gate) should appear just before the control dots, else the stabilizer operators don’t commute. Also, the circuit in [15] uses ZZ gates instead of SS after the HH gates when required. However, if one intends to use ZZ gate, one has to use controlled-XX followed by controlled-ZZ instead of controlled-YY gates. These errors were later addressed in an errata [36].

V-B Syndrome measurement circuit and error corrector

The syndrome measurement circuit measures the four stabilizers using four ancilla qubits initialized to the |0|0\rangle state. There are 55 qubits and each qubit can be affected by XX, YY, or ZZ errors. So, 1515 unique error syndromes are possible, which are represented by the final state of the ancilla qubits. The syndromes are shown in Table I.

TABLE I: Syndrome table for the 5-qubit code.
M1M_{1} M2M_{2} M3M_{3} M4M_{4} Decimal value
XX II II II II 0 0 0 11 11
ZZ II II II II 11 0 11 0 1010
YY II II II II 11 0 11 11 1111
II XX II II II 11 0 0 0 88
II ZZ II II II 0 11 0 11 55
II YY II II II 11 11 0 11 1313
II II XX II II 11 11 0 0 1212
II II ZZ II II 0 0 11 0 22
II II YY II II 11 11 11 0 1414
II II II XX II 0 11 11 0 66
II II II ZZ II 11 0 0 11 99
II II II YY II 11 11 11 11 1515
II II II II XX 0 0 11 11 33
II II II II ZZ 0 11 0 0 44
II II II II YY 0 11 11 11 77
II II II II II 0 0 0 0 0

The syndrome measurement circuit is shown in Fig. 11. Depending on the syndrome, appropriate error correction can be performed by using suitable XX, ZZ, or YY gate on the appropriate qubit.

Refer to caption
Figure 11: Syndrome measurement circuit for 5-qubit code.

V-C Evaluation of the output state of the encoder circuit

A good exercise would be to evaluate the output state of the encoder circuit and verify if it matches with |0¯|\overline{0}\rangle and |1¯|\overline{1}\rangle states in equations 41 and 42.

The initial state ψ0\psi_{0} when the fifth qubit is set to |0|0\rangle is ψ0=|00000\psi_{0}=|00000\rangle.

Step A: Applying HH gate on qubit 11 followed by SS, we have

|ψ1=\displaystyle|\psi_{1}\rangle= 12(|00000+i|10000)\displaystyle\frac{1}{\sqrt{2}}(|00000\rangle+i|10000\rangle) (43)

Step B: Applying M1M_{1} controlled at qubit 11 we have,

|ψ2=\displaystyle|\psi_{2}\rangle= 12(|00000+(ii)|10001)\displaystyle\frac{1}{\sqrt{2}}(|00000\rangle+(i\cdot i)|10001\rangle)
=\displaystyle= 12(|00000|10001)\displaystyle\frac{1}{\sqrt{2}}(|00000\rangle-|10001\rangle) (44)

Step C: Applying HH gate on qubit 22, we have

|ψ3=\displaystyle|\psi_{3}\rangle= 12(|00000+|01000|10001|11001)\displaystyle\frac{1}{2}(|00000\rangle+|01000\rangle-|10001\rangle-|11001\rangle) (45)

Step D: Applying M2M_{2} controlled at qubit 22 we have,

|ψ4=\displaystyle|\psi_{4}\rangle= 12(|00000+|01001|10001|11000)\displaystyle\frac{1}{2}(|00000\rangle+|01001\rangle-|10001\rangle-|11000\rangle) (46)

Step E: Applying HH gate on qubit 33, we have

|ψ5=\displaystyle|\psi_{5}\rangle= 122(|00000+|00100+|01001+|01101\displaystyle\frac{1}{2\sqrt{2}}(|00000\rangle+|00100\rangle+|01001\rangle+|01101\rangle
|10001|10101|11000|11100)\displaystyle-|10001\rangle-|10101\rangle-|11000\rangle-|11100\rangle) (47)

Step F: Applying M3M_{3} controlled at qubit 33, we have

|ψ6=\displaystyle|\psi_{6}\rangle= 122(|00000+|00101+|01001|01100\displaystyle\frac{1}{2\sqrt{2}}(|00000\rangle+|00101\rangle+|01001\rangle-|01100\rangle
|10001+|10100|11000|11101)\displaystyle-|10001\rangle+|10100\rangle-|11000\rangle-|11101\rangle) (48)

Step G: Applying HH gate on qubit 44 followed by SS gate, we have

|ψ7\displaystyle|\psi_{7}\rangle =14(|00000+i|00010+|00101+i|00111\displaystyle=\frac{1}{4}(|00000\rangle+i|00010\rangle+|00101\rangle+i|00111\rangle
+|01001+i|01011|01100i|01110\displaystyle+|01001\rangle+i|01011\rangle-|01100\rangle-i|01110\rangle
|10001i|10011+|10100+i|10110\displaystyle-|10001\rangle-i|10011\rangle+|10100\rangle+i|10110\rangle
|11000i|11010|11101i|11111)\displaystyle-|11000\rangle-i|11010\rangle-|11101\rangle-i|11111\rangle) (49)

Step H: Applying M4M_{4} controlled at qubit 44, we have

|ψ8\displaystyle|\psi_{8}\rangle =14(|00000+ii|00011+|00101\displaystyle=\frac{1}{4}(|00000\rangle+i\cdot i|00011\rangle+|00101\rangle
+i(i1)|00110+|01001+i(i)|01010\displaystyle+i(-i\cdot-1)|00110\rangle+|01001\rangle+i(-i)|01010\rangle
|01100i(1i)|01111|10001\displaystyle-|01100\rangle-i(-1\cdot i)|01111\rangle-|10001\rangle
i(1i)|10010+|10100+i(i11)|10111\displaystyle-i(-1\cdot-i)|10010\rangle+|10100\rangle+i(i\cdot-1\cdot-1)|10111\rangle
|11000i(1i)|11011|11101\displaystyle-|11000\rangle-i(-1\cdot i)|11011\rangle-|11101\rangle
i(11i)|11110)\displaystyle-i(-1\cdot-1\cdot-i)|11110\rangle) (50)
=14(|00000|00011+|00101|00110\displaystyle=\frac{1}{4}(|00000\rangle-|00011\rangle+|00101\rangle-|00110\rangle
+|01001+|01010|01100|01111\displaystyle+|01001\rangle+|01010\rangle-|01100\rangle-|01111\rangle
|10001+|10010+|10100|10111\displaystyle-|10001\rangle+|10010\rangle+|10100\rangle-|10111\rangle
|11000|11011|11101|11110)\displaystyle-|11000\rangle-|11011\rangle-|11101\rangle-|11110\rangle)

We observe that |ψ8|\psi_{8}\rangle matches with state |0¯|\overline{0}\rangle in equation 41.

Now, we will verify state |1¯|\overline{1}\rangle. The initial state ψ0\psi_{0} when the fifth qubit is set to |1|1\rangle is ψ0=|00001\psi_{0}=|00001\rangle.

Step A: Applying HH gate on qubit 11 followed by SS, we have

|ψ1=\displaystyle|\psi_{1}\rangle= 12(|00001+i|10001)\displaystyle\frac{1}{\sqrt{2}}(|00001\rangle+i|10001\rangle) (52)

Step B: Applying M1M_{1} controlled at qubit 11 we have,

|ψ2=\displaystyle|\psi_{2}\rangle= 12(|00001+(ii)|10000)\displaystyle\frac{1}{\sqrt{2}}(|00001\rangle+(i\cdot-i)|10000\rangle)
=\displaystyle= 12(|00001+|10000)\displaystyle\frac{1}{\sqrt{2}}(|00001\rangle+|10000\rangle) (53)

Step C: Applying HH gate on qubit 22, we have

|ψ3=\displaystyle|\psi_{3}\rangle= 12(|00001+|01001+|10000+|11000)\displaystyle\frac{1}{2}(|00001\rangle+|01001\rangle+|10000\rangle+|11000\rangle) (54)

Step D: Applying M2M_{2} controlled at qubit 22 we have,

|ψ4=\displaystyle|\psi_{4}\rangle= 12(|00001+|01000+|10000+|11001)\displaystyle\frac{1}{2}(|00001\rangle+|01000\rangle+|10000\rangle+|11001\rangle) (55)

Step E: Applying HH gate on qubit 33, we have

|ψ5=\displaystyle|\psi_{5}\rangle= 122(|00001+|00101+|01000+|01100\displaystyle\frac{1}{2\sqrt{2}}(|00001\rangle+|00101\rangle+|01000\rangle+|01100\rangle
+|10000+|10100+|11001+|11101)\displaystyle+|10000\rangle+|10100\rangle+|11001\rangle+|11101\rangle) (56)

Step F: Applying M3M_{3} controlled at qubit 33, we have

|ψ6=\displaystyle|\psi_{6}\rangle= 122(|00001+|00100+|01000|01101\displaystyle\frac{1}{2\sqrt{2}}(|00001\rangle+|00100\rangle+|01000\rangle-|01101\rangle
+|10000|10101+|11001+|11100)\displaystyle+|10000\rangle-|10101\rangle+|11001\rangle+|11100\rangle) (57)

Step G: Applying HH gate on qubit 44 followed by SS gate, we have

|ψ7\displaystyle|\psi_{7}\rangle =14(|00001+i|00011+|00100+i|00110\displaystyle=\frac{1}{4}(|00001\rangle+i|00011\rangle+|00100\rangle+i|00110\rangle
+|01000+i|01010|01101i|01111\displaystyle+|01000\rangle+i|01010\rangle-|01101\rangle-i|01111\rangle
+|10000+i|10010|10101i|10111\displaystyle+|10000\rangle+i|10010\rangle-|10101\rangle-i|10111\rangle
+|11001+i|11011+|11100+i|11110)\displaystyle+|11001\rangle+i|11011\rangle+|11100\rangle+i|11110\rangle) (58)

Step H: Applying M4M_{4} controlled at qubit 44, we have

|ψ8\displaystyle|\psi_{8}\rangle =14(|00001+i(i)|00010+|00100\displaystyle=\frac{1}{4}(|00001\rangle+i\cdot(-i)|00010\rangle+|00100\rangle
+i(1i)|00111+|01000+i(i)|01011\displaystyle+i(-1\cdot i)|00111\rangle+|01000\rangle+i(i)|01011\rangle
|01101i(1i)|01110+|10000\displaystyle-|01101\rangle-i(-1\cdot-i)|01110\rangle+|10000\rangle
+i(1i)|10011|10101i(11i)|10110\displaystyle+i(-1\cdot i)|10011\rangle-|10101\rangle-i(-1\cdot-1\cdot-i)|10110\rangle
+|11001+i(1i)|11010+|11100\displaystyle+|11001\rangle+i(-1\cdot-i)|11010\rangle+|11100\rangle
+i(11i)|11111)\displaystyle+i(-1\cdot-1\cdot i)|11111\rangle) (59)
=14(|00001+|00010+|00100+|00111\displaystyle=\frac{1}{4}(|00001\rangle+|00010\rangle+|00100\rangle+|00111\rangle
+|01000|01011|01101+|01110\displaystyle+|01000\rangle-|01011\rangle-|01101\rangle+|01110\rangle
+|10000+|10011|10101|10110\displaystyle+|10000\rangle+|10011\rangle-|10101\rangle-|10110\rangle
+|11001|11010+|11100|11111)\displaystyle+|11001\rangle-|11010\rangle+|11100\rangle-|11111\rangle)

We observe that |ψ8|\psi_{8}\rangle matches with state |1¯|\overline{1}\rangle in equation 42.

VI Classical [7,4,3][7,4,3] Hamming code and Steane code

Hamming codes [37] are linear error correcting codes which have the property that they can detect 1- and 2-bit errors, and can correct 1-bit errors. The [7,4,3][7,4,3] Hamming code was introduced by Hamming. It encodes 44 bits of data into 77 bits, such that the 33 parity bits provide the ability to detect and correct single bit errors. The generator matrix GG and the parity check matrix HH of the Hamming code are given as,

G=[1000110010010100100110001111],H\displaystyle G=\left[\begin{array}[]{c}1000110\\ 0100101\\ 0010011\\ 0001111\end{array}\right],H =[110110010110100111001]\displaystyle=\left[\begin{array}[]{c}1101100\\ 1011010\\ 0111001\end{array}\right] (68)

VI-A Steane code as the quantum analog of classical Hamming code

Steane code [33] is a CSS code which uses the Hamming [7,4,3][7,4,3] code and the dual of the Hamming code, i.e., the [7,3,4][7,3,4] code to correct bit flip and phase flip errors respectively. The [7,4,3][7,4,3] Hamming code contains its dual, and thus can be used in the CSS framework to obtain a quantum ECC. One logical qubit is encoded into seven physical qubits, thus enabling the Steane code to detect and correct a single qubit error. In stabilizer framework, the Steane code is represented by six generators as shown below:

M1M_{1} XX XX XX XX II II II
M2M_{2} XX XX II II XX XX II
M3M_{3} XX II XX II XX II XX
M4M_{4} ZZ ZZ ZZ ZZ II II II
M5M_{5} ZZ ZZ II II ZZ ZZ II
M6M_{6} ZZ II ZZ II ZZ II ZZ

.

Each of the above generators is a tensor product of 77 Pauli matrices. It should however be noted that tensor product symbols \otimes are often ommited for brevity. The logical operators are XL=XXXXXXXX_{L}=XXXXXXX and ZL=ZZZZZZZZ_{L}=ZZZZZZZ. Thus, the two codewords for the Steane code are,

|0L\displaystyle|0\rangle_{L} =122(|0000000+|1111000+|1100110+|1010101\displaystyle=\frac{1}{2\sqrt{2}}(|0000000\rangle+|1111000\rangle+|1100110\rangle+|1010101\rangle
+|0011110+|0101101+|0110011+|1001011)\displaystyle+|0011110\rangle+|0101101\rangle+|0110011\rangle+|1001011\rangle) (69)
|1L\displaystyle|1\rangle_{L} =XL|0\displaystyle=X_{L}|0\rangle
=122(|0000111+|1111111+|1100001+|1010010\displaystyle=\frac{1}{2\sqrt{2}}(|0000111\rangle+|1111111\rangle+|1100001\rangle+|1010010\rangle
+|0011001+|0101010+|0110100+|1001100)\displaystyle+|0011001\rangle+|0101010\rangle+|0110100\rangle+|1001100\rangle) (70)

VI-B Encoder designed by converting extended parity check matrix to standard form using Gaussian elimination

We have the parity check matrix and generator matrix for (7,4) Hamming code as follows:

H\displaystyle H =[110110010110100111001],G=[1000110010010100100110001111]\displaystyle=\left[\begin{array}[]{c}1101100\\ 1011010\\ 0111001\end{array}\right],G=\left[\begin{array}[]{c}1000110\\ 0100101\\ 0010011\\ 0001111\end{array}\right] (78)

We can verify that HH is contained in GG. Thus, it satisfies the dual-containing criterion for construction of CSS codes. In the binary formalism, the parity check matrix for the augmented parity check matrix can be written as

Hq=[110110010110100111001000000000000000000000|000000000000000000000110110010110100111011]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1101100\\ 1011010\\ 0111001\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 1101100\\ 1011010\\ 0111011\end{array}\end{array}\right] (79)

Our aim is to transform the above parity check matrix to the standard form as described in Section IV. First, some columns are swapped, which is equivalent to swapping qubit positions. The columns (or equivalently the qubit positions) are swapped in following order 15, 26, 37, 41, 52, 64, 731\leftarrow 5,\,2\leftarrow 6,\,3\leftarrow 7,\,4\leftarrow 1,\,5\leftarrow 2,\,6\leftarrow 4,\,7\leftarrow 3. This gives us the new augmented HH matrix

Hq=[100111001010110010111000000000000000000000|000000000000000000000100111001010110010111]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1001110\\ 0101011\\ 0010111\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 1001110\\ 0101011\\ 0010111\end{array}\end{array}\right] (80)

Performing the operation R5R5+R4R_{5}\rightarrow R_{5}+R_{4}

Hq=[100111001010110010111000000000000000000000|000000000000000000000100111011001010010111]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1001110\\ 0101011\\ 0010111\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 1001110\\ 1100101\\ 0010111\end{array}\end{array}\right] (81)

Performing the operation R6R6+R5R_{6}\rightarrow R_{6}+R_{5}

Hq=[100111001010110010111000000000000000000000|000000000000000000000100111011001011110010]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1001110\\ 0101011\\ 0010111\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 1001110\\ 1100101\\ 1110010\end{array}\end{array}\right] (82)

Performing the operation R4R4+R5R_{4}\rightarrow R_{4}+R_{5}

Hq=[100111001010110010111000000000000000000000|000000000000000000000010101111001011110010]H_{q}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1001110\\ 0101011\\ 0010111\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 0101011\\ 1100101\\ 1110010\end{array}\end{array}\right] (83)

Performing the operation R4R4+R6R_{4}\rightarrow R_{4}+R_{6} we get the standard form HsH_{s} as

Hs=[100111001010110010111000000000000000000000|000000000000000000000101100111001011110010]H_{s}=\left[\begin{array}[]{ccc}\begin{array}[]{c}1001110\\ 0101011\\ 0010111\\ 0000000\\ 0000000\\ 0000000\end{array}&\Bigg{|}&\begin{array}[]{c}0000000\\ 0000000\\ 0000000\\ 1011001\\ 1100101\\ 1110010\end{array}\end{array}\right] (84)

We have the following from HsH_{s}.

I1\displaystyle I_{1} =I2=[100010001],A1=[111101011],\displaystyle=I_{2}=\left[\begin{array}[]{ccc}1&0&0\\ 0&1&0\\ 0&0&1\end{array}\right],A_{1=}\left[\begin{array}[]{ccc}1&1&1\\ 1&0&1\\ 0&1&1\end{array}\right], (91)
A2\displaystyle A_{2} =[011],B=C1=03×3,C2=03×1,\displaystyle=\left[\begin{array}[]{c}0\\ 1\\ 1\end{array}\right],B=C_{1}=0_{3\times 3},C_{2}=0_{3\times 1}, (95)
D\displaystyle D =[101110111],E=[110].\displaystyle=\left[\begin{array}[]{ccc}1&0&1\\ 1&1&0\\ 1&1&1\end{array}\right],E=\left[\begin{array}[]{c}1\\ 1\\ 0\end{array}\right]. (102)

The stabilizers of the code can be written as

M1M_{1} XX II II XX XX XX II
M2M_{2} II XX II XX II XX XX
M3M_{3} II II XX II XX XX XX
M4M_{4} ZZ II II ZZ ZZ ZZ II
M5M_{5} II ZZ II ZZ II ZZ ZZ
M6M_{6} II II ZZ II ZZ ZZ ZZ

The logical operators can be evaluated as described in Section IV, producing

X¯=[0001101|0000000]\overline{X}=\left[\begin{array}[]{ccc}0001101&|&0000000\end{array}\right] (103)
Z¯=[0000000|0110001]\overline{Z}=\left[\begin{array}[]{ccc}0000000&|&0110001\end{array}\right] (104)

The encoding circuit can be generated from X¯\overline{X} and HsH_{s} by applying Algorithm 1. The qubit to be encoded is placed at the 7th7^{\mathrm{th}} position, followed by 66 qubits initialized to |0|0\rangle. First, the X¯|0000000\overline{X}|0000000\rangle state is obtained by applying X¯\overline{X} conditioned on the last qubit. Applying Algorithm 1, the encoder circuit thus obtained is shown in Fig. 12.

Refer to caption
Figure 12: Encoder for the Steane code.

VI-C Syndrome measurement circuit and error corrector

The syndrome measurement circuit measures all the six stabilizers using six ancilla qubits. The syndromes are unique as shown in Table II. Each qubit in the 7-qubit Steane code can be affected by three kind of errors, namely XX, YY, and ZZ errors. So, there are 2121 different types of single qubit errors possible, each of which gives a different syndrome as shown in Table II. The M1M_{1}-M6M_{6} values in the table can be explained by the following example. Let us take the fifth row of the table for example, i.e., IZIIIIIIZIIIII, which implies that a ZZ error has occurred on the second qubit. It is easy to observe that IZIIIIIIZIIIII anti-commutes with M1M_{1} and M2M_{2}, while it commutes with M3,M_{3},M4M_{4}, M5M_{5}, and M6.M_{6}. Thus, we get a syndrome of 110000110000. It can be observed that each syndrome is unique as shown in Table II. Since this code uses only 2121 different syndromes for various single qubit errors, the rest of the syndromes are unused, unlike the 5-qubit perfect code where all the syndromes are used.

TABLE II: Syndrome table for the Steane code.
M1M_{1} M2M_{2} M3M_{3} M4M_{4} M5M_{5} M6M_{6} Decimal value
XX II II II II II II 0 0 0 11 0 0 44
ZZ II II II II II II 11 0 0 0 0 0 3232
YY II II II II II II 11 0 0 11 0 0 3636
II XX II II II II II 0 0 0 0 11 0 22
II ZZ II II II II II 0 11 0 0 0 0 1616
II YY II II II II II 0 11 0 0 11 0 1818
II II XX II II II II 0 0 0 0 0 11 11
II II ZZ II II II II 0 0 11 0 0 0 88
II II YY II II II II 0 0 11 0 0 11 99
II II II XX II II II 0 0 0 11 11 0 66
II II II ZZ II II II 11 11 0 0 0 0 4848
II II II YY II II II 11 11 0 11 11 0 5454
II II II II XX II II 0 0 0 11 0 11 55
II II II II ZZ II II 11 0 11 0 0 0 4040
II II II II YY II II 11 0 11 11 0 11 4545
II II II II II XX II 0 0 0 11 11 11 77
II II II II II ZZ II 11 11 11 0 0 0 5656
II II II II II YY II 11 11 11 11 11 11 6363
II II II II II II XX 0 0 0 0 11 11 33
II II II II II II ZZ 0 11 11 0 0 0 2424
II II II II II II YY 0 11 11 0 11 11 2727
II II II II II II II 0 0 0 0 0 0 0

The syndrome measurement circuit is shown in Fig. 13. Six ancilla qubits are used to measure each of the six stabilizers. Measurement of the ancilla qubits gives the syndrome. Depending on the syndrome, appropriate error correction can be performed by using suitable XX, ZZ, or YY gate on the appropriate qubit. A syndrome measurement of 000000000000 implies that no error has occurred. It should also be noted that any 66 bit syndrome other than the syndromes mentioned in Table II implies the occurrence of more than a single qubit error, which cannot be corrected using the Steane code.

Refer to caption
Figure 13: Syndrome measurement circuit for Steane code.

VII Nearest neighbour compliant circuits for the five-qubit code

In the circuits we discussed in the previous sections, we assume that any particular qubit can interact with any other qubit. This implies that there can be a 2-qubit gate between any two arbitrary qubits. However, it is not possible to do so in real quantum computing systems where qubits can only interact with their nearest neighbours [38]. For example, in a 2-D array of qubits in Fig. 14, the qubits at the corners and edges can interact with 2 or 3 qubits, while the rest of the qubits can interact with their 4 closest neighbors.

Refer to caption
Figure 14: 2-D array of qubits (represented by black dots). The qubits can only interact with their nearest neighbours. The qubits on corners and edges can interact with 2 and 3 qubits respectively. The rest of the qubits can interact with 4 qubits each.

To design a circuit which is nearest neighbour compliant, we need to use swap gates to bring the qubits adjacent to each other [38]. It should be noted that the qubits are not moved physically. Their states are swapped which is equivalent to moving them to adjacent positions without doing it physically. A swap gate requires 3 CNOT gates. Thus, it is important to position the qubits and perform the operations in such a way that the number of swap gates is minimized. A swap gate is shown in Fig. 15.

Refer to caption
Figure 15: Symbol of a swap gate (top). A swap gate circuit implemented using 3 CNOT gates (bottom).

A nearest neighbour compliant circuit for the five-qubit encoder is shown in Fig. 16. The initial qubit position is shown at the top. Three swap gates are required to implement the circuit.

Refer to caption
Figure 16: Nearest neighbour compliant circuit for the five-qubit encoder. The positions of the qubits in a 2-D array is shown at the top. The circuit requires 3 swap gates.

We also designed a nearest neighbour compliant circuit for the syndrome measurement circuit for the five-qubit code as shown in Fig. 17. The initial qubit configuration in the 2-D array is shown at the top. Eight swap gates are required for the circuit, which is equivalent to 24 CNOT gates.

Refer to caption
Figure 17: Nearest neighbour compliant circuit for the five-qubit syndrome measurement circuit. The positions of the qubits in a 2-D array is shown at the top. The circuit requires 8 swap gates.

Similar to the five-qubit code, nearest neighbour compliant circuit can be designed for the Steane code encoder and and syndrome measurement circuit as well. Due to space constraints, this is not addressed in the paper.

VIII Results

The combined encoder and decoder circuits were simulated using IBM Qiskit. Errors were introduced at different positions to test for correctability. Syndromes were found to match with Tables I and II for five-qubit and Steane code, respectively.

Another important parameter to measure the efficiency of the quantum circuits is the number of single and multiple qubit gates used by the quantum circuits. We list the number of gates used in the quantum circuits presented in this paper in Table III.

TABLE III: Resource utilization summary for the various designed quantum circuits in terms of number of gates used.
Parameters Five qubit encoder Five qubit syndrome measurement Steane code encoder Steane code syndrome measurement
H gate 4 8 3 12
S gate 2 0 0 0
Controlled X 2 8 11 12
Controlled Y 2 0 0 0
Controlled Z 4 8 0 12

IX Conclusions

In this paper, we provided a detailed procedure for the construction of encoding and decoding circuits for stabilizer codes. We started with Shor’s 9-qubit code and analyzed the code in stabilizer formalism and then described an algorithm to generate encoding and decoding circuits of a general stabilizer code. We also provided nearest neighbour compliant circuits for the five-qubit code. Future work should be directed towards design of quantum circuits for more complex error correcting codes such as BCH codes, LDPC, and polar codes.

References

  • [1] F. Arute et al., “Quantum supremacy using a programmable superconducting processor,” Nature, 2019.
  • [2] Y. Kim et al., “Evidence for the utility of quantum computing before fault tolerance,” Nature, 2023.
  • [3] R.P. Feynman, “Simulating physics with computers”, Int J Theor Phys, 21, 467-488, 1982.
  • [4] R.P. Feynman, “Quantum mechanical computers,” Found Phys 16, 507-531 (1986).
  • [5] P. Shor, “Algorithms for quantum computation: discrete logarithms and factoring,” 35th Annual Symposium on Foundations of Computer Science, IEEE Comput. Soc. Press, 1994.
  • [6] L. K. Grover, “A fast quantum mechanical algorithm for database search,” in Pro- ceedings of the twenty-eighth annual ACM symposium on Theory of computing - STOC96. ACM Press, 1996.
  • [7] “IBM Unveils 433-Qubit Osprey Chip,” https://spectrum.ieee.org/ibm-quantum-computer-osprey
  • [8] M. A. Nielsen and I. L. Chuang, “Quantum Computation and Quantum Information: 10th Anniversary Edition”, Cambridge University Press, 2011
  • [9] W. K. Wootters and W. H. Zurek, “A single quantum cannot be cloned,” Nature, vol. 299, no. 5886, 1982.
  • [10] D. Dieks, “Communication by EPR devices,” Physics Letters A, vol. 92, no. 6, 1982.
  • [11] A. Kumar Pati and S. L. Braunstein, “Impossibility of deleting an unknown quantum state,” Nature, vol. 404, no. 6774, 2000.
  • [12] H. Barnum, C. M. Caves, C. A. Fuchs, R. Jozsa, and B. Schumacher, “Noncommuting mixed states cannot be broadcast,” Phys. Rev. Lett., vol. 76, 1996.
  • [13] P. W. Shor, “Scheme for reducing decoherence in quantum computer memory,” Phys. Rev. A, vol. 52, pp. R2493-R2496, Oct 1995.
  • [14] D. Gottesman, “Class of quantum error-correcting codes saturating the quantum hamming bound,” Physical Review A, vol. 54, no. 3, pp. 1862-1868, sep 1996.
  • [15] D. Gottesman, “Stabilizer codes and quantum error correction,” Ph.D. dissertation, California Institute of Technology, CA, USA, 1997.
  • [16] A. R. Calderbank and P. W. Shor, “Good quantum error-correcting codes exist," Physical Review A, vol. 54, no. 2, pp. 1098-1105, August 1996.
  • [17] A. M. Steane, “Error correcting codes in quantum theory,” Physical Review Letters, vol. 77, no. 5, pp. 793-797, July 1996.
  • [18] E. Knill and R. Laflamme, “Theory of quantum error-correcting codes,” Phys. Rev. A, vol. 55, pp. 900-911, Feb 1997.
  • [19] A. Kitaev, “Fault-tolerant quantum computation by anyons”, arXiv:quant-ph/9707021, 1997.
  • [20] S. B. Bravyi and A. Y. Kitaev, “Quantum codes on a lattice with boundary,” arXiv:quant-ph/9811052, 1998.
  • [21] T. Brun, I. Devetak, and M.-H. Hsieh, “Correcting quantum errors with entanglement,” Science, vol. 314, no. 5798, pp. 436-439, Oct 2006.
  • [22] C.-Y. Lai and T. A. Brun, “Entanglement increases the error-correcting ability of quantum error-correcting codes,” Physical Review A, vol. 88, no. 1, Jul 2013.
  • [23] M. M. Wilde, “Quantum coding with entanglement,” Ph.D. dissertation, University of Southern California, CA, USA, 2008.
  • [24] M.-H. Hsieh, T. A. Brun, and I. Devetak, “Entanglement-assisted quantum quasicyclic low-density parity-check codes,” Physical Review A, vol. 79, no. 3, Mar 2009.
  • [25] M. Grassl, W. Geiselmann, and T. Beth, “Quantum Reed-Solomon codes,” International Symposium on Applied Algebra, Algebraic Algo-rithms and Error-Correcting Codes, 1999.
  • [26] S. A. Aly, “Asymmetric quantum BCH codes,” International Conference on Computer Engineering Systems, 2008.
  • [27] G. G. La Guardia, “Asymmetric quantum Reed-Solomon and generalized Reed- Solomon codes,” Quantum Information Processing, vol. 11, no. 2, 2012.
  • [28] F. Dupuis, A. Goswami, M. Mhalla and V. Savin, “Purely Quantum Polar Codes,” IEEE Information Theory Workshop (ITW), 2019.
  • [29] P. J. Nadkarni, “Entanglement-assisted Additive Qudit Stabilizer Codes,” Ph.D. dissertation, Indian Institute of Science, India, 2021.
  • [30] D. Chandra et al., “Universal Decoding of Quantum Stabilizer Codes via Classical Guesswork,” IEEE Access, vol. 11, pp. 19059-19072, 2023.
  • [31] C. Bennett, D. DiVincenzo, J. Smolin, and W. Wootters, “Mixed state entanglement and quantum error correction,” Phys. Rev. A 54, 3824 (1996).
  • [32] R. Laflamme, C. Miquel, J. P. Paz, and W. Zurek, “Pefect quantum error correction code,” Phys. Rev. Lett. 77, 198 (1996).
  • [33] A. M. Steane, “Multiple-particle interference and quantum error correction”, Proc. R. Soc. Lond. A., 1996.
  • [34] IBM Quantum, https://quantum-computing.ibm.com/
  • [35] Peres, Asher, “Reversible Logic and Quantum Computers,” Physical Review A., 1985.
  • [36] D. Gottesman, https://thesis.library.caltech.edu/2900/1/Errata.pdf
  • [37] R. W. Hamming, "Error detecting and error correcting codes," The Bell System Technical Journal, vol. 29, no. 2, pp. 147-160, April 1950.
  • [38] J. Ding and S. Yamashita, "Exact Synthesis of Nearest Neighbor Compliant Quantum Circuits in 2-D Architecture and Its Application to Large-Scale Circuits," IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 39, no. 5, pp. 1045-1058, 2020.