Logical Error Rates of XZZX and Rotated Quantum Surface Codes

Surface codes are versatile quantum error-correcting codes known for their planar geometry, making them ideal for practical implementations. While the original proposal used Pauli <inline-formula> <tex-math notation="LaTeX">$\boldsymbol {X}$ </tex-math></inline-formula> or Pauli <inline-formula> <tex-math notation="LaTeX">$\boldsymbol {Z}$ </tex-math></inline-formula> operators in a square structure, these codes can be improved by rotating the lattice or incorporating a mix of generators in the XZZX variant. However, a comprehensive theoretical analysis of the logical error rate for these variants has been lacking. To address this gap, we present theoretical formulas based on recent advancements in understanding the weight distribution of stabilizer codes. For example, over an asymmetric channel with asymmetry <inline-formula> <tex-math notation="LaTeX">$A=10$ </tex-math></inline-formula> and a physical error rate <inline-formula> <tex-math notation="LaTeX">$p \to 0$ </tex-math></inline-formula>, we observe that the logical error rate asymptotically approaches <inline-formula> <tex-math notation="LaTeX">$p_{\mathrm {L}} \to 10~p^{2}$ </tex-math></inline-formula> for the rotated <inline-formula> <tex-math notation="LaTeX">$[[{9,1,3}]]$ </tex-math></inline-formula> XZZX code and <inline-formula> <tex-math notation="LaTeX">$p_{\mathrm {L}} \to 18.3~p^{2}$ </tex-math></inline-formula> for the <inline-formula> <tex-math notation="LaTeX">$[[{13,1,3}]]$ </tex-math></inline-formula> surface code. Additionally, we observe a particular behavior regarding rectangular lattices in the presence of asymmetric channels. Our findings demonstrate that implementing both rotation and XZZX modifications simultaneously can lead to suboptimal performance. Thus, in scenarios involving a rectangular lattice, it is advisable to avoid using both modifications simultaneously.


I. INTRODUCTION
The Quantum Internet has emerged as a promising paradigm with the potential to revolutionize various fields, including computation, secure communication, and enhanced sensing.For example, it will enable the realization of distributed quantum computers which could solve complex problems more efficiently than classical computers.However, quantum systems are highly susceptible to errors and decoherence, which pose significant challenges to realizing reliable quantum computation and quantum networks [1]- [7].Quantum errorcorrecting codes play a crucial role in preserving and protecting quantum information and are therefore fundamental in quantum computation, quantum memories, and quantum communication systems [1], [2], [8]- [13].
Among the different types of quantum error correcting codes (QECCs), surface codes have gained significant attention, as they are compatible with 2D architectures, and also require error syndrome measurements which are inherently among The authors are with the Department of Electrical, Electronic, and Information Engineering "Guglielmo Marconi" and CNIT/WiLab, University of Bologna, 40136 Bologna, Italy.E-mail: {diego.forlivesi2,lorenzo.valentini13, marco.chiani}@unibo.it.Work supported by Ministero dell'Università e della Ricerca, PNRR project PRIN n. 2022JES5S2.few close qubits.The original surface codes, which pertain to the class of stabilizer codes, adopt generators composed of three or four Pauli operators, each generator using one Pauli type only [14], [15].Variants of the original surface codes have been proposed.In the so-called "rotated" surface codes, some qubits are removed, so that the generators have only two or four Pauli operators, maintaining the same minimum distance [16].Another variant consists in allowing to mix Pauli type operators within each generator, in the so-called XZZX variant [17].
Implementations of surface codes with minimum distance three have been reported recently in [18] and [19].In these works, 17 physical qubits (9 data qubits and 8 qubits for syndrome measurements) in a superconducting circuit have been used to realize a rotated squared surface code, employing stabilizer generators of type XX, ZZ, XXXX, ZZZZ.The error correction is performed with a minimum weight perfect matching (MWPM) algorithm and is repeated to preserve one logical qubit from decoherence.In [20] a larger surface code is realized, with superconducting devices used to implement a 49 physical qubits code (25 data qubits and 24 qubits for syndrome measurements) with minimum distance five.This code slightly outperforms the distance three surface code, demonstrating a possible path toward scalable quantum error correction.The architecture adopted in [20] is a rotated squared surface code with XX, ZZ, and XZZX generators.
The theoretical performance of surface codes has been investigated in the literature mainly in terms of accuracy threshold over symmetric channels for fault-tolerant quantum computing [14], [15], [17], [21].In [22], [23], an analysis using the MacWilliams identities was proposed to derive theoretical bounds for quantum error detection.Recently, a new methodology has been introduced to analyze the performance of generic stabilizer codes, starting from the MacWilliams identities to derive the logical errors weight distribution [24].The method allows to derive closed-form formulas for the logical error rate vs. physical error rate, for both the depolarizing channel, as well as for asymmetric channels.These are channels where errors described by Pauli X, Z, and Y operators may have different occurrence probabilities [25]- [28].
This article aims to provide a theoretical analysis of the logical error rate for rotated and XZZX quantum surface codes, which are the most investigated in practical implementations [18]- [20].The key contributions of the paper can be summarized as follows: MacWilliams identities; • we provide a set of coefficients that can be used to obtain the logical error probability without implementing the decoder, for the main surface codes.This feature can be used at higher level in the protocol stack to aid the design of Quantum Internet; • we compare the original surface codes with the rotated and/or XZZX variants, highlighting the differences and advantages over the depolarizing channel and over asymmetric channels; • we show that the combined use of rotation and XZZX variants in rectangular lattice leads to a degradation in performance.We will focus in particular on the [[9, 1, 3]], the [ [25,1,5]], and the [[15, 1, 3/5]] rotated surface codes, with and w/o the XZZX variant, and compare them with the original [ [13,1,3]], the [[41, 1,5]], and the [[23, 1, 3/5]] surface codes.In this work, we have included the shortest examples for both symmetric and asymmetric variants of surface codes.This decision is driven by the current limitations in quantum computing, which only supports a restricted number of physical qubits.Nonetheless, our analytical approach is general and, in principle, can be applied to derive the logical error rates of arbitrarily large surface codes.
This paper is organized as follows.Section II introduces preliminary concepts and models together with some background material.In Section III we analyze rotated, XZZX, and rotated XZZX surface codes, obtaining the WE for the undetectable errors from MacWilliams identities and applying it to the evaluation of the logical error rate.In Section IV we provide the error rate comparison and discuss the effect of rotation on rectangular surface lattices.

