# Logical qubit initialization for the surface code

I am reading Fowler et al's paper on the surface code.. I do not understand how to initialize a logical qubit in an arbitrary state with the surface code. I do understand how to initialize the qubit in logical $$|{0}\rangle$$ and $$|{1}\rangle$$, but not how to initialize in an arbitrary superposition.

In Appendix B he shows that after the measurements in the circuit below,

the middle two qubits are in the one of the following four states:

Can they also be in a superposition of one of these states?

For $$|0\rangle$$, $$|1\rangle$$, $$|+\rangle$$, and $$|-\rangle$$ you do transversal initialization (initialize all physical qubits to the desired state, then turn on the stabilizers).

For $$|i\rangle$$ and $$|-i\rangle$$ you do topological initialization using twists.

For $$T|+\rangle$$ states and other states with nice state distillation protocols, you do noisy low code distance initialization followed by distillation at high code distances. Basically, just prepare a physical qubit into the desired state, pretend it's a surface code qubit with code distance one, and increase its code distance while hoping nothing went wrong. Then use a distillation procedure to ensure that nothing went wrong. Read A magic state's fidelity can be superior to the operations that created it and Efficient magic state factories with a catalyzed |CCZ> to 2|T> transformation for the state of the art.

For other single qubit states, you approximate them using a series of operations. Read Efficient synthesis of universal Repeat-Until-Success circuits for the state of the art.

• Hi! Doesn't the $|1\rangle$ and $|-\rangle$ traversal initialization depend on the surface code distance? If it is even sized toric square, then one row must be initialized in a different (either $|0\rangle$ or $|+\rangle$) state to give the initial value of $L_Z$ or $L_X$ to be $-1$ before the stabilizers are operated on. Else it would initialize in $+1$ logical state for these operators. Commented Jun 2, 2023 at 13:43
• @SiddhantSingh A gate is transversal if it never interacts qubits within a code. Applying Pauli gates along a line doesn't interact qubits within the code. So although it's not literally broadcasting one gate over the code, I would still consider applying X gates along a line within a surface code to be transversal. Also, in the specific case of Pauli gates, you don't actually have to do them on the quantum computer, you can track them in the classical control system. So preparing |1> and preparing |0> actually send the same microwave pulses to the quantum computer. Only the tracking changes. Commented Jun 2, 2023 at 17:37

I've not read the cited paper, so I don't know how this corresponds to anything that they say, but one way that I would think about it is, if I have an unknown qubit state stored on a single qubit, how do I copy this onto a surface code already initialised in logical 0?

Now, if it weren't logical qubits, we can easily write down a circuit that would accomplish this (left-hand circuit, which has output $$|0\rangle|\psi\rangle$$). If we express this in terms of Pauli operators (middle circuit), we can replace these with logical operators (right-hand circuit). It is this right-hand circuit that I would implement.

You can initialize a qubit to any arbitrary state by gate $$U3$$ (abbreviation used on IBM Q):

$$U3(\theta,\phi,\lambda)= \begin{pmatrix} \cos(\theta/2) & -\mathrm{e}^{i\lambda} \sin(\theta/2) \\ \mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\lambda+\phi)} \cos(\theta/2) \end{pmatrix}$$

It is also possible to prepare any multi-qubit quantum state by a method described in this paper: Transformation of Quantum States Using Uniformly Controlled Rotations.

In your case, the arbitrary states is probably that generated by Hadamard gate $$H$$.

Regarding measurement in your circuit: If the measurement is done in z-basis, the only four possibilites are those you listed in your question. Yes, qubits can be in superposition but after measurement, they end up in one of four combination of $$|0\rangle$$ and $$|1\rangle$$.