9
$\begingroup$

In a 2D surface code lattice, there are some data qubits and some measurement qubits. Suppose we want to do a 2-qubit computation, for example, let say, an X-gate on qubit-1 followed by a CNOT gate with qubit-1 as the control bit and qubit-2 as the target bit.

Q: How is this computation realized in a quantum computer with a 2D surface code arrangement of qubits? i.e. Which gates are applied and on which qubits?

$\endgroup$
  • $\begingroup$ You might want to clarify whether you mean that all the qubits are in a 2D array, or just that the encoded qubits are in segments which are 2D arrays. $\endgroup$ – Niel de Beaudrap Oct 15 '18 at 20:49
8
$\begingroup$

I will illustrate how one can perform operations using logical operations on the qubits, and using lattice surgery for two-qubit operations.

In the diagrams below, all of the 'dots' are data qubits: measurement qubits are omitted in order to help demonstrate the basic principles more clearly. The measurement qubits are there for when you perform stabiliser measurements, and are only ever involved in stabiliser measurements, so the story is about what you do with the data qubits — including such things as the stabiliser measurements that you perform on the data qubits.

Surface codes and logical single-qubit Pauli operations

One can use fragments of the plane to store qubits. The image below shows four qubits which are encoded as part of a larger lattice: the light dots with black outlines are qubits which are not involved in the encoded qubits, and can in principle be in any state that you like, unentangled from the rest.
$\qquad\qquad\qquad$

In each of these fragments, the qubit is defined by the stabiliser relations which (ideally, in the absence of errors) hold among the qubits. For surface codes with the sorts of boundary conditions illustrated here, these are either 3-qubit X or Z stabilisers around the boundary, and either 4-qubit X or Z stabilisers in the 'bulk' or body of the code. The pattern of these stabilisers is illustrated below. Note that each X stabiliser that overlaps with a Z stabiliser, does so at two qubits, so that they commute with one another. (Apologies for the image size: I cannot manage to get it to display at a reasonable size.)

$\qquad\qquad\qquad$

Note that by using the regularity of these stabilisers, it isn't necessary for the surface code fragment to be square (or even in principle rectangular).* This will become important later.

There are a number of (tensor product) Pauli operations which commute with all of these stabilisers. These may be used to define logical Pauli operators, which describe ways in which you can both access and transform the logical qubits. For instance, a product of Z operators across any row from boundary to boundary will commute with all stabilisers, and can be taken to represent a logical Z operator; a product of X operators across any column from boundary to boundary can similarly be take to represent a logical X operator:

$\qquad$

It doesn't matter which row or which column you use: this follows from the fact that a product of any two rows of Z operators, or of any two columns of X operators, can be generated as a product of stabilisers and therefore realises an identity operation on the encoded qubit (as the stabiliser generators themselves are operators which perform the identity operation on an encoded qubit state, by definition). So: if you want to apply an X operation to an encoded qubit, one way to do so would be to apply such a logical X operation, by realising X operators on each qubit in a column reaching between two boundaries.**

Logical single-qubit Pauli measurements

One advantage of thinking of the encoded qubits in terms of logical operators is that it allows you to also determine how you can perform a 'logical measurement' — that is, a measurement not only of (some of) the qubits in the code, but of the data that they encode. Take the logical X operator above, for example: the operator XX⊗...⊗X is not only unitary, but Hermitian, which means that it is an observable which you can measure. (The same idea is used all the time with the stabilisers of the code, of course, which we measure in order to try to detect errors.) This means that in order to realise a logical X measurement, it is enough to measure the logical X observable. (The same goes for the logical Z observable, if you want to realise a standard basis measurement on your encoded qubit; and everything I say below can also be applied to logical Z measurements with the appropriate modifications.)

Now — measuring the logical X observable is not exactly the same as measuring each of those single-qubit X operators one at a time. The operator XX⊗...⊗X has only two eigenvalues, +1 and −1, so measuring that precise operator can only have two outcomes, whereas measuring each of n qubits will have 2n outcomes. Also, measuring each of those single-qubit X operators will not keep you in the code-space: if you want to do computations on a projected post-measurement state, you would have to do a lot of clean-up work to restore the qubit to a properly encoded state.

