Qubit code 

Root code for the Qubit Kingdom


Encodes \(K\)-dimensional Hilbert space into a \(2^n\)-dimensional (i.e., \(n\)-qubit) Hilbert space. Usually denoted as \(((n,K))\) or \(((n,K,d))\), where \(d\) is the code's distance.


An \(((n,K,d))\) code corrects erasure errors on up to \(d-1\) qubits. The number of correctable errors is often called the decoding radius, and it is upper bounded by half of the code distance. As a result, qubit codes cannot tolerate adversarial errors on more than \((1-R)/4\) registers, where \(R = \log_2 K/n\) is the code rate.

Pauli-string error basis

A convenient and often considered error set is the Pauli error or Pauli string basis.

Pauli strings: For a single qubit, this set consists of products of powers of the Pauli matrices \begin{align} X=\begin{pmatrix}0 & 1\\ 1 & 0 \end{pmatrix}\,\,\text{ and }\,\,Z=\begin{pmatrix}1 & 0\\ 0 & -1 \end{pmatrix}~. \tag*{(1)}\end{align} For multiple qubits, error set elements are tensor products of elements of the single-qubit error set.

The Pauli error set is a unitary and Hermitian basis for linear operators on the multi-qubit Hilbert space that is orthonormal under the Hilbert-Schmidt inner product; it is a prototypical nice error basis. The distance associated with this set is often the minimum weight of a Pauli string that implements a nontrivial logical operation in the code.

The minimum weight of a Pauli error that has a non-zero expectation value for some code basis state is called the diagonal distance [1]. Codes whose distance is greater than the diagonal distance are degenerate. Degenerate codes admit undetectable Pauli errors (i.e., errors whose projection into the codespace is nonzero) of weight less than the code distance (i.e., the projection satisfies the Knill-Laflamme conditions).

A quantum channel whose Kraus operators are Pauli strings is called a Pauli channel, and such channels are typically more tractable than general, non-Pauli channels. Relevant Pauli channels include dephasing noise and depolarizing noise (a.k.a. Werner-Holevo channel [2]), while relevant non-Pauli channels are amplitude damping, erasure (which maps all qubit states into a third state \(|e\rangle\) outside of the qubit Hilbert space), and biased erasure (in which case only the \(|1\rangle\) qubit state is mapped to \(|e\rangle\)). Noise can be correlated in space or in time, with the latter being an example of a non-Markovian phenomenon [3].

Bounds on code parameters

Bounds on code performance include the quantum Singleton bound [46], quantum Hamming bound [7], and quantum Gilbert-Varshamov bound [7]. Linear programming bounds also exist [8,9].

Quantum weight enumerator: Determining protection and bounds on code parameters can also be done using the code's Shor-Laflamme quantum weight enumerator [10] (cf. weight enumerators) \begin{align} \begin{split} A(x)&=\sum_{j=0}^{n}A_{j}x^{j}\\ A_{j}&=\frac{1}{K^{2}}\sum_{\text{wt-}j\text{ Paulis }P}\left|\text{tr}(P\Pi)\right|^{2}~, \end{split} \tag*{(2)}\end{align} where \(\Pi\) is the code projection, and where the sum is over the Pauli group modulo the subgroup of phases (hence, the dagger below is necessary in case the coset representative is not Hermitian). The dual quantum weight enumerator is \begin{align} \begin{split} B(x)&=\sum_{j=0}^{n}B_{j}x^{j}\\ B_{j}&=\frac{1}{K}\sum_{\text{wt-}j\text{ Paulis }P}\text{tr}(P\Pi P^{\dagger}\Pi)~. \end{split} \tag*{(3)}\end{align} The weight enumerator and its dual satisfy the quantum MacWilliams identity [10]; see [11; Ch. 7]. The distance \(d\) of a code is the smallest \(j=d\) at which \(A_j \neq B_j\) [12]. Such a code is called pure if \(A_j = B_j = 0\) for all \(j < d\); otherwise, the code is called impure. Degeneracy is sufficient but not necessary for impurity [11]. Other types of quantum weight enumerators are the Rains shadow enumerators [8] (see also [13]). There are techniques to compute them for general codes [14]. These notions can be generalized to qudit codes and other error bases [1416].


