# How is a surface code state measured?

What is the exact operation required to measure the logical state of a surface code? Does one need to measure every data qubit, or only some subset of them to perform the measurement?

For simplicity, let us assume my surface code's quiescent state is $$\vert\psi\rangle_L$$ and I wish to measure in the $$Z$$ basis.

When I do this measurement, how is it fault tolerant to errors in the measurement outcome?

It depends on your error model. In the absence of any error, you could only physically measure all the data qubits from the support of one representative of the logical operator (observable) $$Z$$. Your measurement result would be the overall parity of your measures. This is highly optimistic: in such an error model, you wouldn't need a quantum code anyway.

If only physical errors happen at each time step (let's say all data qubits undergo a depolarization channel, but no measurement errors are made), you have to perform a round of stabilizer measurements before physically measuring all the qubit of one representative of the logical operator you are interested in. Thanks to the syndrome you extracted, you can hopefully correct (or at least infer) errors that occured (n.b. an assumption is made here that no depolarization error can happen between the syndrome extraction round and the physical measures. To avoid this assumption, you can physically measure directly all the data qubits instead, see below).

In case your stabilizer measurements are also imperfect (e.g. you are in the phenomenological noise model, i.e. measurement outcomes are sometimes flipped but you do not analyze syndrome extraction in depth), you cannot trust your sole stabilizer measurement round, you have to repeat it several times (usually a number of times of the order of your code distance).

Since you cannot trust the very last round either, you need to perform a physical measurement of all the data qubits in the end (any measurement error here would have the same effect as a physical error and will be decoded as such). The syndrome at this last step has to be reconstructed from the measurement outcomes: an odd parity of measurement outcomes on the support of any stabilizer indicates that this stabilizer is in defect. Once you inferred the errors from this reconstructed syndrome (along with the syndrome from the previous round of stabilizer measurement), you can then deduce you logical measurement outcome as above (parity of outcomes over one representative).

If you explicitly analyze the syndrome extraction circuits (e.g. you are in the circuit-level error model), physical errors can be introduced into the code during stabilizer measurement rounds. A precise scheduling in stabilizer measurements as to be chosen to avoid the so-called hook errors and ensure fault tolerance of your computation. The logical measurement outcome would be deduced as in the previous error model.

• Could you clarify what you mean with "physically measure all the qubits from the support of one representative of the logical operator (observable) 𝑍"? For a 17 qubit surface code (3 x 3 grid of data qubits, 8 ancillas), the logical $Z$ operator is achieved by performing a $Z$ gate on each of 3 data qubits in a vertical column. Do I measure those 3 qubits in the $Z$ basis instead? Commented Apr 8 at 11:08
• By "physical measurement", I mean direct measurement of the data qubits. Ancillas are measured in the stabilizer measurement rounds. The logical $Z$ operator has a lot of representatives, which are all equivalent up to stabilizers (You can choose any vertical line, but other choices are possible). Considering only the 3 qubits of a vertical line for the logical measurement outcome is sufficient, but as stated above you will have to measure all the data qubits to be fault-tolerant despite measurement errors.
– AG47
Commented Apr 8 at 11:30