However: if you don't mind doing that clean-up work, or if you don't care about working with the post-measurement state, you can simulate the logical X measurement by doing those single-qubit measurements, obtaining +1 and −1 outcomes, and then computing their products to obtain what the result of the measurement of XX⊗...⊗X "would have" been. (More precisely: measuring all of those single-qubit X operators is something that does not disturb a state which would result from a measurement of the tensor product operator XX⊗...⊗X, and the product of those single-qubit measurements would have to yield a consistent outcome with the tensor product operator XX⊗...⊗X, so we can use this as a way to simulate that more complicated measurement if we don't mind all of the qubits being projected onto conjugate basis states as a side-effect.)

Lattice surgery for logical two-qubit operations

To realise a two-qubit operation, you can use a technique known as lattice surgery, wherein you 'merge' and 'split' different patches of the 2D lattice to realise operations between those patches (see [arXiv:1111.4022], [arXiv:1612.07330], or [arXiv:1704.08670] for complete descriptions of these operations. Disclosure: I am an author on the third of these articles.) This may be realised between two adjacent patches of the planar lattice (as illustrated above) by preparing those "uninvolved" rows and columns of qubits in a suitable state, and then measuring stabilisers which previously you were not measuring in order to extend the memory to a larger system. (In the diagram below, the horizontal spacing between the code segments and the column of qubits in the |0⟩ states is exaggerated for effect.)

$\qquad$

This will affect the logical operators of the system in a non-unitary way, and is most often used (see [arXiv:1612.07330] for example) to realise a coherent XX or ZZ measurement, which can be composed to realise a CNOT operation [arXiv:1612.07330, Fig. 1(b)]:
$\qquad\qquad\qquad$
In this way, you can realise a CNOT operation between a pair of encoded qubits.***

Footnotes

* You can also use slight modifications of the regular pattern of stabilisers, as Letinsky [arXiv:1808.02892] demonstrates, to achieve more versatile planar-surface representations of encoded qubits.

** In practise, rather than explicitly performing (imperfect single-qubit) operations, you would take advantage of the fact that the frame of reference for the encoded qubits is one which you are fixing by convention, and update (or 'transform') the reference frame rather than the state itself when you wish to realise a Pauli operation. This is the smart way to go about error correction as well: to treat errors not as 'mistakes' which must be 'fixed', but as an uncontrolled but observable drift in your reference frame as a result of interaction with the environment. You then hope that this drift is slow enough that you can track it accurately, and compensate for the change in reference frame when you do your computation. Particularly in the context of tracking errors, this reference frame is described as the Pauli frame, and its job is to describe the frame of reference in terms of the Pauli operations which would be required to put the system in the state usually described by an error-free error correcting code.

*** Many authors would describe this construction as the point of lattice surgery, and it is certainly the original concrete application of it described in the original article [arXiv:1111.4022]. It is possible in principle to do more elaborate operations using splits and merges, by treating the merges and splits as primitive operations in their own right rather than just the components of a CNOT, and using more versatile (but not especially circuit-like) transformations — this is essentially the point of my article with Dom Horsman [arXiv:1704.08670], which opens up the possibility of the ZX calculus (a somewhat heterodox representation of quantum computation) to be directly practically useful for surface-code memories.

$\endgroup$
  • 1
    $\begingroup$ great answer. By the way, in case you didn't know, you can fine tune the size of the images by directly using html tags. For example: <img src="https://i.stack.imgur.com/H94nX.png" width="300"/> $\endgroup$ – glS Oct 18 '18 at 9:44
  • $\begingroup$ @gIS: thanks, my HTML skills were weak from disuse when I tried that originally! It seems to be better now. $\endgroup$ – Niel de Beaudrap Oct 18 '18 at 10:06
  • 1
    $\begingroup$ @AbdullahAsh-Saki: following up on your question in the comments to JamesWooton, I've added some remarks on measurements of encoded states. $\endgroup$ – Niel de Beaudrap Oct 18 '18 at 10:22
5
$\begingroup$

One way to store qubits in the surface code is as pairs of "holes". A hole is a chunk of the surface where, instead of performing the stabilizer measurements used to detect whether errors are occurring, you instead do nothing.

There are two different types of hole, depending on whether the boundary of the hole travels along would-be X measurement qubits or along would-be Z measurement qubits. A CNOT is performed by cycling a hole of one type around a hole of the other type.

Diagrammatically speaking, it looks like this:

enter image description here

In the (b) diagram, time is moving from left to right. Each bar corresponds to the location of a hole over time. Each qubit is stored between the corresponding pairs of white bars. The black bar represents the hole being used to perform the CNOT. It avoids the middle qubit (which is not involved), surrounds one of the bars of the bottom qubit (which is the target), and goes around a 'cross-bar' introduced into the top qubit (which is the control). That's what a surface code CNOT looks like.

$\endgroup$
  • $\begingroup$ Where can I learn more about Fig (b)? I have seen similar figures in one of the lectures by Austin Fowler. However, it still remains very elusive. $\endgroup$ – Abdullah Ash- Saki Oct 17 '18 at 3:39
  • $\begingroup$ @AbdullahAsh-Saki arxiv.org/abs/1208.0928 defines what I mean by "holes" in quite a lot of detail. If you take slices through the diagram at each time, it shows where the holes are. So take the timeslice diagrams from that paper and picture what they would look like stacked on top of each other, and that's a braiding diagram. $\endgroup$ – Craig Gidney Oct 17 '18 at 3:50
3
$\begingroup$

There are multiple ways to store information in surface codes. Depending on the method you use, there are then multiple ways to do gates. So there's actually a lot to say on this issue!

Despite the multiplicity of methods, in practical terms they all come to pretty much the same thing: if you want you gate to be kept fault-tolerant by the code, you can only do Clifford gates (such as X, Z, H, CNOT, S). For other gates you'll need to invoke additional mechanisms to become fault-tolerant, such as magic state distillation.

But you didn't ask for anything beyond Clifford in your example. You just wanted an X and a CNOT. So that makes things easy.

For a concrete example, let's take the 17 qubit surface code shown below (as depicted in this paper, of which I am an author).

enter image description here

This is made up of $n=9$ physical qubits, numbered from $0$ to $8$. There are also 8 ancilla qubits depicted here, but we'll ignore them.

The dark patches in this image denote stabilizers made of $\sigma_x$ (so we measure the observables $\sigma_x^0 \otimes \sigma_x^1 \otimes \sigma_x^3 \otimes \sigma_x^4$ and $\sigma_x^1 \otimes \sigma_x^2$, for example). The light patches are then the $\sigma_z$ stabilizers.

One example of an operation that commutes with all stabilizers is to do a $\sigma_x$ rotation on a line of qubits from top to bottom, such as $\sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^6$. Another example is to do a line of $\sigma_x$ rotations from left to right, such as $\sigma_z^3 \otimes \sigma_z^4 \otimes \sigma_z^5$.

All other operations that commute with the stabilizer will be either products of stabilzers themselves (and so act trivially), or they will be equivalent to one of these two examples. So these operations act on our logical qubit. Since one is made of $\sigma_x$s, the other is made of $sigma_z$s, and they anticommute, it is would seem sensible to assign them as the Pauli operators $X$ and $Z$ of the logical qubit

$$X = \sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^ 6, Z = \sigma_z^3 \otimes \sigma_z^4 \otimes \sigma_z^5$$

So to do an $X$, you just perform the operation above.

For a CNOT, one of the many ways to do it is transversally. For this, suppose we have two logical qubits $A$ and $B$. Each is made of many physical qubits, that we'll number $0, 1, 2, \ldots$. So let's us $0_A$ to denote physical qubit $0$ of logical qubit $A$, for example.

To do ${\rm CNOT}(A,B)$, a CNOT with qubit $A$ as control and $B$ as target, we can then do

$$ {\rm CNOT}(0_A,0_B) \,\, {\rm CNOT}(1_A,1_B) \,\, {\rm CNOT}(1_A,1_B) \,\, \ldots$$

To see how this works, we have to look at the logical $|0\rangle$ and $|1\rangle$ states when expressed in the computational basis of the physical qubits.

Let's use $| \tilde 0 \rangle = |0\rangle^{\otimes n}$ to denote the state where all physical qubits are in state $|0\rangle$, and $| \tilde 1 \rangle = X | \tilde 0 \rangle$ a state with a line of $|1\rangle$s from top to bottom, on a background of $|0\rangle$s.

We can then simply express the logical $|0\rangle$ state as the superposition of $| \tilde 0 \rangle$ with all the state that you can get to from $| \tilde 0 \rangle$ by applying stabilizers. Logical $|1\rangle$ is similarly the superposition of $| \tilde 1 \rangle$ with all the state that you can get to from $| \tilde 1 \rangle $ by applying stabilizers.

By thinking of the action of the transversal CNOTs in terms of these states, you should hopefully be able to see how it acts as a CNOT on the logical qubits.

$\endgroup$
  • 2
    $\begingroup$ Should it be $X = \sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^6$ instead of $X = \sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^4$ if we consider going from top to bottom on the first vertical line? $\endgroup$ – Abdullah Ash- Saki Oct 16 '18 at 2:16
  • $\begingroup$ You are right. I corrected it. $\endgroup$ – James Wootton Oct 16 '18 at 4:08
  • $\begingroup$ One supplementary question: What is the relation between the measurement operator and the physical read-out of a qubit? (I have found many places where it mentions "measurement is defined by the measurement operator Pauli-X".) $\endgroup$ – Abdullah Ash- Saki Oct 17 '18 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.