A. Quantum Stabilizer Error-Correcting Codes
We indicate with [[n, k, d]] a QECC with minimum distance d, that encodes k logical qubits |φ⟩ into a codeword of n data qubits |ψ⟩, allowing the decoder to correct all patterns up to t = ⌊(d − 1)/2⌋ errors.A complete decoder will also correct some patterns of more than t errors.The Pauli operators are indicated as X, Y and Z.Using the stabilizer formalism, each code is represented by n − k independent and commuting operators G i ∈ G n , called stabilizer generators (or simply generators), where G n is the Pauli group on n qubits [2], [8].The subgroup of G n generated by all combinations of the G i ∈ G n is a stabilizer, indicated as S. The code C is the set of quantum states |ψ⟩ stabilized by S, i.e., satisfying S |ψ⟩ = |ψ⟩ , ∀S ∈ S, or, equivalently, G i |ψ⟩ = |ψ⟩ , i = 1, 2, . . ., n − k.The generators have great importance in quantum error correction since they describe which measurements on the quantum codewords do not perturb the original quantum state.This enables the possibility to perform quantum error correction exploiting error syndrome decoding [2].The logical operators of a stabilizer code are those that commute with the stabilizer group but are not contained in it.Hence, these operators map a codeword into a different one.The knowledge of the logical operators' structure permits the evaluation of the channel errors that, together with the decoding correction, cause a decoding failure.As shown in [24], the logical error rate thus depends on the stabilizer logical operators WE and on the employed decoder (e.g., based on the MWPM algorithm).We remark that the actual logical error rates attainable by a complete decoder, like the MWPM, are beyond the conventional bounded distance performance.
Specifically, we assume a quantum channel characterized by the errors X, Z or Y occurring with probabilities p X , p Z , and p Y , respectively.The probability of a generic error on a qubit is p = p X + p Z + p Y .
Among these quantum channels, two important models are the depolarizing channel where p X = p Z = p Y = p/3, and the phase-flip channel where p = p Z , p X = p Y = 0. We characterize an asymmetric channel by the asymmetry parameter A = 2p Z /(p − p Z ).In this way, varying the asymmetry A we can evaluate the performance of channels having a prevalent error type (i.e., Z), passing from the depolarizing channel (A = 1) up to the phase-flip channel (A → ∞).Errorcorrecting codes can also be designed to exhibit asymmetric behaviors with respect to X, Y and Z Pauli errors [26], [27].We adopt the notation [[n, k, d X /d Z ]] for asymmetric codes able to correct all patterns up to t X = ⌊(d X − 1)/2⌋ Pauli X errors and t Z = ⌊(d Z − 1)/2⌋ Pauli Z errors.
To evaluate the performance beyond the nominal error correction capability of the code, we define f j (i, ℓ) as the fraction of errors of weight j, with i Pauli Z and ℓ Pauli X errors, which are not corrected by a given decoder.Hence, the error probability of a QECC, also indicated as logical error rate, can be written as [24] where is the probability that an error of weight j is correctly decoded.Note that f j (i, ℓ) depends only on the particular decoder implementation, while β j also depends on the quantum channel parameters.In the following, we will consider channels with asymmetry A, so that (2) can be rewritten For p ≪ 1 and symmetric codes, the logical error rate is well-approximated by while for asymmetric codes we have where e g = min {t X , t Z } and e Z = max {0, t Z − e g } for a [[n, k, d X /d Z ]] code [27].Thus, for a symmetric quantum error correcting code with t = ⌊(d − 1)/2⌋, once we have the values of f t+1 (i, ℓ), by using (3) we can write the analytical performance expression (4) which is valid over an asymmetric channel with arbitrary asymmetry A, including the depolarizing channel (A = 1).Similarly, for asymmetric codes with correction capability e g and e Z , once we have f eg+1 (i, ℓ) and f eg+eZ+1 (i, ℓ) we can evaluate the performance over arbitrary asymmetric channels by using (3) and ( 5).
The values of f j (i, ℓ) of interest can be obtained, for the surface codes analyzed in this paper, with limited complexity by a decoder error patterns search, as illustrated in Section IV.Equivalently, we can derive the values of β j of interest starting from the knowledge of the logical operators weight distribution.To this aim, we define the undetectable errors weight enumerator function, for a [[n, k, d]] quantum code, as where L w is the number of undetectable errors (logical operators) of weight w [24].This polynomial can be easily computed starting from the code's generators by using the MacWilliams identities [24].From it, we can evaluate the errors compatible with the exact number of logical operators of a certain weight w, leading to the β j .