Exact two-way assisted capacities have been obtained for the erasure and dephasing channels [17].


The normalizer of the Pauli group is the Clifford group; see Ref. [18] for generators, relations, and normal form. Computing using Clifford gates only can be efficiently simulated on a classical computer, according to the Gottesman-Knill theorem [19,20]. Universal quantum computing can be achieved using Clifford gates and a single type of non-Clifford gate, such as the \(T\) gate [21]. More generally, the Solovay-Kitaev theorem [22,23] states that any subset of gates the generates a dense subgroup of the full \(n\)-qubit gate group can be used to construct any gate to arbitrary accuracy (see [24][25; Appx. 3]). Non-Clifford gates are typically more difficult to implement than Clifford gates and so are treated as a resource. Optimizing T-gate count is \(NP\)-hard [26] and can be done using various procedures [2732], e.g., ZX calculus (a.k.a. Penrose spin calculus) [3336] or reinforcement learning [37]. Decompositions in terms of Toffoli and Hadamard gates [38] as well as cosine-sine gates also exist [39].

Clifford hierarchy: The Clifford hierarchy [4042] is a tower of gate sets which includes Pauli and Clifford gates at its first two levels, and non-Clifford gates at higher levels. The \(k\)th level is defined recursively by \begin{align} C_k = \{ U | U P U^{\dagger} \in C_{k-1} \}~, \tag*{(4)}\end{align} where \(P\) is any Pauli matrix, and \(C_1\) is the Pauli group.

Arbitrary \(n\)-qubit circuits can be implemented fault-tolerantly in a 3D architecture using \(O(n^{3/2}\log^3 n)\) qubits, and in a 2D architecture using only \(O(n^2 \log^3 n)\) qubits [43].


Incorporating faulty syndrome measurements can be done using the phenomenological noise model, which simulates errors during syndrome extraction by flipping some of the bits of the measured syndrome bit string. In the more involved circuit-level noise model, every component of the syndrome extraction circuit can be faulty.Hook errors are syndrome measurement circuit faults that cause more than one data-qubit error [44]. Hook errors occur at specific places in a syndrome extraction circuit and can sometimes be removed by re-ordering the gates of the circuit. If not, the use of flag qubits to detect hook errors may be necessary to yield fault-tolerant decoders.The decoder determining the most likely error given a noise channel is called the maximum probability error (MPE) decoder. For few-qubit codes (\(n\) is small), MPE decoding can be based by creating a lookup table. For infinite code families, the size of such a table scales exponentially with \(n\), so approximate decoding algorithms scaling polynomially with \(n\) have to be used.Decoders are characterized by an effective distance or circuit-level distance, the minimum number of faulty operations during syndrome measurement that is required to make an undetectable error. A code is distance-preserving if it admits a decoder whose circuit-level distance is equal to the code distance.

Fault Tolerance

There are lower bounds on the overhead of fault-tolerant QEC in terms of the capacity of the noise channel [45]. A more stringent bound applies to geometrically local QEC due to the fact that locality constrains the growth of the entanglement that is needed for protection [46].Arbitrary \(n\)-qubit circuits can be implemented fault-tolerantly in a 3D architecture using \(O(n^{3/2}\log^3 n)\) qubits, and in a 2D architecture using only \(O(n^2 \log^3 n)\) qubits [43].


Computational threshold: A fault-tolerant computational threshold is the maximum noise rate in a noise model below which any logical computation of size \(M\) can be executed on a physical-qubit architecture to arbitrary accuracy and with an overhead of order \(O(M\text{polylog}M)\). The first methods to achieve a computational threshold use concatenated stabilizer codes [4753]. Such methods require constant-space and polylogarithmic-time overhead, but concatentions using quantum Hamming codes improve this to quasi-polylogarithmic time [54]. Fault-tolerant computations with no notion of locality can be made local on a 2D or 3D geometry with minimial overhead [43].

