We present an infinite family of protocols to distill magic states for $T$-gates that has a low space overhead and uses an asymptotic number of input magic states to achieve a given target error that is conjectured to be optimal. The space overhead, defined as the ratio between the physical qubits to the number of output magic states, is asymptotically constant, while both the number of input magic states used per output state and the $T$-gate depth of the circuit scale linearly in the logarithm of the target error $\delta$ (up to $\log \log 1/\delta$). Unlike other distillation protocols, this protocol achieves this performance without concatenation and the input magic states are injected at various steps in the circuit rather than all at the start of the circuit. The protocol can be modified to distill magic states for other gates at the third level of the Clifford hierarchy, with the same asymptotic performance. The protocol relies on the construction of weakly self-dual CSS codes with many logical qubits and large distance, allowing us to implement control-SWAPs on multiple qubits. We call this code the "inner code". The control-SWAPs are then used to measure properties of the magic state and detect errors, using another code that we call the "outer code". Alternatively, we use weakly-self dual CSS codes which implement controlled Hadamards for the inner code, reducing circuit depth. We present several specific small examples of this protocol.
 P. W. Shor, Fault-tolerant quantum computation, in Foundations of Computer Science, 1996. Proceedings., 37th Annual Symposium on (1996) pp. 56-65, quant-ph/9605011.
 D. Aharonov and M. Ben-Or, Fault tolerant quantum computation with constant error, SIAM J. Comput. 38, 1207-1282 (2008), quant-ph/9611025v2.
 E. Knill, R. Laflamme, and W. Zurek, Threshold accuracy for quantum computation, (1996), quant-ph/9610011.
 D. Gottesman, A class of quantum error-correcting codes saturating the quantum hamming bound, Phys. Rev. A 54, 1862 (1996), quant-ph/9604038.
 A. R. Calderbank, E. M. Rains, P. W. Shor, and N. J. A. Sloane, Quantum error correction and orthogonal geometry, Phys. Rev. Lett. 78, 405-408 (1997), quant-ph/9605005.
 N. C. Jones, R. V. Meter, A. G. Fowler, P. L. McMahon, J. Kim, T. D. Ladd, and Y. Yamamoto, Layered architecture for quantum computing, Physical Review X 2, 031007 (2012), 1010.5022.
 J. O'Gorman and E. T. Campbell, Quantum computation with realistic magic state factories, 1605.07197v2.
 E. Knill, Fault-tolerant postselected quantum computation: Schemes, (2004a), quant-ph/0402171v1.
 E. Knill, Fault-tolerant postselected quantum computation: Threshold analysis, (2004b), quant-ph/0404104v1.
 S. Bravyi and A. Kitaev, Universal quantum computation with ideal Clifford gates and noisy ancillas, Phys. Rev. A 71, 022316 (2005), quant-ph/0403025.
 A. M. Meier, B. Eastin, and E. Knill, Magic-state distillation with the four-qubit code, Quant. Inf. Comp. 13, 195 (2013), 1204.4221.
 G. Duclos-Cianci and D. Poulin, Reducing the quantum computing overhead with complex gate distillation, Phys. Rev. A 91, 042315 (2015), 1403.5280v1.
 I. L. Chuang and D. Gottesman, Demonstrating the viability of universal quantum computation using teleportation and single-qubit operations, Nature 402, 390-393 (1999).
 A. J. Landahl and C. Cesare, Complex instruction set computing architecture for performing accurate quantum $Z$ rotations with less magic, (2013), 1302.3240.
 A. Paetznick and B. W. Reichardt, Universal fault-tolerant quantum computation with only transversal gates and error correction, Phys. Rev. Lett. 111, 090505 (2013), 1304.3709.
 T. Jochym-O'Connor and R. Laflamme, Using concatenated quantum codes for universal fault-tolerant quantum gates, Phys. Rev. Lett. 112, 010505 (2014), 1309.3310.
 J. T. Anderson, G. Duclos-Cianci, and D. Poulin, Fault-tolerant conversion between the steane and reed-muller quantum codes, Phys. Rev. Lett. 113, 080501 (2014), 1403.2734.
 H. Bombin, Gauge color codes: Optimal transversal gates and gauge fixing in topological stabilizer codes, New J.Phys. 17, 083002 (2015), 1311.0879v6.
 S. Bravyi and A. Cross, Doubled color codes, 1509.03239v1.
 T. Jochym-O'Connor and S. D. Bartlett, Stacked codes: Universal fault-tolerant quantum computation in a two-dimensional layout, Phys. Rev. A 93, 022323 (2016), 1509.04255.
 T. J. Yoder, R. Takagi, and I. L. Chuang, Universal fault-tolerant gates on concatenated stabilizer codes, Physical Review X 6, 031039 (2016), 1603.03948.
 S. Bravyi and R. König, Classification of topologically protected gates for local stabilizer codes, Phys. Rev. Lett 110, 170503 (2013), 1206.1609.
 E. T. Campbell and J. O'Gorman, An efficient magic state approach to small angle rotations, Quantum Science and Technology 1, 015007 (2016), 1603.04230v2.
 B. W. Reichardt, Improved magic states distillation for quantum universality, Quant. Inf. Proc. 4, 251-264 (2005), quant-ph/0411036v1.
 A. M. Steane, Error correcting codes in quantum theory, Physical Review Letters 77, 793-797 (1996).
 H. Bombin and M. A. Martin-Delgado, Topological quantum distillation, Physical Review Letters 97, 180501 (2006), quant-ph/0605138.
 E. T. Campbell and M. Howard, Unified framework for magic state distillation and multiqubit gate synthesis with reduced resource cost, Phys. Rev. A 95, 022316 (2017), 1606.01904.
 D. Gottesman, Stabilizer codes and quantum error correction, (1997), quant-ph/9705052.
 J. Preskill, Lecture notes on quantum computation, Caltech Ph219.
 M. Sipser and D. A. Spielman, Expander codes, IEEE Transactions on Information Theory 42, 1710-1722 (1996).
 Z. Furedi, F. Lazebnik, A. Seress, V. A. Ustimenko, and A. J. Woldar, Graphs of prescribed girth and bi-degree, Journal of Combinatorial Theory, Series B 64, 228-239 (1995).
 R. Raussendorf, J. Harrington, and K. Goyal, Topological fault-tolerance in cluster state quantum computation, New Journal of Physics 9, 199 (2007), quant-ph/0703143v1.
 A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland, Surface codes: Towards practical large-scale quantum computation, Phys. Rev. A 86, 032324 (2012), 1208.0928.
 M. Grassl and T. Beth, Quantum bch codes, in Proceedings X. International Symposium on Theoretical Electrical Engineering, Magdeburg (1999) pp. 207-212, quant-ph/9910060.
 J. Haah, M. B. Hastings, D. Poulin, and D. Wecker, Magic state distillation at intermediate size, 1709.02789.
 M. B. Hastings, Small majorana fermion codes, 1703.00612.
 E. T. Campbell, H. Anwar, and D. E. Browne, Magic state distillation in all prime dimensions using quantum reed-muller codes, Phys. Rev. X 2, 041021 (2012), 1205.3104.
 G. Nebe, E. M. Rains, and N. J. A. Sloane, The invariants of the clifford groups, Designs, Codes and Cryptography 24, 99-122 (2001), math/0001038.
 G. Nebe, E. M. Rains, and N. J. A. Sloane, Self-Dual Codes and Invariant Theory (Springer-Verlag, 2006).
 E. F. Assmus and J. D. Key, Designs and their Codes, 103 (Cambridge University Press, 1992).
 S. Vijay and L. Fu, Quantum error correction for complex and majorana fermion qubits, 1703.00459.
 S. Lang, Algebra, revised 3rd ed. (Springer, 2002).
 Earl T. Campbell, Mark Howard, "Magic state parity-checker with pre-distilled components", Quantum 2, 56 (2018).
(The above data is from Crossref's cited-by service. Unfortunately not all publishers provide suitable and complete citation data so that some citing works or bibliographic details may be missing.)
This paper is published in Quantum under the Creative Commons Attribution 4.0 International (CC BY 4.0) license. Copyright remains with the original copyright holders such as the authors or their institutions.