III. QUANTUM TOPOLOGICAL PLANAR CODES
In this section, we analyze some topological codes which can be mapped into planar structures and measured using local operations (i.e., error correction is performed letting interact qubits which are physically nearby).These codes are of practical interest for applications where system scalability is required.In the following, we provide analytical tools that can be used to reproduce the performance of such codes in any polarizing quantum channel (i.e., given p X , p Y , and p Z ).
In Fig. 1a-d we show the actual physical structure of some planar codes.For example, in Fig. 1a we depict the [ [13,1,3]] surface code.Here, a codeword is constituted by n = 13 qubits, represented with circles.The error syndrome is extracted by measuring the stabilizers of the code [8].In particular, the measurement is performed by letting interact codeword qubits with auxiliary qubits, usually referred as ancillas, which are indicated with squares in the figure [2].After the interaction, by measuring the ancilla qubits we obtain a syndrome composed by n − k = 12 bits.Maximum likelihood decoders can be implemented using lookup tables.
However, due to the structure of these codes, suboptimal decoder based on the MWPM algorithm have been proposed [32].This decoder builds a graph where vertices correspond to error ancillas, and edges are weighted according to the number of qubits between them.Then, it finds the shortest path between each couple of ancillas.For example, considering the code represented in Fig. 1a, if the error Z 7 occurs, A 6 and A 7 detect an error in their neighbourhood.Finally, connecting these two ancillas the MWPM is able to localize the error.Due to degeneracy of these quantum codes, the decoder based on MWPM is able to guarantee the error correction capability t and is also able to correct some error patterns of weight greater than t.
Before proceeding with the analysis of topological codes, we introduce another graphical notation and some terminologies to describe them.In fact, these codes are usually represented in terms of a planar lattice where vertices and cells are called sites and plaquettes, respectively.In Fig. 1eh we sketch the graphical representation which highlights sites and plaquettes.For the sake of clarity, in Fig. 1e a site named A 2 is highlighted in green, while a plaquette named A 10 is highlighted in blue.Sites and plaquettes represent ancilla qubits in this notation and therefore perform Pauli measurements on the adjacent edges which stand for physical qubits and are represented with circles in the figure.Moreover, edges (i.e., qubits) which resides on the boundary of the lattice can be categorized as smooth and/or rough.They are defined as smooth, when the perpendicular ancilla measurement to the boundary is a Pauli X measurement, and are defined as rough, when the perpendicular ancilla measurement to the boundary is a Pauli Z measurement.For example, in Fig. 1e the boundary qubit D 2 is rough and D 3 is both rough and smooth (above is rough and on the right is smooth).This notation is used during the decoding procedure when ghost ancillas (i.e., virtual ancillas not physically implemented) are employed.

