Low-overhead fault-tolerant quantum computing using long-range connectivity

Vast numbers of qubits will be needed for large-scale quantum computing because of the overheads associated with error correction. We present a scheme for low-overhead fault-tolerant quantum computation based on quantum low-density parity-check (LDPC) codes, where long-range interactions enable many logical qubits to be encoded with a modest number of physical qubits. In our approach, logic gates operate via logical Pauli measurements that preserve both the protection of the LDPC codes and the low overheads in terms of the required number of additional qubits. Compared with surface codes with the same code distance, we estimate order-of-magnitude improvements in the overheads for processing around 100 logical qubits using this approach. Given the high thresholds demonstrated by LDPC codes, our estimates suggest that fault-tolerant quantum computation at this scale may be achievable with a few thousand physical qubits at comparable error rates to what is needed for current approaches.


I. INTRODUCTION
Quantum computing devices are now capable of outperforming even the fastest conventional supercomputers at certain tasks [1].However, to execute many quantum algorithms of practical interest, it is widely believed that a fault-tolerant architecture will be required to identify and correct errors in noisy quantum hardware.Faulttolerant architectures come with a significant overhead cost, using a large number of low-noise physical qubits to encode and process quantum information with even a small number of protected qubits.Specifically, it has been estimated that millions of qubits will be needed to solve relevant problems in quantum chemistry [2][3][4], to break cryptosystems [5,6] or to get an advantage over classical algorithms using polynomial speedups [7,8].These large overheads provide a daunting challenge for scaling up from today's noisy devices to large-scale faulttolerant quantum computers.
The enormous resource estimates mentioned above are all obtained using fault-tolerant architectures based on quantum error-correcting codes with local check operators [9][10][11][12].These codes have a number of highly desirable features for quantum computation, including high thresholds and fast decoders [5,13].The locality of these codes means that quantum error correction can proceed using only entangling gates between neighbouring qubits arranged in a two-dimensional layout, i.e., on a chip.Thus, while local codes provide a clear pathway to demonstrate the principles of fault tolerance using existing quantum technology, these overheads mean that useful fault-tolerant quantum computing with this approach will likely remain out of reach in the near term.
Locality of gate operations is a physically wellmotivated constraint.Recently, however, there has been * b.brown@sydney.edu.ausignificant progress in developing long-ranged entangling gate operations in a variety of quantum processing systems, including those based on superconductors [14], semiconductors [15][16][17] and trapped ions [18,19].Optical photons provide an approach that is not naturally constrained to a local two-dimensional layout [20,21], and can also allow for other qubit systems to be connected into complex quantum networks [22][23][24][25].Recent work has also considered emulating long-range interactions using a local quantum architecture and classical communication [26], and architectures have been proposed where long-range interactions are constrained on interconnected planar arrays of matter-based qubits [27].The possibility of long-range connectivity opens the door to a new class of quantum codes and fault-tolerant architectures that can harness this connectivity to our advantage.
Here, we show how to perform fault-tolerant quantum computation with an architecture that exploits longrange connectivity to significantly reduce the overhead, compared with local approaches.Rather than focusing on asymptotic behaviour, we consider the overhead savings that may be possible in the scale of devices expected in the near term, where for example fault-tolerant quantum computing on 50 logical qubits may be possible with only a few thousand physical qubits while maintaining a code distance of d = 14 ∼ 16.For comparison, a surfacecode based architecture requires at least ten-thousand qubits to attain a similar number of logical qubits and code distances.Provided that long-range coupling becomes sufficiently reliable to go below the fault-tolerance threshold of our scheme, we anticipate that such an architecture will be capable of performing non-trivial quantum algorithms at a scale compatible with current roadmaps for quantum devices under development during the next few years.
Our approach uses quantum low-density parity-check (LDPC) codes, which efficiently encode a large amount of logical information for a given number of physical qubits.There has been a recent surge of interest in this subject, Estimates of the overhead required to perform a round of logic, including those qubits needed to encode the data as well as additional ancilla qubits required to perform fault-tolerant gates.We use LDPC codes constructed in [28,29], which all have initial check weights of no more than 10.We denote the number of logical qubits as k and the distance of the code as d.Comparisons are made against the surface code with the same distance.Here, 'parallelism' denotes the number of logical qubits that can be acted upon non-trivially in one round of error correction, and which determines the number of required ancilla qubits.The number of data, ancillary, and total physical qubits needed to perform one round of logical measurements with error correction are denoted n data , nanc, and ntot, respectively.We do not include any ancilla qubits that may be used for error syndrome extraction.Estimates for the surface code were obtained using the compact block scheme from Ref. [30].
(see Ref. [31] for a recent review) spurred by Gottesman's remarkable observation [32] that quantum LDPC codes meeting certain criteria can be used to achieve fault-tolerant quantum computing with constant overhead.While research into quantum LDPC codes is still in its infancy, they are showing promise.Codes that fulfill Gottesman's criteria are now known [33].Moreover, recent numerical studies indicate that LDPC codes can achieve reasonably high thresholds [28,34,35].Recent breakthroughs in achieving high code distances indicate that there is room for further development [36][37][38].
To use these LDPC codes for quantum computation, one must be able to fault-tolerantly implement a universal set of protected logic gates.While Ref. [32] establishes a method to perform quantum computation using faulttolerant gate teleportation [39], the cost associated with the distillation of the requisite resource state [40] is not understood well in the practical regime of interest.
In this paper, we introduce a flexible method to perform low-overhead quantum logic gates for a general class of quantum LDPC codes.Our work can be thought as a generalization of lattice surgery [41], where an ancillary system is coupled to a quantum error-correcting code to measure logical Pauli operators in a fault-tolerant way.Our approach to low-overhead quantum logic builds on an extensive literature into the use of code deformations to perform Clifford gates via measurement that have been well studied for topological codes [5,13,30,[41][42][43], and which have recently been generalized to certain classes of quantum LDPC codes [44][45][46][47].To employ this approach for quantum LDPC codes in a way that maintains the desirable low overheads, we construct the required ancillary system by adapting weight-reduction methods proposed in Refs.[48,49] to measure the desired logical operators of a given quantum LDPC code.These logical operations then yield a universal gate set for fault-tolerant quantum computing when supplemented with noisy ancilla state injection via magic-state distillation [50].Thus, our scheme provides an explicit way of performing lowoverhead fault-tolerant quantum computing using quantum LDPC codes that is applicable to codes of even modest size.
Before presenting our detailed results, we briefly illustrate the potential overhead improvements that our construction enables.We will make use of existing quantum LDPC codes with explicit constructions and efficient decoders, together with our fault-tolerant approach to performing logic gates on these codes.Table 1 shows the overhead required to complete a round of logical operations with error correction for a given number of logical qubits k and code distance d for a number of quantum LDPC codes, specifically, hyperbicycle and hypergraph product codes explicitly constructed in Refs.[28,29].By one round of logical operations we mean a set of logical Pauli measurements such that each logical qubit is acted on non-trivially by at most one measurement.We directly compare the qubit resources for our construction against the use of surface codes encoding the same number of logical qubits and with the same code distance, with the latter serving as a proxy for how well the codes protect logical quantum information.The surface code is currently the predominant candidate for a quantum architecture, and considerable effort has been spent optimizing its overhead for fault-tolerant computation.Our analysis thus shows the potential overhead improvement that can be achieved using a non-local architecture as compared to a local architecture.
All codes we have used, and their fault tolerant operations, use check operators involving no more than 13 qubits for the largest code in Table 1.(However, it is not the case that all stabilizer generators will have this weight, and in fact most generators will have lower weight.)This weight is larger than that of the surface code, but not by a significant margin.Because this num- Parallelism.An example circuit consisting of Pauli measurements on an architecture with a parallelism of 6.This circuit contains 4 rounds of error corrected logical measurements.In each round, at most 6 logical qubits in total can be involved in logical measurements.
ber is fixed at a small constant value, errors do not spread significantly during measurement of these check operators, which would otherwise affect the threshold of the scheme.However, we emphasize that the stabilizer weights and the circuits used to measure the stabilizer generators will still affect the performance of this scheme.In particular, higher weight stabilizers will increase the failure rate under circuit-level noise and this should be taken into account when considering the estimates in Table 1.Efficient decoders for the codes in Table 1 have also been designed that perform comparably to minimum-weight perfect matching decoding on surface codes of similar distance [28].We implement Clifford gates through parity measurement of logical qubits in the Pauli basis.In order to keep the overhead low, we restrict the number of logical qubits that can participate in a single measurement round, and we call this number the parallelism of the scheme; see Fig. 1.For a given level of parallelism and given error correcting code we require n anc physical qubits to create the ancilla systems used in logical measurement, and n data is the size of the code used to store the logical information.Our analysis shows that at very small code sizes, quantum LDPC codes give only a modest overhead improvement when compared to surface code architectures.However as the size of the system increases we see that the improvement in overhead for the quantum LDPC codes becomes very significant, offering an order of magnitude improvement at several hundred logical qubits.Current algorithms for minimal non-trivial quantum chemistry calculations [51] require around 100−200 logical qubits and so even at this regime it may be beneficial to use quantum LDPC codes.We expect that for larger algorithms, such as more complex quantum chemistry algorithms [2][3][4] or Shor's algorithm [6,52], where several thousand logical qubits are required the overhead gains will be substantial.
These encouraging reductions in overhead motivate ex-perimental work towards the design and realization of quantum LDPC codes in the laboratory.At the physical level it remains to find efficient ways to measure check operators extending over distant qubits with high fidelity.With long-range coupling now demonstrated using a number of very different approaches [14][15][16][17][18][19], as well as proposals allowing all-to-all coupling [53], there is significant room for innovation here.It is also critical that we identify check operator readout circuits that maintain the fault tolerance of the scheme, as well as account for cross-talk that may be present in long-range interactions, and this will require the development of quantum LDPC codes at the level of the circuit error model [27,54].
Lastly, further study into compilation of quantum algorithms will allow us to determine what level of parallelism is required to efficiently execute a quantum computation.A commonly employed elementary fault-tolerant gate set consists of non-destructive measurements of arbitrary Pauli strings [4,30,55].If the parallelism is strictly less than the number of logical qubits, clearly not all the Pauli strings can be measured directly.In particular, if the weight of the Pauli string exceeds the parallelism, one would need to break that measurement down into a sequence of (lower-weight) Pauli measurements, leading to a reduced speed.However, if the majority of the Pauli strings have small weights, the speed of the two approaches will not differ significantly.We anticipate this to be the case if the goal is to simulate a locally interacting many-body quantum spin Hamiltonian using the Trotter-Suzuki method [56], but it is unclear how the two approaches will differ for methods such as qubitization [57].

II. RESULTS
We now present our main result: a procedure to implement fault-tolerant logic gates in quantum LDPC codes via a generalization of lattice surgery, in a way that preserves the low overheads.We propose a method for implementing fault-tolerant gates on quantum LDPC codes by using multi-logical Pauli measurements [30].Our result expands on a set of techniques originally devised to reduce the weight of stabilizer generators of quantum codes [48,49].We extend these results to include measurement of all logical Pauli operators, allowing for implementation of the full logical Clifford group.Our method is a form of code deformation, in which we transform our code into a new code and in doing so obtain logical information about our original code [5,13,30,[41][42][43].
Our construction enables us to perform single-qubit Pauli measurements, as well as parity measurements between logical qubits on one or multiple LDPC blocks in an arbitrary choice of Pauli basis.This capability gives us a measurement-based approach for realising the full Clifford gate set [30].This gate set can be supplemented with magic state distillation and state injection to achieve universal quantum computing [50].We will discuss uni-versal quantum computing in more detail in Section II D. Our construction also guarantees that the distance of the code is preserved during the code deformation and so we retain the error-correcting capabilities of our code.
We begin by setting some basic notation and terminology in Section II A. Section II B presents our construction for measuring logical multi-qubit Pauli operators.We then prove that our construction preserves the distance of the code throughout the process in Section II C.

A. Notation and terminology
We describe quantum error-correcting codes with the stabilizer formalism.Let P = I, X, Y, Z be the Pauli group and P n = P ⊗n the Pauli group acting on n qubits.A stabilizer code is defined by an Abelian group S ⊂ P n such that −I ∈ S. The code C is a subspace spanned by the common +1 eigenvalue eigenstates of the operators in S. The logical Pauli operators are operators in P n that commute with every operator in S but are not themselves in S. If S is generated by an independent set of generators {g 1 , . . ., g m }, the number of logical qubits of the code is k = n − m.The distance of the code is equal to the weight of the least-weight non-trivial logical operator where the weight of an operator in P n is the number of qubits on which it acts non-trivially, i.e., with non-identity support.Of particular interest are a class of stabilizer codes known as Calderbank-Shor-Steane (CSS) codes.These are codes with a stabilizer group that can be generated by a set that includes only two types of elements: those that are the product of Pauli-X operators only and those the product of only Pauli-Z operators.
We consider families of stabilizer codes S n such that each member of family is indexed by the number of qubits n.Let w n be the maximum weight of a stabilizer of a generating set of S n and let q n be the maximum number of stabilizer generators that act on any given qubit for a specified generating set.A family of LDPC codes then is a sequence S n that can be generated by a set of stabilizer generators such that w n = O(1) and q n = O(1).For the remainder of the paper we will drop the explicit dependence on n, and assume these quantities are constants.
We can describe LDPC codes using the Tanner graph.Let T = (V, C, E) be a bipartite graph.Each node in V corresponds to a physical qubit in the code, and each node in C corresponds to a generator of the stabilizer group of the code.We draw an edge between c ∈ C and v ∈ V if the generator corresponding to c acts nontrivially on the qubit corresponding to v. We label each edge with either an X, Z, or Y depending on how the generator acts on the qubit.For the case of CSS codes we can instead label the nodes in C with X or Z, as opposed to labelling the edges.We will often abuse notation and use the labels for variable and check nodes of a Tanner graph to refer to their respective physical qubits and stabilizer generators directly.

B. Code deformation
We now present our main technical contribution, starting with an outline of the basic idea behind implementing measurements using code deformation.Suppose we have a stabilizer code S = g 1 , . . ., g m along with a logical operator L that we wish to measure.We can interpret our procedure as adding L to the generating set of a new code that includes this operator, and then removing it again once we have reliably obtained the measurement outcome.Note, however, that simply adding L to S will not yield an LDPC code because in general L is a high weight operator.To maintain the key properties of an LDPC code, we need a stabilizer code that includes L in its stabilizer group whereby L can be generated with constant-and ideally low-weight generators.This can be achieved by creating an extended system with additional qubits that include a set of low-weight stabilizer generators S 1 , . . ., S l whose product gives L. The product of the measurement results for each stabilizer generator gives us the measurement result of L. It is also important that the stabilizers of the new code do not generate any other logical operators of S so that we do not make any unwanted logical measurements that may affect our computation.

Logical CSS measurement
Here we describe our construction for fault-tolerant measurement of logical Pauli operators in CSS codes, illustrated with an example in Fig. 2 for concreteness.We concentrate on the case for measuring X logical operators, but remark that an analogous procedure will hold for measuring Z logical operators by reversing the X and Z terms in the following discussion.Let C be a CSS stabilizer code described by Tanner graph G = (V, C, E).We show how to measure a specific instance of an X logical operator X.To do so, we deform code C onto a new code C merged described by the Tanner graph that includes G as a subgraph, G merged ⊃ G.
Our goal is to define a new LDPC code whose stabilizer group includes X.We can use this new code to infer the measurement result of X by measuring its stabilizer generators.The construction of G merged is expressed in terms of G and a subgraph of G specified by X that we call . The variable nodes V X of the subgraph G X are the qubits that support X; checks C X are Z type stabilizers that share an edge of the Tanner graph with variable nodes V X ; and edges E X ⊆ E are those of E that are incident to nodes included in both V X and C X ; see Fig. 2

(a). The dual graph G T
X is such that for each v ∈ V X we have a corresponding node v T ∈ C T X and likewise for each c ∈ C X we have a corresponding vertex c T ∈ V T X .For each edge e ∈ E X with e = (v, c) we have e . There is a one-to-one mapping between the X-type generators and the qubits in (a), and the qubits and the Z-type generators in (a).(c) Measurement of X using the ancilla system Ganc = G merged \G.The Tanner graph Ganc is constructed by taking alternating layers of the subgraph G T X in (b) and the subgraph G X in (a).The vertical edges are the set Eextra, which connect adjacent layers.The product of the X generators gives the logical X and hence the product of the measurement results for each X generator gives the measurement result of the logical X.After merging the codes and measuring X we then split the codes by measuring the stabilizers for C and measuring the qubits in Canc in the Z basis, returning us to the original code space.
X are those that correspond to the nodes of the original subgraph; see Fig. 2(b).For now we assume that there is no strict subset of qubits V ⊂ V such that V supports a distinct X logical operator, before explaining the differences with the more general case.
We define the Tanner graph G merged in terms of G and our new graphs G X and G T X .Specifically, we combine the Tanner graph G with r copies of G T X and r − 1 copies of G X using additional edges E extra ⊂ E merged .We layer the copies of G X and G T X in an alternating fashion; see Fig.

2(c). The additional edges E extra connect adjacent layers of G T
X and G X as shown in Fig. 2(c).To explicitly describe the edges of E extra , we index copies of these graphs and their corresponding objects In later sections we will refer to the layers corresponding to G T X [j] a dual layers, and the layers corresponding to G X [j] as primal layers.We will also refer to the final layer G T X [r] as the boundary layer.Let us also append indices to the objects of G X ) to define E extra .Recall that for each variable and check in G X we have a corresponding check or variable, respectively in G T X .Thus, we also have that each ) for all v, c and 1 ≤ j ≤ r, and edges (v To summarise, with E extra ⊂ E merged defined, we have now specified all of the objects of G merged .We have that G is a subgraph of G merged .Likewise, the variables of G T X [j] and G X [j] are variables of G merged .The checks of subgraphs G X [j] are Z stabilizers for G merged and the checks of dual graphs G T X [j] are X stabilizers of the merged Tanner graph.Edges E extra fix graphs G, G X [j] and G T X [j] together.It will sometimes be helpful to refer to G anc = G merged \G as the ancilla system-the resource used to make parity measurements.
Having constructed our new code defined by the Tanner graph G merged , we now present the following lemma demonstrating that X is an element of the stabilizer group of this new code.Lemma 1.Let C be a CSS LDPC code and X an X logical operator in C such there is no other X logical operator supported on a strict subset of the qubits in X.Then the construction for G merged above gives a code C merged that contains X in its stabilizer group whereby We recall that we have used the notation where v T [j] is the stabilizer generator represented by this check node.
Proof.We prove this lemma by showing that the support of j,C T [j] v T [j] on the qubits of G anc is trivial, and is non-trivial on V [1], which is the support of X.By definition, stabilizers v T [j] are supported on variables v We therefore concentrate on these qubits.
Observe that each Z generator c ∈ C[1] must be connected to an even number of qubits in V [1] in order for the stabilizers to commute with X.Consequently, each physical qubit c Consequently, the product of all the X generators in C anc gives precisely the logical operator X, thus giving us the desired result.
To make a measurement of X in a practical way we first determine G merged and prepare each physical qubit in G anc in the |0 state.We then measure all the stabilizer generators in G merged and perform a round of error correction.To ensure this procedure is fault tolerant in the presence of noisy measurements we can repeat this step d times [43].Once we have fault tolerantly obtained the result of the measurement of X we can return to the original code space C by measuring each physical qubit in G anc in the Pauli-Z basis.
Lemma 1 provides a mechanism to perform a measurement of an X logical operator X; however, it is restricted to the special case where there is no other X logical operator within its support.In the general case, we may have another X logical operator X supported entirely on a strict subset V of physical qubits in V [1].Following the construction as given above, we will make an unwanted measurement of X , which will result in an entirely different computation.As an example of this situation, consider the measurement of a two-logical-qubit operator X1 X2 , where X1 and X2 are canonical logical operators that do not intersect at any physical qubits.Following the procedure outlined above will give us separate measurements of X1 and X2 .
We now generalize our construction of G merged to address this general situation, which we illustrate in Fig. 3. To measure X1 X2 without measuring the value of X1 or X2 individually, we must construct G merged such that the separate logical operators are connected.First construct the separate ancilla systems, G anc.1 and G anc.,2 for X1 and X2 .Let There are the variable and check nodes in the highlighted region of Fig. 3.The nodes of G merged will consist of all the nodes in G ∪ G anc.,1 ∪ G anc.,2 as well as the nodes a[k] and z[j].The edge set of G merged will also contain all the edges in G ∪ G anc.,1 ∪ G anc.,2 as well as the edges connecting G T X1 [2] and G T X2 [2] to G X1 [1] and G X2 [1] respectively.We then add the following edges, which are the edges in the highlighted region of Fig. 3 Then the product of all X checks in G\G merged gives the measurement of X1 X2 and the product of the X checks exclusively in G anc,1 or G anc,2 do not give measurements of X1 or X2 since they will have support on the physical qubits a[k].
Before continuing, we offer some orienting remarks.First of all, if we choose to measure a logical operator supported at the boundary of the planar code defined using the lattice geometry presented in Ref. [9], we recover the lattice surgery construction given in the original work [41].Indeed, the gates we obtain are similar in spirit to those proposed in Ref. [44] where a surface code embedded on a torus is used as a resource to measure logical CSS operators of constant-rate hyperbolic surface codes.We expect the additional resources that will be needed to perform these logical operations will scale similarly with code distance to our scheme, up to constant factors.Our techniques however do not require the logical operators to have a specific structure, and are thus more broadly applicable to quantum LDPC codes.Secondly, the reader familiar with hypergraph product codes [58] can check that G anc is the hypergraph product of G X and the Tanner graph of a repetition code with r variables.From this observation, it is easy to verify that the stabilizers supported on the variables of G anc commute.

Logical non-CSS measurement
In order to implement the entire logical Clifford group using logical Pauli measurements, we must also be able to measure non-CSS logical operators that are the product of Pauli-X and Pauli-Z measurements [30,42,55].We now demonstrate how our construction can be adapted to such measurements.
First, we demonstrate how to measure the logical operator Ỹ , which we illustrate in Fig. 4. Let X be a logical operator in C and let Z be the corresponding Z logical operator.The corresponding Y logical operator is given by Ỹ = i X Z. Since X and Z must anti-commute any support of X and any support of Z must intersect at an odd number of qubits.
To measure Ỹ we prepare an ancilla system by combining two ancilla systems G anc X and G anc Z used to measure the CSS measurements X and Z, respectively, using a fusion procedure as follows.We denote A = V X [1] ∩ V Z [1] as the set of qubits in the intersection of X and Z. Their check operators are denoted C X [k] and C Z [k], respectively.
For each physical qubit v ∈ A there are corresponding Measurement of the logical operator X1 X2.First, ancilla systems for the logical operators X1 and X2 are constructed as in Fig. 2.These ancilla systems are connected together as highlighted (green box).This ancilla system is then connected to the logical X1 X2 as previously.Observe that the product of the X stabilizer generators in the ancilla system gives the logical X1X2.Furthermore, if we take the product of the X stabilizers on the left ancilla system we do not obtain X1, since this product will include qubits in the highlighted (green) region.The same holds for the stabilizers in the right ancilla system.Hence the product of the measurement results for these generators gives the measurement result for X1X2.After obtaining the measurement result, we can again measure the original stabilizers to return to the code space.
and G anc Z respectively.We then form G merged using all the nodes and edges in G anc X and G anc Z , except for the generators v T X [k] and v T Z [k] for all vertices in A, which we replace with y creates an extra degree of freedom which we fix by introducing check nodes g[j] for 2 ≤ j ≤ r and adding a Z edge (v X [j], g[j]) and an X edge (v Z [j], g[j]).The product of the X generators in G anc X , the Z generators in G anc Z , and the generators y[k] allow us to infer the measurement of Ỹ .To check that these stabilizer generators commute note that all the generators in G anc X and G anc Z commute since they act on different qubits, except v T X [1] and v T Z [1], which we rectified by combining them.This procedure can also be straightforwardly adapted to measure a logical operator of the form X1 Z2 when the intersection of the supports of X1 and Z2 is not empty.
Finally, we require measurement of non-CSS product operators such as X1 Z2 when X1 and Z2 do not intersect at any physical qubits, as illustrated in Fig. 5.As in the general case for CSS measurements, we must first connect the logical operators in order to make a parity measurement.We calculate the ancilla systems G anc 1 and G anc 2 for X1 and Z2 .Let This measurement closely follows that of logical X1 X2 shown in Fig. 3, with the key difference being that ancilla systems for the logical operators X1 and Z2 are connected using non-CSS generators.Observe that the product of the X stabilizer generators on the left, the Z stabilizer generators on the right, and the mixed stabilizer generators in the dual layers gives the logical Ỹ .
Measurement of the logical operator X1 Z2.This measurement closely follows that of logical X1 X2 shown in Fig. 3, with the key difference being that ancilla systems for the logical operators X1 and Z2 are connected using non-CSS generators (highlighted green box).Observe that the product of the X stabilizer generators on the left, the Z stabilizer generators on the right, and the mixed stabilizer generators in the highlighted region gives the logical X1 Z2.
for the measurement of X1 X2 , we extend out each ancilla system so that G anc 1 has a boundary of X generators coming out of the column defined by c 1 [k] and G anc 2 has a boundary of X generators coming out of the column defined by c 2 [k].As for the Y measurement we then merge these boundaries by merging the corresponding X and Z generators at these boundaries and creating weight-two XZ generators between corresponding physical qubits at these boundaries.Then if we take the product of the X generators in G anc 1 , the Z generators in G anc 2 , and the merged stabilizers we obtain a measurement of X1 Z2 without measuring X1 and Z2 separately.

Simultaneous measurement of commuting logical operators
Suppose we wish to simultaneously measure two commuting logical operators.If the supports of the logical operators do not intersect then it is easy to see that we can make each measurement independently at the same time.If the supports do intersect but both logical operators are of the same type (all X or all Z) then we can still independently measure each logical operator using our construction.Finally, if the two commuting logical operators are not of the same type (say a Pauli-X type measurement X1 and a Pauli-Z type measurement Z2 ) and intersect then they must intersect at an even number of qubits.Let L1 and L2 be the two commuting Pauli operators and let a and b be two physical qubits in the intersection [1] such that L1 and L2 act with different Pauli operators on a, and similarly on b.Then the generators a T will not commute.To rectify this situation, we replace the generators a T

C. Fault tolerance
Having presented our construction to perform logical Clifford gates via logical Pauli measurement, we now show that the merged code still possesses error correcting capabilities and therefore retains its fault-tolerance.First of all, it follows straightforwardly from our construction that the LDPC nature of the code remains intact throughout the deformation from C to C merged .Lemma 2. Let L be a logical operator on a CSS quantum LDPC code C. Let w be the maximum weight of a stabilizer generator in C and let q be the maximum number of stabilizer generators acting on a physical qubit in C. Let w and q be the equivalent quantities for the code C merged obtained after making a measurement of L in C. Then w , q ≤ max(w + 3, q + 3).This fact is important for reducing complexity of the stabilizer measurement and for limiting the spread of errors throughout the deformation procedure.

Distance of C merged
In order to preserve error correcting capabilities it is important that our code maintains a non-trivial distance throughout the code deformation.We show that the code distance of C merged is no less than that of C.There are two main concerns regarding the distance of our construction.The first is whether the construction can reduce the weight of the logical operators.Through consideration of the structure of logical operators on the ancilla system, we demonstrate that logical operators terminating at the boundary layers of the ancilla systems must necessarily maintain their weight because these boundaries are kept well-separated.Secondly, our construction can add new logical degrees of freedom to the code.As we are not interested in the state of these additional qubits, we refer to them as gauge qubits.This is consistent with terminology used in the context of subsystem codes, see Ref. [59] for an introduction.We demonstrate that the logical operators associated to the gauge qubits (that we refer to as gauge operators) do not decrease the distance of the logical operators of interest.We call an operator that acts simultaneously on logical qubits and gauge qubits as a dressed logical operator.It is important to check that there are no dressed logical operators with weight smaller than d, as the existence of such an operator will mean that the code distance is decreased.
Our following arguments will also use the notion of 'cleaning' [60].We say that a logical operator L is cleaned from some set of physical qubits A to some set of physical qubits B, if we can multiply L by an element S of the stabilizer group such that the equivalent logical operator L = S L has trivial support on A and non-trivial support on B.
The distance of C merged will depend upon the value of r, where r was defined as the number of copies of G T L in the ancilla system.Let d be the distance of C. Consider the example of measuring the logical operator X 1 X 2 of the surface code that encodes two logical qubits shown in Fig. 6.Then letting r = 1 will significantly reduce the distance of the code, whereas letting r = d will preserve the distance.In general we will show that if we let r = d, where d is the distance of C, then we can guarantee that the distance of the code during deformation does not drop below d.
Measuring a logical operator in C may introduce gauge degrees of freedom for which we must account.Suppose we measure a logical operator L in our code.We construct the ancilla system using the primal and dual graphs G L[j] G T L [j] and merge them together with C to create C merged .If the number of independent check nodes in G T L is less than or equal to the number of variable nodes then G T L will have non-trivial degrees of freedom and making the measurement of L will add extra gauge qubits to our code.In the case of an X measurement, we can choose a canonical set of Z gauge operators that are entirely contained in any dual layer of the ancilla system.To mitigate this we must use an ancilla with d layers, as in (c).This ensures that the distance of the code is preserved during the merge.It is worth noting that it may not always be the case that d layers are needed to preserve the distance, and for certain codes it may suffice to only use one layer.
Suppose that r = 1 and G T L [1] contains n variable nodes and m check nodes.Then if we interpret G T L [1] as a classical code it contains at least n − m logical bits.This is a lower bound since some of the checks in G T L [1] may be a linear combination of other checks.However in our case there are exactly n − m + 1 logical bits in G T L [1].This is due to the fact that if there were a subset of check nodes in G T L [1] whose product gives the identity, then the equivalent qubits in L would be a logical operator, and we have enforced the requirement that L contains no subsets that support a logical operator.We will call the logical operators of G T L [1] cycle operators.However, we stress that the exact structure of these operators will not be important.Now when we create G merged with r = 1 we add n qubits, m stabilizer generators, and remove one logical qubit, thus adding at least n − m + 1 new gauge qubits.However the same constraint for G T L [1] carries to G merged and hence there are exactly n − m + 1 new gauge qubits, and we can choose the canonical set of Z gauge operators to be the logical operators of G T L [1].These define all of the gauge degrees of freedom.
The cycle operators on G T L are independent of the original logical operators on C, and correspond to stabilizers of C. Each qubit in a cycle in G T L [1] has a corresponding stabilizer generator in G L [1].By applying these generators we can clean the cycle operator so that it is supported entirely on C. In this case we can see that the cycle operator is thus equivalent to a product of old stabilizers in G L [1].
A cycle gauge operator in the bottom layer G T L [1] can be cleaned to other layers G T L [k] through the application of stabilizer generators in G L[k] and so equivalent cycles in different layers of G T L [k] correspond to the same gauge qubit.
We illustrate this in Fig. 7, where we show the measurement of an X logical operator.Here we can construct a canonical set of logical operators of G T L [1] with two cycles and so there are two gauge qubits.In this case the cycles correspond to Z gauge operators.The following lemma tells us about the nature of the X gauge operators.
Lemma 3. Let C merged be the code obtained after measuring an X logical operator.Let Zg be a Z gauge operator in C merged .If a logical or gauge operator Õ anticommutes with Zg then it has weight at least r.
Proof.If Õ anti-commutes with Zg then it must intersect every possible support of Zg .There are equivalent cycles all representing Zg on each dual layer of G anc .These equivalent cycles are disjoint and so the X gauge operator must have support on every dual layer.Since there are r dual layers, Õ must have weight at least r, and furthermore must have weight at least one on each dual layer of G anc .
We can thus think of the X gauge operators as 'strings' that travel from the top boundary G T L [r] to the bottom of G T L [1] and terminate in C. We now show that C merged , when treated as a subsystem code, has distance at least d.
Theorem 1.Let C = n, k, d be a quantum CSS LDPC code and let L be a logical operator in C. Let C merged be the code obtained after making a measurement of L in C using an ancilla system C anc .Then C merged , when treated as a subsystem code, has distance ≥ d as long as the ancilla system has at least 2d − 1 layers.

D. Low-overhead fault-tolerant quantum computation
The previous section presents our construction for fault-tolerant measurements of logical Pauli operators.These measurements allow for logical Clifford gates as well as initialization and measurement in the logical Pauli basis.
Here, we consider what this construction means for performing low-overhead fault-tolerant quantum computing.We first consider the space-and time-overheads associated with our approach to fault tolerance, with the parallelism arising as a key quantity in determining these overheads.We then discuss the overheads associated with non-Clifford gates implemented via magic states, and discuss the decoders available for quantum LDPC codes.
Gauge operators of C merged .The red and orange cycles in the first layer of the ancilla system give a canonical set for the Z gauge operators.All red cycles correspond to the same gauge operator up to stabilizers.We can see that the Z gauge operators can be deformed so that they lie entirely in C, and are equivalent to the product of the original Z stabilizers that are in G X .The blue string is the X gauge operator corresponding to the red cycles.It must anti-commute with any representation of the conjugate Z gauge operator and so it must intersect with every red gauge operator in the graph.
Since the red gauge operator can be cleaned to any dual layer of the ancilla system, the blue X logical must have support at least on every dual layers of the ancilla system.Since we use an ancilla system with d dual layers, this means an X gauge operator must have weight at least d.

Ancilla system size
We now analyze the space overhead associated with making Pauli measurements using ancilla systems.Let L be a logical of weight w L in a code C with distance d.Again, let q be the maximum number of stabilizer generators connected to a physical qubit in C. Then there are at most qw L /2 check nodes in the graph G L and to leading order the number of physical qubits in the ancilla system used to measure L is In particular when r = d, as in Theorem 1, this means that the ancilla system is proportional to w L d.This makes our scheme particularly applicable to codes such as the hypergraph product code, with distance scaling of O( √ n).Note that for the codes considered in Table 1, which are constructed from cyclic classical codes, we can choose a canonical set of logical operators so that w L = d for all of the logical operators in this set.

Parallelism
Let us now look at how the space and time overheads of our fault-tolerant scheme depend upon the weight of the logical parity measurements.We will see that there is a trade off between the space and the time overheads and that certain codes allow us to improve these overheads when compared to a general LDPC code.
First note that the techniques for making parity measurements between two logical qubits can easily be generalised to make parity measurements between multiple logical qubits.For instance, suppose we wish to measure X1 X2 Z3 .This can be accomplished by first constructing the ancilla systems to measure X1 X2 and Z3 separately.We can then connect these ancilla systems to create the ancilla system to measure X1 X2 Z3 .We can then continue this construction to implement Pauli measurements of an arbitrary number of logical qubits.It is important that when we implement this construction we do not connect all the ancilla systems at the same qubit, as otherwise there can potentially be a qubit that is in the support of many stabilizer generators, and C merged will not be an LDPC code.
There is however a limit to how many logical qubits we can include in a parity measurement if we want the code rate to remain constant during the deformation.Suppose the code has Θ(n) logical qubits.Then if we want to make a parity measurement of all X logical operators in the code we would require Ω(nd) ancilla qubits.If d > Ω(1) then the number of ancillas we must add is > Ω(n) and hence the resource cost of computation will diminish the savings made by choosing a finite rate code.From an asymptotic standpoint, this means that the number of logical qubits measured in a single parity measurement should be kept at a constant.This restriction will limit the number of logic gates that can be performed in parallel, and consequently the time overhead of the computation is increased.In general there is a tradeoff between space and time overhead.If we increase the space overhead by adding many ancilla systems then we can decrease the time overhead by allowing very large multi-logical measurements.
We encapsulate these notions in the parallelism of our fault-tolerant quantum computing scheme, which we defined in the summary of results.The parallelism is not inherent to a code, and is instead chosen depending on the available space and time overhead.For instance, imagine a quantum computing platform for which the space overhead, i.e., required number of qubits, is the primary constraint.In this case, it will be advantageous to reduce the parallelism at the expense of time.In this space-constrained regime, the most natural choice is to use a parallelism of two, performing a sequence of weighttwo logical Pauli measurements, which can be easily converted to an entangling gate.
However, certain codes, e.g., hypergraph product codes constructed from good classical LDPC codes, possess an extra structure that allows us to achieve the same parallelism with a more modest resource.We can lay out a hypergraph product code on a two-dimensional grid so that the support of a canonical logical operator is contained entirely in one row or one column [29].Each row and column can support multiple logical qubits and so we can configure an ancilla system for an entire row or column that can measure multiple logical qubits.In the asymptotic limit, each row or column contains Θ( √ n) physical qubits and O( √ n) logical operators and so for a d = O( √ n) hypergraph product code a single ancilla system of size O(n) can be to used to measure Pauli operators with logical weight O( √ n).A naive scheme would have yielded an ancilla system of size O(wd 2 ) = O(n 3/2 ).As an explicit example, the 7938, 578, 16 code from Table 1 can be arranged on a two-dimensional grid such that each row or column contains 63 physical qubits and 17 logical operators of the same type.Each qubit is in the support of at most 5 stabilizer generators and the code has distance 16.Hence using Eq. ( 2) we find that we can construct an ancilla system for an entire row or column, and measure up to 17 logical operators, using around 3528 physical qubits.Furthermore, in such a layout logical operators of different type only intersect if they correspond to the same logical qubit, and hence if we assume that each logical qubit is only acted upon non-trivially by one logical operator in each round of error correction then we can keep the stabilizer generator weight low by avoiding the construction for the simultaneous measurement of commuting logical operators.
If we wish to be able to measure all the logical operators on the hypergraph product code then we require O(n 3/2 ) ancilla qubits.This reduces the rate and distance of the scheme to O(n 2/3 ) and O(n 1/3 ) respectively.Note that these code parameters cannot be achieved by a strictly local code in two dimensions because such codes necessarily obey the constraint kd 2 = O(n) [61].

Magic states
With a scheme to perform Pauli measurements on quantum LDPC codes, we consider how this approach can be integrated into a broader scheme for performing universal fault tolerant quantum computing with low overhead.There is one main requirement that we still need in addition to Pauli measurement, which is the distillation of magic states [50].
As we have already mentioned, Clifford gates alone are not sufficient to perform universal quantum computing, and in addition we require a non-Clifford gate such as a T gate or a CCZ gate.A standard approach to faulttolerant non-Clifford gates is through injection of magic states.For example, the T gate can be implemented using the magic state |T and Clifford gates.Unless the code being used has transversal T gates it is generally difficult to prepare these magic states in a fault-tolerant way.For this reason, magic state distillation, which prepare a small number of low error magic states from a larger number of noisy magic states, is often required for fault tolerant architectures.
Here we assume that all the data qubits are stored on one LDPC code block, such as a hypergraph product code, along with ancilla systems to make Pauli measure-ments on the data block.To distill magic states we use a separate magic-state factory, and then inject the distilled magic states into our data block using the ancilla systems.We will consider previously designed magic-state factories that use surface codes.As an example computation, suppose we want to perform 10 10 T gates, the number required in [6], with a tolerance of 1%, and each noisy |T has an error of 10 −3 .Then we require a distillation scheme with an output error rate of 10 −12 .Such a magic-state distillation scheme can be implemented using ∼ 15000 physical qubits where we do not count the qubits needed for stabilizer measurements.Such a distillation scheme in conjunction with the 7938, 578, 16 data block would still render a favourable overhead when compared to a full surface-code scheme.Of course this would render a fairly slow scheme, since we would only be producing one magic state at a time.In the discussion we consider the possibility of further reducing the overhead required for magic-state distillation by using LDPC codes, allowing us to increase the frequency of magicstate production while maintaining low overhead.

Decoders
There has been extensive work in designing efficient algorithms for decoding quantum LDPC codes.Many of these adapt known algorithms for classical LDPC codes, modifying them to deal with the nuances of quantum codes.One simple decoding algorithm for classical LDPC codes is the bit-flip algorithm.Leverrier, Tillich, and Zemor [62] adapted this decoder for quantum LDPC codes and designed the small-set flip decoder, which was then shown to be able to correct a linear number of errors on quantum LDPC codes with sufficient expansion properties [33].The predominant algorithm for classical LDPC codes is belief propagation (BP) decoding.BP works by envisioning the code as a graph and transmitting likelihoods between the nodes.While BP works well on classical codes its performance is not as consistent on quantum codes due the degeneracy present in quantum LDPC codes, which results in split beliefs, where the decoder is not able to choose between two equivalent corrections.As a result several modifications have been proposed to adapt BP decoding for quantum LDPC codes.In particular, Pantaleev and Kalachev combined BP with ordered statistic decoding (OSD) to design a decoder that appears to perform well on a variety of quantum LDPC codes [28].Hastings [63] created an efficient greedy decoding algorithm that is able to correct a constant number of errors on the hyperbolic surface codes.There is thus a sufficient body of work showing that efficient decoding of quantum LDPC codes is possible.See also [44,64,65].For decoding we will assume the use of one of the decoders outlined above.Given a good choice of code, these decoders appear to have performance comparable or even superior to that of the surface code.

III. DISCUSSION
We have shown that it is possible to use LDPC codes to achieve fault-tolerant quantum computing with overheads favourable to surface code schemes, even at reasonable scales.Our scheme uses a generalized form of lattice surgery, which when coupled with magic-state distillation can implement universal quantum computing.
Our construction highlights parallelism as a key constraint in maintaining low overheads, and we note that this role of parallelism has also been identified in other schemes for quantum computing using LDPC codes, in particular the scheme by Gottesman [32].In Ref. [32], quantum computation proceeds by preparing encoded resource states and then using teleportation to execute quantum gates.A concatenation scheme is used to prepare arbitrary resource states into the LDPC code blocks, which has a non-negligible overhead, and thus requires a fixed value of the parallelism in order to maintain a constant overhead.In constrast, our proposal allows for parallelism to increase with distance for certain code families, such as the hypergraph product codes.Furthermore, while the scheme in Ref. [32] has the required asymptotic behavior, concatenation often suffers from poor error thresholds as well as undesirable overheads in the practical regimes of interest.For our proposal, based on code deformation, we can expect similar thresholds to those obtained for LDPC codes used as quantum memories [27].
There are two main bottlenecks, in terms of overhead, in our scheme, and we now address how these may be overcome.One of the main contributions to the overhead in our scheme is magic-state distillation.Although we argued that it is possible to use surface-code schemes while still maintaining an overhead advantage, it is generally necessary to use several magic-state factories to achieve a high enough rate of magic-state production.There is a potential for LDPC codes to be used to improve the overhead of magic-state distillation schemes.We can look to some ideas from surface codes.Reference [30] presents several surface-code distillation schemes that achieve low overheads using the following idea.Circuits for magicstate distillation using codes with transversal T gates can be rewritten to use only Z measurements.This means that Z logical errors are far less destructive than X logical errors, and hence it is sufficient to use surface codes with low d z .It is very straightforward to generalize this to LDPC codes such as the hypergraph product code.By taking the product of a high rate, low distance classical LDPC code and a high distance repetition code, we can construct LDPC codes with low d z , high d x , and higher encoding rates than the surface code.While this will not improve the overhead for constructing a single magic state factory, it may allow us to fit several identical factories in the same space as one surface-code factory.
One advantage that such a magic-state scheme would offer is that the hypergraph product code used is only non local in one dimension.This may be a desirable simplification in some quantum systems.In general, a promising line of research is to consider how much we can gain from LDPC codes while restricting the level of non locality allowed.It has been shown that there is a connection between the distance of the code and the connectivity [26,47], and that limiting the non locality will limit the attainable distances [66].This may however be a sacrifice that is necessary to see quantum LDPC codes physically implemented.
The other main contribution to the overhead comes from the ancilla systems used to make logical measurements.As we established, in order to maintain the distance of our code during the code deformation, we require that the ancilla systems have a height of at least d.Lowering this overhead while maintaining the required distance may be achieved using a technique established in Ref. [49].In this reference Hastings proposes increasing the expansion of the graph G L, and as a result the number of layers in the ancilla system would only need to be constant in size, as opposed to scaling with d.In order to implement this approach, we would require a deterministic method for creating graphs with sufficient expansion.While constructions for Ramanujan graphs with high expansion exist, further work is needed to see how these can be integrated into our scheme.We also note that it is unclear that this proposal will offer a significant overhead improvement at the scales that we have considered, and instead give improvements to the resource cost of quantum computing at larger scales.Furthermore, it will be worthwhile to investigate the time-overhead of fault-tolerant gates.The discovery of ancilla systems that enable code deformations by single-shot error correction [33,67,68] would permit measurement-based gates in constant time, leaving open the tantalising prospect of fault-tolerant quantum computing with constant-space and constant-time overhead.

IV. MATERIALS AND METHODS
We now restate and prove Theorem 1.
Theorem 1.Let C = n, k, d be a quantum CSS LDPC code and let L be a logical operator in C. Let C merged be the code obtained after making a measurement of L in C using an ancilla system C anc .Then C merged , when treated as a subsystem code, has distance ≥ d as long as the ancilla system has at least 2d − 1 layers.
Proof.We prove the theorem for the simple case where L is an X logical operator.Let us also assume without loss of generality that L does not contain any X type stabilizers as a subset of V L [1].The proof of more general logical parity measurements can be obtained with the methods we develop here with the most simple case.
Let Z be a Z logical operator contained entirely in C. First note that the X stabilizers in C are left unchanged in C merged and so Z must still have weight at least d on the physical qubits in G merged \G anc .We now need to show . Equivalent logical operators.The three curves here all represent equivalent X logical operators.The dark curve is an X logical operator on the original code C. The other two logical operators are obtained by successive application of X stabilizer generators in the dual layers of the ancilla system.In particular, after each application of X stabilizer generators in a dual layer, the logical operator has support on the same dual layer since any subset of X stabilizer generators in a dual layer are independent.
that the application of a gauge operator and an arbitrary stabilizer does not reduce the weight of Z below d.We are only interested in Z type stabilizers and gauge operators as X type stabilizers and gauge operators will The Z gauge operators when we measure an X logical operator are cycles in G T Z [1].As discussed above, these cycles can be cleaned entirely into C.These gauge operators are stabilizers of C, and since the support of Z in C remains the same in C merged , the application of a stabilizer of C will not reduce the weight of Z below d since the weight of a logical operator is lower bounded by d even with arbitrary stabilizer generators applied.
Let us now check that we do not change the weight of any X logical operators by adding the ancilla system.Let X = L be an X logical operator contained entirely in C. We must show that the weight of X remains above d with arbitrary application of X-type stabilizers and gauge operators.Let Xg be an arbitrary, non-trivial X gauge operator and let Zg be any Z gauge operator that anti-commutes with Xg .Then X Xg anti-commutes with Z g and so by Lemma 3 X Xg has weight at least d, even with application of arbitrary stabilizers.
The last case to consider is when no gauge operators are applied and we apply arbitrary stabilizers.This is only relevant if X intersects with L at some physical qubits.In this case we can apply an X generator in the dual layer G T L [1] which will clean L from the qubits at the intersection of L and X onto the equivalent qubits in the first primal layer of the ancilla system G L [2].Doing this will also create non-trivial support on the first dual layer G T L [1], see Fig. 8.To see why this is the case suppose there is a subset of X generators in C T L [1] such that their product gives trivial support on V T L [1].That is, there is a subset A T of C T L [1] such that each qubit in V T L [1] is connected to an even number of generators in A T .This implies there is a subset A of V L [1] such that each check node in C L [1] is connected to an even number qubits in A. This means that if we apply X to each physical qubit in A to form the operator XA then Xa commutes with each Z generator in C L [1] and hence XA is an X logical operator in C, but we have assumed that L contains no logical operators as a subset and hence there is no such set A T that gives trivial support on V T L [1].Note in the general case we can have subsets of V L [1] that support a logical operator, however applying all the equivalent stabilizers in the first dual layer of G anc will create support on the qubit connecting the two ancilla systems.
The above argument tells us that we can clean L from qubits in V L [1], replacing them with qubits in V L [2] while creating non-trivial support on V T L [1].Now we can continue this process to clean L from qubits in V L [2] to qubits in V L [3] in the support of L while creating non-trivial support on V T [2], and so on.For each qubit in the intersection of X and L that we cleaned from L, there will always be an equivalent qubit in the primal layer G L[j], until we reach the top boundary, at which point there will be support on at least one physical qubit in V L[j], and so the weight of X will always be at least d.

ACKNOWLEDGMENTS
We gratefully acknowledge David Poulin for early discussions on using quantum LDPC codes for computation.We thank Andre Saraiva, Michael Vasmer, and Paul Webster for discussions and comments on the manuscript.This work is supported by the Australian Research Council via the Centre of Excellence in Engineered Quantum Systems (EQUS) project number CE170100009, and by the ARO under Grant Number: W911NF-21-1-0007.Competing Interests: The authors declare that they have no competing interests.Author contributions: All authors, LZC, IHK, SDB and BJB conceived of the methodology and derived the main results.All authors contributed to the writing of the manuscript.Data availability: All data needed to evaluate the conclusions of this work are present in the paper.

FIG. 2 .
FIG. 2. Measurement of a logical X operator of the code C. (a) Bipartite subgraph G X of the Tanner graph of C on the support of X. Black nodes are the variable nodes corresponding to qubits in the support of X. Red nodes are the check nodes corresponding to Z-type stabilizers in C that act on qubits in the support of X.(b) The dual graphG T = (V T X , C T X , E T X ) of the logical X in (a).There is a one-to-one mapping between the X-type generators and the qubits in (a), and the qubits and the Z-type generators in (a).(c) Measurement of X using the ancilla system Ganc = G merged \G.The Tanner graph Ganc is constructed by taking alternating layers of the subgraph G T X in (b) and the subgraph G X in (a).The vertical edges are the set Eextra, which connect adjacent layers.The product of the X generators gives the logical X and hence the product of the measurement results for each X generator gives the measurement result of the logical X.After merging the codes and measuring X we then split the codes by measuring the stabilizers for C and measuring the qubits in Canc in the Z basis, returning us to the original code space.
[k] and b T [k] with a T [k]b T [k] for 1 ≤ k ≤ r and create weight-two Z stabilizer generators acting on a[j] and b[j], for 2 ≤ j ≤ r to fix the degrees of freedom created from merging the stabilizer generators.Similarly, we replace we replace the generators a T [k] and b T [k] with a T [k]b T [k] and create weight-two X stabilizer generators acting on a [j] and b [j].Since there are always an even number of intersections, non-commuting stabilizers can always be paired up.

2 FIG. 6 .
FIG.6.Distance of C merged .(a) Suppose we have a code created by adjoining two surface code patches at the corner and we wish to measure the logical operator X1X2 along the top boundary.In (b) the ancilla system used for the measurement only has one layer, creating a low weight logical between the top and bottom smooth boundaries.To mitigate this we must use an ancilla with d layers, as in (c).This ensures that the distance of the code is preserved during the merge.It is worth noting that it may not always be the case that d layers are needed to preserve the distance, and for certain codes it may suffice to only use one layer.
not reduce the weight of a Z logical operator.Let us consider what happens when we apply the Z generators C[1] ⊂ G L[1].These generators are identical to the original generators from C with the addition of one extra physical qubit from V T [1] ⊂ G T L [1] in each generator.Hence, after applying these generators Z will still have weight at least d on the physical qubits of G merged \G anc .Stabilizer generators C[k] for k ≥ 2 can only increase the weight of the logical operator beyond d, as they have no common support with G merged \G anc .

TABLE I .
Overhead estimates.