Surface Code Cost Calculator
What is a surface code?
A surface code is a proposed method of quantum error correction. Quantum computations will require high-precision quantum states, and physical qubits are often very noisy. Error correcting codes like the surface code combine many noisy physical qubits into one much cleaner "logical" qubit.
Specifically, the surface code uses a 2-dimensional grid of physical qubits. Half are "measurement" qubits an the other half are "data" qubits, arranged in a checkerboard pattern. In a rapid cycle, the measurement qubits are entangled with the data qubits and then all the measurement qubits are measured. This destroys the quantum state in the measurement qubits, which collapses the errors in the data qubits. If the errors are small enough, this collapse will either correct the errors or force them into specific forms which the measurement qubits can detect. The classical computer that controls the entire circuit can then account for these errors.
To apply T-gates, a surface code needs "magic" states. The surface code can combine many low-precision physical magic states into one high-precision magic state. It can do this distillation process repeatedly for even greater precision. Distillation is one of the most expensive processes.
Surface codes are an elegant solution to high-precision quantum computing, but it comes at a cost. Not only does every logical qubit need many physical qubits, gates and measurements must be performed on every qubit at every step. Every qubit sends data to a classical processor in every cycle, which must compensate for the errors that occur. These costs add up quickly, and my goal with this page is to give a sense of how expensive some of these quantum computations will be.
For particular algorithms, I used the circuits in the papers I referenced. If you have another algorithm or particular circuit you want me to add, send me an e-mail at sam.e.jaques@gmail.com. Almost all of my knowledge of surface codes comes from Fowler, Martioni, Martinis, and Cleland's 2012 paper, from which all of these calculations are based. The code is here.
I should note that these calculations are likely overestimates, due to recent advances in surface code methods and state distillation.