A. Surface Codes
In this subsection we describe the original surface codes and revise some recent results on their performance [24], which will serve for the comparison with the surface codes variants.Surface codes are topological codes that can be mapped into a planar rectangular d X × d Z lattice.For example, in Fig. 1e is shown a lattice with 2 edges, which correspond to physical qubits [33].This structure has d • (d − 1) sites and d • (d − 1) plaquettes, which are associated with X generators, and Z generators, respectively.This means that each ancilla measurement uses only operators of one type, Z or X.Moreover, due to the physical structure of the code, generators in the inner part of the lattice are fourqubits operators, while along the boundaries we have threequbits operators.For this reason, they can be interpreted also as quantum low density parity check (QLDPC) codes [12], [30].
As regards logical operators, Z L can be seen as a tensor product of Z's acting on a chain of qubits running from a rough edge to one at the opposite side of the lattice.In a The first row represent the actual code structure with data qubits (circles) and ancillas (squares).Z measurements are depicted in blue, while X measurements are depicted in green.The second row is a simplified representation of the lattice with sites and plaquettes.
similar way, the X L will be the tensor product of X's on a chain running from a smooth edge to one at the other side of the dual lattice.In the case described so far, the lattice has a square shape, as shown in Fig. 1a/e which represents the smallest surface code, with parameters [ [13,1,3]].Symmetric surface codes with higher distances can be easily built by adding the same number of columns and rows to this lattice.In this way, it is also possible to create asymmetric surface codes by adopting a rectangular lattice.For instance the [[23, 1, 3/5]] can be obtained by adding two additional columns to the [ [13,1,3]].By doing so, the shortest Z L logical operator will be made of five Z Pauli operators, while the shortest X L will still consist of three X Pauli operators.Indeed this code has distances d X = 3 and d Z = 5.In general, asymmetric surface codes are characterized by parameters For the [ [13,1,3]] surface code the L(z) has been computed in [24], obtaining L(z) = 6z 3 +24z 4 +75z 5 +240z 6 +648z 7 + 1440z 8 + 2538z 9 + 3216z 10 + 2634z 11 + 1224z 12 + 243z 13 .From this, we see that there are 6 logical operators of weight w = 3.Thus, for the evaluation of β 2 we can restrict our analysis to error patterns of weight 2 combined with a single qubit error correction operator.Since the [ [13,1,3]] surface code logical operators with w = 3 are all composed by three X or three Z by construction, we have that channel errors triggering a failure have to be composed by two X or two Z.Note that an error pattern of the type XY has two X operators, due to the fact that Y can be decomposed as an X and a Z operator.Then, for each logical operator, there are 3 2 = 3 possible ways to have 2 errors distributed in 3 possible locations (i.e., the locations given by the logical operator).Furthermore, when the logical error under examination is X L (Z L ), the error patterns that could generate it are in the form of XX (ZZ), XY (ZY ), and Y Y .This results in 2  2 + 2 1 + 2 2 = 4 possible error configurations.Then, we have in total 6 • 3 • 4 error patterns of weight 2 which produce logical operators of weight 3 (i.e., a decoding failure).
The total number of logical operators with w = 4 are L 4 = 24, but 8 of them are considered implicitly.In particular, they are taken into account when considering that error patterns of the type Y Y cause logical operators of weight w = 3 [24].The remaining operators are 8 Z L composed only by Z, and 8 X L composed only by X. Logical operators with w = 4 are more difficult to treat due to the fact that they could share j or more Pauli operators.To simplify the discussion we consider pairs of logical operators.Let us consider for example the logical operator depicted in Fig. 2i, For a given operator with w = 4, we have 4  2 = 6 possible patterns of j = 2 Pauli errors.However, we can see that two of these six configurations never cause the logical operator In particular, Z 4 Z 6 would be corrected due to the degeneracy of the code, while Z 2 Z 3 would cause a different logical operator Z L = Z 1 Z 2 Z 3 (a configuration that we have already counted using w = 3).Hence, we have to subtract these two patterns from the total of 4 2 = 6.In addition, we have to consider that Z 2 Z 4 produce the same error syndrome of Z 3 Z 6 (the same happens for Z 2 Z 6 and Z 3 Z 4 ).Since the decoder acts in a deterministic way, only one of these two must be counted.However, Z 3 Z 6 could trigger an error also for Z L = Z 3 Z 5 Z 6 Z 7 .In the end, we have that each of the 8 pairs of logical operators with w = 4 can be caused only by 3 error patterns.We conclude that β 2 for the [ [13,1,3]] code with MWPM decoding over a depolarizing channel (A = 1) is