Measurement threshold: One can derive conditions quantifying how many random single-qubit measurements can be made without destroying the logical information [55]. The measurement threshold is the maximum total probability that a single qubit is measured in a random \(X\), \(Y\), or \(Z\) basis at which the logical information is still recoverable. The measurement threshold is at least as large as the erasure threshold [55; Thm. 4].


There is a relation between one-way entanglement distillation protocols and QECCs [56].See Qiskit QEC framework for realizing protocols on IBM machines.There exists a distance- and rate-dependent lower bound on the degree of entanglement of a qubit code [57; Thm. 3i].


  • Modular-qudit code — Modular-qudit quantum codes for \(q=2\) correspond to qubit codes.
  • Galois-qudit code — Galois-qudit quantum codes for \(q=2\) correspond to qubit codes.
  • Spin code — Spin codes with spin \(\ell=1/2\) correspond to qubit codes.



  • Reed-Muller (RM) code — Optimizing T gates in a qubit circuit that uses CNOT and T gates is equivalent decoding a paricular RM code [29].
  • Qubit c-q code — Qubit c-q codes are qubit codes designed to transmit classical information.
  • EA qubit code — EA qubit codes utilize additional ancillary qubits in a pre-shared entangled state, but reduce to ordinary qubit codes when said qubits are interpreted as noiseless physical qubits.
  • Five-qubit perfect code — Every \(((5,2,3))\) code is single-qubit-Clifford-equivalent to the five-qubit code [58; Corr. 10].
  • Subsystem qubit code — Subsystem qubit codes reduce to (subspace) qubit codes when there is no gauge subsystem.