(g) (h)
This result was derived in [24], but notably there are no analyses in the literature for the rotated variant as well as the XZZX surface codes.Hence, in the next subsections we start from the undetectable error weight enumerator L(z) and we provide new expressions for the rotated and XZZX codes.

B. Rotated Surface Codes
These codes are obtained starting from standard surface codes by removing (d − 1) 2 codeword qubits [16].Then, the structure is usually rotated by 45 • for graphical representation.For this reason, literature refers to these as "rotated" surface codes, even if from a coding theory perspective we could call them "punctured" surface codes.This procedure can be applied also to asymmetric codes, by removing (d X − 1) • (d Z − 1) codeword qubits from the asymmetric surface code, leading to a Let us take as an example the [ [13,1,3]] original surface code.After the puncturing, it becomes the [[9, 1, 3]] rotated surface code depicted in Fig. 1c/g.This is the code that has been implemented in [18], [19].By following the MacWilliams identities approach [24] we derive the WE function for the [[9, 1, 3]] rotated surface code as In this case, we have 24 logical operators of weight w = 3 and zero of weight w = 4.However, as we did for the original surface code when w = 4, we consider only 16 out of 24 logical operators, due to the fact that we are implicitly counting the 8 operators having both Pauli Z and X into the 16 ones.In fact, focusing for example on Y 1 Y 2 Z 4 for the code in Fig. 2e, we observe that X 1 X 2 is corrected by the decoder, resulting in the logical operator Let us focus on the 12 logical operators Z L of weight w = 3, and, in particular, on the eight constituted of only Pauli Z operators, reported pictorially in Fig. 2a-f.As shown in Section III-A, we are interested in the number of Z errors of weight j = 2 that can cause these logical operators.However, we can see that different logical operators share common patterns of Z errors with weight j = 2 and must be considered only once.For instance, the operator in Fig. 2a can be caused by three different patterns of Z errors: Z 4 Z 5 , Z 4 Z 6 and Z 5 Z 6 .In particular, Z 4 Z 5 can cause either (a) or (d), while Z 5 Z 6 can lead either to (a) or to (c), depending on the MWPM implementation.Specifically, each logical operator of the kind (a-d) can be caused by two patterns of Pauli errors of weight j = 2 which are in common with others.On average, each of these four operators can be caused by 3 2 − 1 = 2 different patterns of errors of weight j = 2.As regards the four logical operators in Fig. 2e and Fig. 2g, they have just one pattern of errors of weight j = 2 in common with each other.Hence, considering them in pairs as done in Section III-A, we must take into account 2 • 3 2 − 1 = 5 different pattern of errors per couple.Note that, these eight Z L logical operators can be caused by ZZ, ZY , and Y Y errors, since the additional X L errors are corrected by the code.Therefore, for the [ [9,1,3]] rotated surface code with MWPM decoding over the depolarizing channel we have It is also possible to derive β 2 over a phase flip channel, observing that in this case we have only Z Pauli errors.This leads for the same [[9, 1, 3]] rotated surface code over a phase flip channel to From this analysis we observe that the rotated surface [[9, 1, 3]] code has a worst β t+1 parameter compared to the original [ [13,1,3]] code.However, it has a smaller number of qubits that can be affected by noise and, therefore, looking at β t+1 is not sufficient to say which is optimal in terms of logical error rates.In general, to find which is the best among two codes C 1 and C 2 we can compute the ratio between their asymptotic approximations From f j (i, ℓ) we can evaluate the β t+1 (A) of the codes through (3), which allows us to analytically study the function r against A for comparative performance analysis.Considering as C 1 the [ [13,1,3]] code and as C 2 the [ [9,1,3]] one, we obtain from ( 7) and ( 9) for the depolarizing channel that r = 1.18 > 1, meaning that C 2 is better than C 1 over that channel.Note that, in this case, r is independent of p, indicating that the rotated [ [9,1,3]] code is uniformly better than the original [ [13,1,3]] surface code.

C. XZZX Surface Codes
XZZX codes have the same structure as surface codes, i.e., the same amount of codeword qubits, ancillas, and generator weights, but with a different composition of the generators [17].While in the original surface codes, each generator is composed only by X or Z, in XZZX codes the generators inside the lattice are of the kind XZZX, and along smooth and rough boundaries we have XXZ and ZZX generators, respectively.This can be also interpreted as a Hadamard rotation on some qubits of the lattice.For example, if we apply the Hadamard rotation to D 4 , D 5 , D 9 , and D 10 in Fig. 1a, we obtain the XZZX code of Fig. 1b.Since in surface codes half of the generators are composed of X operators while the other half of Z operators, errors on adjacent qubits produce horizontal or vertical error chains for both X and Z Pauli operators.On the contrary, XZZX codes have an intrinsic symmetry: X errors can align only in vertical directions, while there are only horizontal Z error chains.Due to this structure, we show that these codes work better than surface codes over asymmetric channels.
We can compute for the [ [13,1,3]] XZZX code L(z) = 6z 3 + 24z 4 + 75z 5 + 240z 6 + 648z 7 + 1440z 8 + 2538z 9 + 3216z 10 + 2634z 11 + 1224z 12 + 243z 13 . ( As anticipated, this is the same as that obtained for the original surface code.Indeed, the logical operators have the same structure but they are composed of different Pauli operators. In particular, notice that, even if the logical operators differ for some Pauli operators with respect to the surface codes, a decoder will make its decision based only on the resulting syndrome.As a result, over the depolarizing channel and for a MWPM decoder, for the XZZX variant of the [ [13,1,3]] code, we still have β 2 ≃ 0.76, as can be checked by deriving it in the same way as (7).
Moving to the analysis over asymmetric channels, we remark that in the [ [13,1,3]] surface code the 16 logical operators which produce unique errors are composed by only Z or only X operators [24], while, for the [ [13,1,3]] XZZX code they consist of both Pauli operators.As a consequence, some of these operators occur only in the presence of both Z and X errors.Considering an asymmetric channel where X errors are less probable than Z errors, it follows that logical operators of the kind shown in Fig. 2g are, on average, less probable to occur.This is the reason behind the XZZX performance advantage over asymmetric channels.For example, letting A → ∞ (i.e., assuming phase flip channel), we have four error patterns of the type ZX that we have to exclude, since X errors cannot occur on this channel.Hence, over the phase-flip channel, the XZZX variant leads to This shows how the error correction capability of XZZX codes increases with the asymmetry of the channel.More results will be illustrated for other values of A in Section IV.

D. Rotated XZZX Codes
Similarly to the XZZX, these codes can be constructed starting from the rotated surface code (see Fig. 1c) and then letting the ancillas measure Z in the horizontal direction, and X in the vertical direction (see Fig. 1d).Thus, for a symmetric structure, we obtain a [[d 2 , 1, d]] error correcting code.For symmetric structures, this procedure allows reducing the number of physical qubits without changing the distance of the code.For example, the [[9, 1, 3]] and the [ [25,1,5]] rotated XZZX codes are those implemented as described in [20].In this way, for a bounded distance decoder that corrects error patterns with up to t errors, we have that rotated codes are better in terms of performance, due to the reduction of the codeword length.However, for complete decoders, this is not always true due to the fact that, as shown in (11), the performance gap depends on both the codeword length and the values of β j .We can compute for the [ [9,1,3]] rotated XZZX code the WE function obtaining In red are represented errors introduced by the channel, in yellow the ancilla that measures "-1" during the syndrome extraction, and in orange the error correction applied by the MWPM decoder when the current highlighted ancilla is given as input.(a) A particular ZZ error producing a logical error when decoded (unresolvable error).(b) A particular XX error producing a logical error when decoded.
which, as expected, is the same as the non-XZZX version (8).For the depolariziong channel, the resulting β 2 = 5/9 is, therefore, equal to (9) computed for the [[9, 1, 3]] rotated surface code.Thus, the XZZX variant does not change the performance over the depolarizing channel.However, the codes perform differently on asymmetric channels.In fact, let us now consider the 18 configurations of errors with weight w = 2 of ( 15), which, in the rotated surface code, correspond to only Z Pauli errors.As we did in Fig. 2 for non-rotated codes, it can be shown that 10 of these configurations include one X Pauli error in the case of the [[ ] rotated XZZX code.As a consequence, this code has a great advantage over asymmetric channels.For example, we compute for it over a phase flip channel, to be compared with β 2 = 1/2 of the non-XZZX code given in (9).Finally, we could be tempted to apply the XZZX variant to rectangular rotated surface codes.However, it is easy to see that this will equalize the d X and d Z distances, so losing correction capabilities.In fact, if we start from an asymmetric structure of dimension . This is due to some error patterns which reduce the error correction capability of the starting code.We report in Fig. 3a an example where, starting from the [[15, 1, 3/5]] rotated code, we apply the XZZX variant.Here we show a decoding error caused by an ZZ error pattern.Since a weight two pattern is not corrected, the code distance is not d Z = 5 for Z errors.In Fig. 3b we also show a failure caused by an XX error, which confirms that this asymmetric lattice with the XZZX variant has a symmetric distance d = 3.In general, this is the reason why the surgery on the lattice which transforms a squared structure to a rectangular one is not able to improve the distance on rotated XZZX codes.

IV. NUMERICAL RESULTS
1) Error patterns search via decoding: In Tab.I we report the percentage of non-correctable errors f j (i, ℓ) (i.e., composed by j Pauli operator, i of type Z and ℓ of type X) for some surface, XZZX, rotated surface, and rotated XZZX codes.These values have been evaluated by enumerating the error patterns of interest and running the MWPM decoder.To this aim, we built a part of the decoder using the Lemon C++ library [34], which provides an efficient implementation of graphs and networks algorithms.As anticipated, we can observe from Tab.I that each asymmetric code is able to correct all patterns of ZZ, apart from the rotated XZZX code using a rectangular lattice of dimension 3 × 5 which has a value of f 2 (2, 0) ̸ = 0. Note also that both the [ [9,1,3]] surface and XZZX codes are not able to correct any error patterns of the kind Y Y , being f 2 (0, 0) = 1.The table also highlights that, surface codes always correct error patterns composed by i Pauli Z and ℓ Pauli X, for all i, ℓ ≤ t.This is due to the fact that effective logical operators have only one kind of Pauli operator, which is no longer true in the case of XZZX codes.
By examining Tab.I, it becomes apparent that the rotated XZZX surface code on a rectangular lattice exhibits a degradation in code distance.Specifically, without the application of the XZZX variant, the code is characterized as [ [15, 1, 3/5]], but upon applying the XZZX variant, it becomes a [ [15,1,3]] code.Notably, in this specific configuration, there is no enhancement of asymmetric error correction capability through the utilization of XZZX.
Finally, we stress the fact that by using these tabular values, we can write analytical expressions for the code performance.This result can be used to analyze and design complex systems without implementing the decoder.For example, the logical error rate of a rotated XZZX [ [9,1,3]] code tends for small p to Similarly, for the original [ [13,1,3]] surface code we have For example, for A = 10 we obtain p L → 10p 2 for the rotated [ [9,1,3]] XZZX code and p L → 18.3p 2 for the [ [13,1,3]] surface code.
2) Asymptotic approximation and bounded distance decoder: In Fig. 4 we report the asymptotic approximations computed using (16) for the [[9, 1, 3]] rotated XZZX code, over the depolarizing and phase flip channels.We notice that the estimates provided in (4) and ( 5) closely align with the results obtained from simulations using MWPM decoding.This shows how the performance of an error-correcting quantum code with a complete decoder can be accurately described in the typical region of interest, i.e., p < 0.1, where the code is actually providing an improvement compared to the uncoded case.Moreover, we show in the same figure the bounded distance decoding performance, obtained by considering β j = 0, for j > t = ⌊(d − 1)/2⌋.The bounded distance decoding is unaffected by the asymmetry parameter.For this reason, it is not able to describe the advantage of XZZX  codes over asymmetric channels.Specifically, the gap between bounded distance and MWPM decoding is due to the fact that topological codes are able to correct a large number of errors of weight w ⩾ t+1.The [ [9,1,3]] XZZX code has the greatest error correction capability over the phase flip channel, where it can exploit its intrinsic symmetries which make one kind of Pauli error to align always in the same direction.
3) Comparison of topological planar codes: In Fig. 5 we depict some XZZX and surface codes over a channel with asymmetry A = 10.Among the codes with distance d = 3, the rotated [ [9,1,3]] XZZX code is to be preferred due to its good performance by using the lowest number of qubits.This shows that the rotation technique (i.e., ad-hoc puncturing of the code) is able to obtain an increase of the coding rate without deteriorating too much the performance.In some cases, the puncturing even improves it.As expected, the combination of a rectangular lattice, rotation, and XZZX deteriorates the performance, and here it is shown by the fact that the [ [15,1,3]] rotated XZZX code (derived from the [[15, 1, 3/5]] rotated code) achieves the same performance of the shortest planar code (i.e., the [[9, 1, 3]]).Moving to lower coding rates, well-design rectangular lattices show a higher Z error correction capability.For this reason, they represent a good compromise between performance and codeword length.On the other hand, code with large distance d as the [ [25,1,5]] and the [[41, 1, 5]] show the best performance.Finally, it is visible in the plot how the code distance influences the slope of the performance curve.For asymmetric lattices under the asymptotic condition p ≪ 1 we have that when A < ∞ they have the same slope of d = 3 codes, while for A = ∞ the same slope of d = 5 codes.4) Effect of channel asymmetry on topological planar codes: In Fig. 6, Fig. 7, and Fig. 8 we show how the logical error rate is affected by the channel asymmetry A, for all considered surface codes.To this aim, we fix p = 5 • 10 −3 to be in the p ≪ 1 regime.In Fig. 6 we report the logical error rate for topological planar codes with d = 3. they have the same code distance the relation between them is independent by the chosen p.As expected, we have that XZZX technique does not provide any advantage when A = 1, while it shows a clear performance improvement in the presence of channel asymmetries.More than the performance boost itself, it is worth noting that they do not deteriorate when A is increasing.This means that we can design the system for the depolarizing channel if we do not know exact value of A, just knowing that A ⩾ 1.The rotated codes for d = 3 are able to achieve advantages both in terms of codeword length and performance compared to the non-rotated counterparts.We can conclude that the rotated [ [9,1,3]] XZZX code is the best choice among the surface codes with distance d = 3.
On the contrary, for d = 5, although with puncturing we reduce the codeword length, the performance of the rotated codes slightly degrades on the depolarizing channel as shown in Fig. 7, due to the larger number of error patterns beyond the minimum distance that the decoder can correct.However, given the reduced number of qubits, the small loss for the depolarizing channel, and the performance improvement for asymmetric channels, the rotated [ [25,1,5]] XZZX code can be considered the best choice among those with d = 5.