U. S. Kapshikar, “The Diagonal Distance of CWS Codes”, (2021) arXiv:2107.11286
R. F. Werner and A. S. Holevo, “Counterexample to an additivity conjecture for output purity of quantum channels”, Journal of Mathematical Physics 43, 4353 (2002) arXiv:quant-ph/0203003 DOI
S. Milz and K. Modi, “Quantum Stochastic Processes and Quantum non-Markovian Phenomena”, PRX Quantum 2, (2021) arXiv:2012.01894 DOI
E. Knill, R. Laflamme, and L. Viola, “Theory of Quantum Error Correction for General Noise”, Physical Review Letters 84, 2525 (2000) arXiv:quant-ph/9604034 DOI
N. J. Cerf and R. Cleve, “Information-theoretic interpretation of quantum error-correcting codes”, Physical Review A 56, 1721 (1997) arXiv:quant-ph/9702031 DOI
E. M. Rains, “Nonbinary quantum codes”, (1997) arXiv:quant-ph/9703048
A. Ekert and C. Macchiavello, “Error Correction in Quantum Communication”, (1996) arXiv:quant-ph/9602022
E. M. Rains, “Quantum shadow enumerators”, (1997) arXiv:quant-ph/9611001
A. Ashikhmin and S. Litsyn, “Upper Bounds on the Size of Quantum Codes”, (1997) arXiv:quant-ph/9709049
P. Shor and R. Laflamme, “Quantum MacWilliams Identities”, (1996) arXiv:quant-ph/9610040
D. Gottesman. Surviving as a quantum computer in a classical world (2024) URL
A. Ashikhmin et al., “Quantum Error Detection I: Statement of the Problem”, (1999) arXiv:quant-ph/9906126
A. J. Scott, “Probabilities of Failure for Quantum Error Correction”, Quantum Information Processing 4, 399 (2005) arXiv:quant-ph/0406063 DOI
C. Cao et al., “Quantum Lego Expansion Pack: Enumerators from Tensor Networks”, (2024) arXiv:2308.05152
C. Hu, S. Yang, and S. S.-T. Yau, “Weight enumerators for nonbinary asymmetric quantum codes and their applications”, Advances in Applied Mathematics 121, 102085 (2020) DOI
C. Cao and B. Lackey, “Quantum weight enumerators and tensor networks”, (2023) arXiv:2211.02756
S. Pirandola et al., “Fundamental limits of repeaterless quantum communications”, Nature Communications 8, (2017) arXiv:1510.08863 DOI
P. Selinger, “Generators and relations for n-qubit Clifford operators”, Logical Methods in Computer Science Volume 11, Issue 2, (2015) arXiv:1310.6813 DOI
D. Gottesman, “The Heisenberg Representation of Quantum Computers”, (1998) arXiv:quant-ph/9807006
E. Knill, private communication, ca. 1998.
A. Barenco et al., “Elementary gates for quantum computation”, Physical Review A 52, 3457 (1995) arXiv:quant-ph/9503016 DOI
A. Y. Kitaev, “Quantum computations: algorithms and error correction”, Russian Mathematical Surveys 52, 1191 (1997) DOI
A. Kitaev, A. Shen, and M. Vyalyi, Classical and Quantum Computation (American Mathematical Society, 2002) DOI
C. M. Dawson and M. A. Nielsen, “The Solovay-Kitaev algorithm”, (2005) arXiv:quant-ph/0505030
“The Solovay–Kitaev theorem”, Quantum Computation and Quantum Information 617 (2012) DOI
J. van de Wetering and M. Amy, “Optimising T-count is NP-hard”, (2023) arXiv:2310.05958
M. Amy, D. Maslov, and M. Mosca, “Polynomial-Time T-Depth Optimization of Clifford+T Circuits Via Matroid Partitioning”, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 33, 1476 (2014) arXiv:1303.2042 DOI
D. Gosset et al., “An algorithm for the T-count”, (2013) arXiv:1308.4134
M. Amy and M. Mosca, “T-Count Optimization and Reed–Muller Codes”, IEEE Transactions on Information Theory 65, 4771 (2019) arXiv:1601.07363 DOI
Y. Nam et al., “Automated optimization of large quantum circuits with continuous parameters”, npj Quantum Information 4, (2018) arXiv:1710.07345 DOI
L. Heyfron and E. T. Campbell, “An Efficient Quantum Compiler that reduces \(T\) count”, (2018) arXiv:1712.01557
V. Gheorghiu, M. Mosca, and P. Mukhopadhyay, “T-count and T-depth of any multi-qubit unitary”, npj Quantum Information 8, (2022) arXiv:2110.10292 DOI
A. Kissinger and J. van de Wetering, “Reducing the number of non-Clifford gates in quantum circuits”, Physical Review A 102, (2020) arXiv:1903.10477 DOI
N. de Beaudrap, X. Bian, and Q. Wang, “Techniques to Reduce π/4-Parity-Phase Circuits, Motivated by the ZX Calculus”, Electronic Proceedings in Theoretical Computer Science 318, 131 (2020) arXiv:1911.09039 DOI
N. de Beaudrap, X. Bian, and Q. Wang, “Fast and effective techniques for T-count reduction via spider nest identities”, (2020) arXiv:2004.05164
A. Kissinger and J. van de Wetering, “Simulating quantum circuits with ZX-calculus reduced stabiliser decompositions”, Quantum Science and Technology 7, 044001 (2022) arXiv:2109.01076 DOI
F. J. R. Ruiz et al., “Quantum Circuit Optimization with AlphaTensor”, (2024) arXiv:2402.14396
Y. Shi, “Both Toffoli and Controlled-NOT need little help to do universal quantum computation”, (2002) arXiv:quant-ph/0205115
M. Möttönen et al., “Quantum Circuits for General Multiqubit Gates”, Physical Review Letters 93, (2004) arXiv:quant-ph/0404089 DOI
D. Gottesman and I. L. Chuang, “Demonstrating the viability of universal quantum computation using teleportation and single-qubit operations”, Nature 402, 390 (1999) arXiv:quant-ph/9908010 DOI
S. X. Cui, D. Gottesman, and A. Krishna, “Diagonal gates in the Clifford hierarchy”, Physical Review A 95, (2017) arXiv:1608.06596 DOI
N. Rengaswamy, R. Calderbank, and H. D. Pfister, “Unifying the Clifford hierarchy via symmetric matrices over rings”, Physical Review A 100, (2019) arXiv:1902.04022 DOI
S. H. Choe and R. Koenig, “How to fault-tolerantly realize any quantum circuit with local operations”, (2024) arXiv:2402.13863
E. Dennis et al., “Topological quantum memory”, Journal of Mathematical Physics 43, 4452 (2002) arXiv:quant-ph/0110143 DOI
O. Fawzi, A. Müller-Hermes, and A. Shayeghi, “A Lower Bound on the Space Overhead of Fault-Tolerant Quantum Computation”, (2022) arXiv:2202.00119 DOI
N. Baspin, O. Fawzi, and A. Shayeghi, “A lower bound on the overhead of quantum error correction in low dimensions”, (2023) arXiv:2302.04317
E. Knill, R. Laflamme, and W. H. Zurek, “Resilient quantum computation: error models and thresholds”, Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 454, 365 (1998) arXiv:quant-ph/9702058 DOI
J. Preskill, “Reliable quantum computers”, Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 454, 385 (1998) arXiv:quant-ph/9705031 DOI
D. Gottesman, “Fault-tolerant quantum computation with local gates”, Journal of Modern Optics 47, 333 (2000) arXiv:quant-ph/9903099 DOI
D. Aharonov and M. Ben-Or, “Fault-Tolerant Quantum Computation With Constant Error Rate”, (1999) arXiv:quant-ph/9906129
K. M. Svore, B. M. Terhal, and D. P. DiVincenzo, “Local fault-tolerant quantum computation”, Physical Review A 72, (2005) arXiv:quant-ph/0410047 DOI
P. Aliferis, D. Gottesman, and J. Preskill, “Quantum accuracy threshold for concatenated distance-3 codes”, (2005) arXiv:quant-ph/0504218
K. M. Svore, D. P. DiVincenzo, and B. M. Terhal, “Noise Threshold for a Fault-Tolerant Two-Dimensional Lattice Architecture”, (2006) arXiv:quant-ph/0604090
H. Yamasaki and M. Koashi, “Time-Efficient Constant-Space-Overhead Fault-Tolerant Quantum Computation”, Nature Physics 20, 247 (2024) arXiv:2207.08826 DOI
D. Lee and B. Yoshida, “Randomly Monitored Quantum Codes”, (2024) arXiv:2402.00145
C. H. Bennett et al., “Mixed-state entanglement and quantum error correction”, Physical Review A 54, 3824 (1996) arXiv:quant-ph/9604024 DOI
S. Bravyi et al., “How much entanglement is needed for quantum error correction?”, (2024) arXiv:2405.01332
E. M. Rains, “Quantum codes of minimum distance two”, (1997) arXiv:quant-ph/9704043
Page edit log

Your contribution is welcome!

on github.com (edit & pull request)— see instructions

edit on this site

Zoo Code ID: qubits_into_qubits

Cite as:
“Qubit code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2023. https://errorcorrectionzoo.org/c/qubits_into_qubits
@incollection{eczoo_qubits_into_qubits, title={Qubit code}, booktitle={The Error Correction Zoo}, year={2023}, editor={Albert, Victor V. and Faist, Philippe}, url={https://errorcorrectionzoo.org/c/qubits_into_qubits} }
Share via:
Twitter | Mastodon |  | E-mail
Permanent link:

Cite as:

“Qubit code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2023. https://errorcorrectionzoo.org/c/qubits_into_qubits

Github: https://github.com/errorcorrectionzoo/eczoo_data/edit/main/codes/quantum/qubits/qubits_into_qubits.yml.