V. CONCLUSIONS
We have conducted a comprehensive analysis of state-ofthe-art topological planar quantum codes, specifically focusing on the XZZX and rotated surface codes.Our primary objective was to derive analytical performance equations for these codes when decoded using complete decoders, like the lowcomplexity MWPM-based decoder.Our proposed approach has proven to be highly effective in providing accurate code logical error rates across a wide range of quantum channels, including depolarizing, phase-flip, and asymmetric channels.Significantly, our analysis has revealed compelling evidence that examining the error patterns of weight ⌊(d − 1)/2⌋ + 1 for codes with distance d allows for an accurate description of the coding performance.Based on the analysis, we have made noteworthy discoveries regarding specific code variants.For instance, our research demonstrates that the rotated [ [9,1,3]] XZZX code outperforms other surface codes with a distance of 3, making it an optimal choice.Similarly, among the codes with a distance of 5, the rotated [ [25,1,5]] XZZX code showcases superior performance.Additionally, we have established that the combined use of rotation and XZZX variants can lead to a degradation in performance when starting from a rectangular lattice designed to provide asymmetric error correction capabilities.The tables presented in our paper provide a valuable resource for computing the performance of surface codes over arbitrary asymmetric quantum channels.This tool facilitates the analysis and design of complex systems that employ error correction techniques.

Fig. 2 .
Fig. 2. (a-f) Examples Z logical operators of weight w = 3 of the [[9, 1, 3]] rotated surface code.Data qubits with a Z L error are depicted in red.The last four Z logical operators have the form of (e) and (f) but with Y operators on qubits D 1 , D 2 , D 8 and D 9 .The other 12 X logical have the same structure on the dual lattice.(g,h) Examples of Z L and X L logical operators of weight w = 4 for the [[13, 1, 3]] XZZX code.(i,l) Examples of Z L and X L logical operators of weight w = 4 for the [[13, 1, 3]] surface code.

7 Fig. 3 .
Fig. 3. Examples of undetected error patterns on the rotated XZZX [[15, 1, 3]].In red are represented errors introduced by the channel, in yellow the ancilla that measures "-1" during the syndrome extraction, and in orange the error correction applied by the MWPM decoder when the current highlighted ancilla is given as input.(a) A particular ZZ error producing a logical error when decoded (unresolvable error).(b) A particular XX error producing a logical error when decoded.

Fig. 5 .
Fig. 5. Logical error probability vs. physical error probability of the channel.In the plot are reported several topological planar codes of possible interest over an asymmetric channel with A = 10."Rot."stands for rotated surface codes.

TABLE I FRACTION
OF NON-CORRECTABLE ERROR PATTERNS f j (i, ℓ) PER ERROR CLASS OF SEVERAL TOPOLOGICAL PLANAR CODES DECODED BY MINIMUM WEIGHT PERFECT MATCHING: SURFACE, XZZX, ROTATED SURFACE AND ROTATED XZZX, HAVING SYMMETRIC AND ASYMMETRIC ERROR CORRECTION CAPABILITIES.