Logical qubit behavior model and fast simulation for surface code

This study proposes a logical qubit behavior model (LQBM) that calculates the state of the logical qubit based on a surface code after a logical qubit operation. LQBM can simulate the surface code whose distance exceeds 5, which is impossible with conventional quantum simulators. A complex error syndrome measurement must not be executed in this model. LQBM works at the mixed level of a logical and physical qubit. Probability amplitudes and the number of state vectors are designed at the physical qubit level. The state vectors of physical qubits constituting a logical qubit are abstracted to the value of the logical qubit level. LQBM converts all logical qubit operations, which include an initialization, a state injection, universal gates, and lattice surgery operations (e.g., a merge and a split) to simple calculations. LQBM provides a better computational complexity of O(log(distance)) than O(distance2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^2$$\end{document}). Through simulation experiments, it was found that LQBM performs logical qubit operations up to 24 million times faster than existing quantum simulators in the case of distance = 5.


Introduction
Quantum computers are attracting much attention because of their performance beyond the limits of conventional computers [1,2]. Recently, large IT companies (e.g., IBM and Google) have been conducting more research with the goal of commercialization, but one of the main obstacles to the development and operation of quantum computers B Soo-Cheol Oh ponylife@etri.re.kr Gyu-Il Cha gicha@etri.re.kr 1 Future Computing Research Division, Electronics and Telecommunications Research Institute, 218, Gajeong-ro, Yuseong-gu, Daejeon 34129, South Korea is errors occurring in qubits. Quantum computer qubits can be implemented in various ways, including superconductors [3,4], trapped ions [5], and photons [6]. However, these qubits have a fundamental limitation in those errors that occur. To solve this problem, Quantum Error Correction (QEC) [7][8][9] is used to reduce the error. QEC is a technology that generates a syndrome of qubit error and corrects it by decoding the syndrome.
Until now, various error correction technologies, such as a repetition code [10], a toric code [11,12], and a surface code [13][14][15][16], have been developed, and the surface code is currently the most active and studied one. The surface code is divided into a defect-based surface code [14] and a planar surface code [16]. Now, among the variants of the planar surface code, the rotated surface code [16,17] using a smaller number of physical qubits has been studied a lot.
The most basic operation in the surface code is error syndrome measurement (ESM), which is used to correct qubit errors by generating error syndromes. ESM is also used to perform logical qubit initialization and operations based on lattice surgery [16,[18][19][20]. When a logical qubit based on the surface code is simulated using conventional quantum simulators, the actual states of the physical qubits constituting the logical qubit are derived, which are the probability amplitudes of the physical qubits, the state vectors of the physical qubits, and the number of state vectors. However, since ESM is performed through complex physical qubit operations of O(d 2 ) that depend on the distance d of the logical qubit, the complexity of an ESM execution increases exponentially as d increases, making the simulation difficult. Currently, quantum simulators can simulate up to 49 qubits when using a supercomputer [21], and QPlayer supports up to 85 physical qubits for a surface code simulation [22]. Therefore, a distance of 3 or 5 is the simulation limit for the rotated surface code.
We analyzed the input and output qubit states of logical qubit operations from the behavioral perspective of ESM. We developed a model that can calculate the output state of the logical qubit after the logical operation without performing a complex process of ESM. We propose it as logical qubit behavior model (LQBM). LQBM is the model working at the mixed level of the logical and physical qubit. At the physical qubit level, it can simply calculate the probability amplitudes and the number of state vectors of physical qubits constituting a logical qubit. At the logical qubit level, the state vector composed of the physical qubits is abstracted to the value of the logical level. These calculations are performed without the complex physical qubit operations. Based on this model, it is possible to calculate the state of logical qubits with high distance, which cannot be implemented with current quantum simulators. It also provides up to 24.75 million times faster execution than existing quantum simulators. The contribution of LQBM proposed in this paper is as follows.
• State representation of the logical qubit: A state of a logical qubit after an initialization or state injection can be quickly calculated without the complicated ESM process. • Lattice surgery-based logical operation: Quantum operations on two logical qubits are performed using the lattice surgery technique. A state of the logical qubits after performing the lattice surgery operation is calculated mathematically.
• Mixed model and low computational complexity: ESM has an O(d 2 ) computational complexity. However, LQBM provides the complexity of O(log d) using the mixed model of the physical and logical qubit. • Performance of an LQBM simulator: A simple simulator based on LQBM was created, and higher performance was verified. The |0 L initialization of the logical qubit with distance 5 shows that LQBM is 24.75 million times faster than the conventional quantum simulators.
The rest of the paper is organized as follows. Section 2 describes the related studies for this paper. Section 3 proposes a concept of LQBM proposed in this paper. Sections 4 through 6 describe the state representation of logical qubits, the logical operations for a single logical qubit, and the lattice surgery-based logical operations of LQBM. Section 7 defines logical operation matrices for LQBM based on the descriptions in Sects. 4 to 6. Section 8 compares the performance of a simple simulator based on LQBM with that of a conventional quantum simulator. Finally, Sect. 9 presents the main conclusions of this study.

Related works
Surface code: A surface code [23][24][25][26][27] is the most actively studied QEC method. The surface code arranges data qubits and X/Z stabilizer qubits on a two-dimensional qubit array. The data qubits represent the state of the logical qubit using an entanglement, and the X/Z stabilizers are used to detect and correct errors in the data qubits. The most critical process in the surface code is ESM, which marks the error symptoms of the data qubits in the X/Z stabilizer. The error syndrome generated by ESM goes through the decoding process to find the location of the physical qubit where the error occurs and the type of error (X or Z error).
ESM is not only used to correct errors but is also used to perform quantum operations on logical qubits. Initializing a logical qubit to a specific state such as |0 or |+ uses ESM, and a state injection to set an arbitrary quantum state into a logical qubit also uses ESM. In addition, the lattice surgery technique is used to perform the logical qubit operations targeting multiple logical qubits, and the basis of this technique is to use ESM. The most basic operations of the lattice surgery are a merge and a split. The merge is the method of merging two logical qubits into one logical qubit. The split operation is to split one logical qubit into two logical qubits. The merge and the split operate based on an X or Z boundary. If the merge and the split are combined, logical qubit operations (e.g., CNOT, MOVE, and SWAP) can be performed, and Z phase shit operations (e.g., S gate and T gate) can also be performed [16,18,[28][29][30][31].
There is the rotated surface code using fewer physical qubits [16]. The rotated surface code is created by rotating the planar surface code by 45 • and removing some qubits. The rotated surface code with the smallest distance 3 consists of 9 data qubits and eight stabilizer qubits. The eight stabilizer qubits comprise 4 X stabilizers and 4 Z stabilizers. The X and Z stabilizers detect the Z and X errors of the data qubits, respectively.
Quantum Simulator: Quantum simulators utilize classical computers to simulate qubits. Since these simulators require a memory size of 2 N (N: the number of qubits) to express the entanglement of qubits, the memory consumption increases exponentially as the number of qubits increases [21,[32][33][34][35]. If there are 36 or 50 qubits, approximately 1TB or 16PB of memory is required, respectively [32]. Therefore, if the number of qubits increases, the memory requirement cannot be satisfied even when a large-scale system is used. This is a limitation of the quantum simulators.
The quantum simulator of ETH Zurich simulated a 45-qubit circuit on the Cori II supercomputing system with 0.5 petabytes of memory and 8192 nodes [34]. QuEST showed the capability of simulating a 38 qubits circuit on the ARCUS supercomputer with 2048 nodes [35]. At Tsinghua University, the quantum supremacy circuit simulation on Sunway TaihuLight with 16K nodes showed that a 49-qubit circuit with a depth of 39 could be simulated [21]. QPlayer simulated an 85-qubit circuit for the surface code on 512 GB memory by removing unnecessary state vectors of qubits instead of increasing the memory capacity [22].

Logical qubit behavior model
LQBM can derive the state changes after performing the logical qubit operations through simple calculations instead of a complex ESM on physical qubits. LQBM consists of two elements: a state representation of a logical qubit and a logical qubit operation.
State representation of a logical qubit: The state representation of a logical qubit describes the quantum state when an initialization or a state injection is applied to the logical qubit. The state |ψ L of the logical qubit consists of three elements which are S, pa, and m, and the relationship between them is as in (1). |ψ L is composed of logical values (S) of state vectors constituting the logical qubit and probability amplitudes (pa) corresponding to each logical value. Also, each S is expressed as an entanglement of m state vectors of physical qubits. pa and m are elements based on the physical qubit level, and S is based on the logical qubit level.
• S: S is the logical value of state vectors constituting a logical qubit. S for a logical qubit consists of S 0 (=0) and S 1 (=1). • m: One |S j L is expressed as an entanglement of m state vectors |S j L_i . Also, if one logical qubit consists of k physical data qubits, it is expressed as |S j L_i = |d 1 . . . d k . A logical value of |S j L_i is determined by combining the physical data qubits. • pa: pa is the probability amplitude in units of the physical data qubits constituting the logical qubit. pa j is the value for |S j L_i . If m probability amplitudes for |S j L_i are gathered, they behave like the logical probability amplitude for |S j L . The hollow, black, and gray circles represent the data qubit, X stabilizer, and Z stabilizer, respectively. dx and dz denote the number of data qubits on the X and Z boundaries, which are typically positive odd. nx(= (dx − 1)(dz + 1)/2) and nz(= (dx + 1)(dz − 1)/2) represent the number of X and Z stabilizers, respectively. X L and Z L define the logical X and Z operators for the logical qubit The state of one logical qubit is also expressed as a function of the quantum state α|0 + β|1 to be initialized and the number of X stabilizers constituting the logical qubit, as follows. Details will be explained in Sect. 4.
|ψ L = F I nit (α, β, the number of X stabili zers) F I nit = {I nitiali zation, State I n jection} Logical qubit operation: When a logical qubit operation is applied on the state |ψ L_input of logical input qubit, an output logical qubit state |ψ L_out put is generated. F O P represents various logical qubit operations. In addition to the existing universal gate set, F O P supports the merge and the split with X and Z boundaries for the lattice surgery. Details will be explained in Sects. 5 to 6.

State representation of logical qubit
The initialization and the state injection define the state of logical qubits based on the rotated surface code. The initialization is to set the state of a logical qubit to a specific quantum state, such as |0 L or |+ L . The state injection sets a logical qubit to an arbitrary quantum state of |ψ L = α|0 L + β|1 L . Figure 1 shows the structure of the logical qubit based on the rotated surface code [16] targeted in this paper, and the ESM circuit is in Fig. 2. The logical qubit generally uses dx and dz of the same value, which are usually expressed as distance d. In this paper, they are marked differently to distinguish the effects of dx and dz during the ESM process. Fig. 2 a, b are ESM circuits that generate an X/Z stabilizer to detect errors in data qubits. The X and Z stabilizers are used to detect Z and X errors in the data qubits, respectively. One X or Z stabilizer is associated with four neighboring data qubits. D0 through D5 in the circuit are the data qubits in Fig. 1

|0 L initialization
A |0 L initialization sets all data qubits constituting a logical qubit to |0 and performs an ESM process to generate all X and Z stabilizers. After that, the error syndromes composed of X and Z stabilizers are decoded, and the errors are corrected. Only X syndrome errors arise randomly in the |0 L initialization. A |+ L initialization is similar to the |0 L initialization except that all data qubits are initialized to |+ and that only Z syndrome errors occur randomly.
First, to initialize a logical qubit to |0 L , all data qubits and X/Z stabilizers of the logical qubit are initialized to |0 . The initial state |ψ L of the logical qubit is described as the tensor product of the X stabilizers, the Z stabilizers, and the data qubits as follows. XS, ZS, and D represent the X stabilizers, the Z stabilizers, and the data qubits, respectively, and the states of all qubits are |0 .
The X and Z stabilizers produce the same result even if they are performed simultaneously or in sequence because they commute. Assuming that the Z stabilizers are generated before the X stabilizers, look at Fig. 2b. Since all data qubits, the control of the CNOT operations, are |0 , the Z stabilizer generation does not change the state |ψ L . Therefore, in the |0 L initialization, only the generation of the X stabilizers plays an important role, and we will look into this in detail.
nx X stabilizers can be generated in order from X stabilizer 1 to nx because all X stabilizers commute each other. So let's assume that X stabilizer 1 is generated for the first time. In Fig. 2a, the first step of generating the X stabilizer is to perform an H gate on the X stabilizer, and the result is expressed as (2). In (2), the state of the Z stabilizer, which always has a value of |0 , is deleted for convenience of explanation, and the data qubit is displayed immediately after the first X stabilizer.
In the second step, CNOT gates are performed with the X stabilizers as a control and the data qubits as a target. Depending on whether the state of the Z L operator on a logical qubit has even or odd parity, the state of the logical qubit is either |0 L or |1 L . When the Z L operator is defined as shown in Fig. 1, the current state of the Z L operator has even parity because the eigenvalue of all data qubits constituting the Z L operator is +1. Therefore, |0 1 . . . 0 dx×dz D can be abstracted as the logical state |0 L . There are (dx − 1) X stabilizers above and below the Z L operator, and each X stabilizer can affect two data qubits involved in the Z L operator. From (2), the state of the Z L operator remains even parity because the CNOT using |0 1 X S as the control and the data qubit as the target does not change the data qubits constituting the Z L operator. Since CNOT using |1 1 X S as the control performs X operations on two data qubits in the Z L operator, the state of the Z L operator remains even parity. Therefore, the state of the logical qubit after executing the CNOT gates remains |0 L . The result of performing the CNOT operations in (2) is summarized in (3). Although the logical qubit state remains |0 L , the combinations of the data qubits constituting it are different, and this is expressed as |0 L_1_0 and |0 L_1_1 in (3). |0 L_1_0 or |0 L_1_1 is the state of the data qubits generated by CNOT operations using the |0 1 X S or |1 1 X S value of the X stabilizer as the control when the first X stabilizer is generated.
The third step of generating the X stabilizer is to perform the second H gate on the X stabilizer, which is expressed by (4). The phases (P 1_ ji ) are separated from the entanglement of the first X stabilizer and the data qubits.
From (4), the state when all nx X stabilizers are generated is derived as (5). The X stabilizer expression, which is separated until (4), is combined into one since all X stabilizers are generated. Because nx is a fixed constant, it can be omitted for convenience of notation.
• |X S j X S : The X stabilizers are represented by 2 nx entangled state vectors, and |X S j X S is the j-th state vector among the entangled states. • |0 L_i : The data qubit |0 L is represented by 2 nx entangled state vectors, and |0 L_i is the i-th state vector among the entangled states. • P ji ∈ {0, 1}: the phase value for the tensor product of |X S j X S and |0 L_i .
The state of the logical qubit after generating all nx X stabilizers is a form in which phases are added to the tensor product of the X stabilizers with the 2 nx entangled state vectors and the |0 L data qubits with the 2 nx entangled state vectors. The total number of state vectors of one logical qubit becomes 2 2nx , and the probability amplitude of each state vector becomes 1/ √ 2 2nx .
The fourth step is to measure all the generated X stabilizers. The q-th X stabilizer value is randomly selected among the entanglement of 2 nx X stabilizers. This is expressed as (6).
Here, the Z errors of the data qubits are corrected according to the |X S q X S syndrome, and all (−1) P qi values become +1. The final |0 L initialization state is described as (7). The X stabilizers are deleted when the initialization is completed because they are no longer needed. Also, for convenience of notation, i is changed to start from 1 instead of 0. From (7), it can be seen that the |0 L logical qubit is expressed as the entanglement of 2 nx state vectors of the data qubits representing |0 L and the probability amplitude of each state vector is equal to 1/ √ m. Also, the |0 L initialization depends on nx, the number of X stabilizers.
From now on, we can use (7) to obtain the state of the |0 L logical qubit by a simple calculation instead of the complex ESM. The logical qubit initialization using the quantum simulators requires nx × (4 C N OT s + 2 Hgates) + nz × 4 C N OT s quantum operations, to calculate the entangled states of the data qubits constituting a logical qubit. It has the complexity of O(d 2 ) (=O(dx × dz)). The distances dx and dz are unified by d to simplify the complexity expression.
In LQBM, the |0 L initialization consists of computing m(= 2 (d 2 −1)/2 ), 1/ √ m (= pa), and |0 L_i in (7) (7) does not affect the complexity of LQBM, and we can see that the complexity of LQBM is O(log d). In addition, it is easy to find the |0 L initialization state of the logical qubit with a high distance, which is impossible in conventional simulators.

State injection
The state injection sets a logical qubit to an arbitrary quantum state of |ψ L = α|0 L + β|1 L . The |1 L state representation of the logical qubit can be derived by performing a logical X operation on the |0 L logical qubit, as shown in (8). The quantum state of the logical qubit after the state injection is described as (9). c and d correspond to pa0 and pa1 in (1).
A logical qubit is described as an entanglement of 2m state vectors. Of the 2m state vectors, m state vectors are for |0 L_i , and the other m state vectors are for |1 L_i . The probability amplitudes for |0 L_i are all α/ √ m. If those m probability amplitudes are gathered, they behave like the logical probability amplitude for |0 L . This is the same for |1 L . Using (9), |+ L initialization state is also expressed as (10).

Operators for single logical qubit
The quantum operations for the single logical qubit are X, Z, and H. Based on the lattice surgery, since S and T use an ancilla qubit, they are not included in this section. After applying logical X or Z operation, the state of the logical qubit is expressed as (11). Multiple logical X operators can be defined for the single logical qubit and have the same result. Any valid logical X operator changes |0 L to |1 L and |1 L to |0 L . Multiple logical Z operators are also defined, and a phase of |1 L changes from + to − and − to +. The logical X and Z operators do not change the number of state vectors of data qubits.
A logical H operator is as shown in (12). The logical H operator is achieved by performing transversal H gates on all data qubits constituting a logical qubit, and it changes |0 L to |+ L and |1 L to |− L .
6 Operators using lattice surgery

Logical tensor product
Before expressing logical operators using the lattice surgery, let's first look at how to describe a tensor product of logical qubits. Suppose that there are N logical qubits |ψ 1 L , . . . , |ψ N L . The logical tensor product is expressed as (13) using 2 N logical state vectors. C i represents a complex number.Each logical state vector from (14), and |S j L _ i is a combination of the physical data qubits as described in (1). This indicates that |S 1 S 2 . . . S N L equals the tensor product of the state vectors of the physical data qubits constituting |S i L . So, |S 1 S 2 . . . S N L has m t p physical state vectors corresponding to the product of m 1 to m N . Also, the probability amplitude (=1/ √ m t p ) is defined as the product of Therefore, it can be seen that the tensor product of the N logical qubits is the same as the tensor product of the physical state vectors constituting each logical qubit, as shown in (15)

Merge and split
Logical qubit operations for two logical qubits in the rotated surface code are performed using the lattice surgery technique. The most basic lattice surgery operations are a merge and a split. The merge is the method of merging two logical qubits facing the same boundary into one logical qubit, and there are X and Z merges according to a boundary type. The split is to divide one logical qubit into two logical qubits. There are also X and Z boundary splits. Figure 3 is the diagram explaining the merge and the split.
For the Z boundary merge, the number of data qubits in the Z boundary must be the same (dz = dz ). The Z boundary merge of two logical qubits |ψ L and |ψ L is expressed as (16) [16].
The state of a merged logical qubit is an entanglement of two logical qubits. |00 L + (−1) M |11 L and |01 L + (−1) M |10 L are interpreted as |0 L and |1 L , respectively, in terms of the merged logical qubit. One logical qubit has one probability amplitude value for |0 L and |1 L , respectively. The merged logical qubit follows this rule when M = 0. However, two probability amplitudes for |00 L and |11 L have opposite phases in terms of the merged logical state |0 L , when M = 1. The two probability amplitudes for |01 L and |10 L also have opposite phases in the merged logical state Fig. 3 a the Z boundary merge is the method of merging two logical qubits facing the Z boundary into one logical qubit. New X stabilizers are added to the merged Z boundary, and the product of the measurements of the new X stabilizers is used as the M value for the Z boundary merge. The Z boundary split is to split one merged logical qubit into two logical qubits based on the Z boundary. When the Z boundary split is performed, the new X stabilizers added at the time of merging disappear. b the X boundary merge/split performs the merge and split based on the X boundary. The merge adds new Z stabilizers, and the split removes the new Z stabilizers. The product of the measurements of the new Z stabilizers is used as the M value for the X boundary merge |1 L . Therefore, one merged logical qubit with M = 1 has four probability amplitudes for |00 L , |01 L , |10 L , and |11 L , which are based on two logical qubits before merging. Because LQBM uses the state vectors and their probability amplitudes, we determine to express the state of the merged logical qubit based on |00 L , |01 L , |10 L , and |11 L . Suppose you want to express the Z boundary merge in terms of the merged logical qubit, adding the value of M together like |0 M L = |00 L + (−1) M |11 L and |1 M L = |01 L + (−1) M |10 L is necessary. Also, a complex model that considers the opposite phase is required for logical operations.
If we calculate the sum of the squares of the probability amplitudes of the merged logical qubit in (16), it is seen that the sum is not always 1. Therefore, normalization must be performed so that the sum of the squares of the probability amplitudes becomes 1. After that, the merge operation can be applied to LQBM. The normalization operation is performed by dividing each probability amplitude in (16) by the sum of the squares of the probability amplitudes as in (17).
The number of X stabilizers in the merged logical qubit is nx + nx + (dz + 1)/2. The number of X stabilizers added to the facing Z boundary is (dz + 1)/2. Therefore, the number of state vectors for |0 L or |1 L in the merged logical qubit becomes (18). The merged logical state |0 L is expressed as a combination of |00 L and |11 L , and |1 L is described as a combination of |01 L and |10 L . Thus, each of |00 L , |01 L , |10 L , and |11 L has the number of state vectors shown in (19).
We describe the output state of the Z boundary merge as (20) by reflecting the number of state vectors.
If A, B, and K are changed to A L , B L , and K L using c, d, and m of (9), the final Z boundary merge is described as shown in (21).
In addition, the Z boundary merge is expressed as (22) using the tensor product of two logical qubits as an input. This will be used when defining an operation matrix in Sect. 7.
The Z boundary split is to split one merged logical qubit into two logical qubits based on the Z boundary. The Z boundary split is expressed as Z Split(α|0 L + β|1 L ) = α| + + L + β| − − L based on an X basis. Since the expression of LQBM is based on a Z basis, the expression of the Z boundary split is converted to the Z basis as shown in (23). The probability amplitudes for |00 L , |01 L , |10 L , and |11 L of the merged result in (21) are expressed briefly using C 1 , C 2 , C 3 , and C 4 , and they are used as inputs for the X boundary split. When the Z boundary split is performed, the X stabilizers added at the time of merging disappear, and the number of state vectors for |00 L , |01 L , |10 L , and |11 L is reduced from r × m × m to m × m . The ratio of the probability amplitudes is maintained as it is.
The X boundary merge and split can also be derived through a process similar to the Z boundary merge and split. For the X boundary merge, the number of data qubits in the X boundary must be the same (dx = dx ). The result of the X boundary merge is as (24). The X boundary merge is performed using the X basis, so the logical qubit expressed as the Z basis is converted to the X basis, merged, and then transformed back to the Z basis for LQBM. The difference between the X and Z boundary merge is that in the X boundary merge, overlapping X stabilizers at the facing X boundary of two logical qubits are deleted. It means that r is less than 1. Therefore, after the completion of the X boundary merge, the number of state vectors of the merged logical qubits is less than the tensor product of two logical qubits before the merge.
The X boundary merge is also expressed as (25) using the tensor product state of two logical qubits as an input. This will be used when defining an operation matrix in Sect. 7.
The X boundary split divides one merged logical qubit into two logical qubits based on the X boundary. The X boundary split is expressed using the Z basis as (26). Like the Z boundary split, the input probability amplitudes of the X boundary split are also described as C 1 , C 2 , C 3 , and C 4 . When the X boundary split is performed, the X stabilizers that were deleted at the time of merging are added again, and the number of state vectors representing |00 L , |01 L , |10 L , and |11 L changes from r × m × m to m × m . Since r is less than 1, the X boundary split increases the number of state vectors. Fig. 4 a-c show circuits that perform logical CNOT, S, and T gates based on the lattice surgery. Mxx means that the Z boundary merge and split are continuously performed, and Mzz is the sequence of the X boundary merge and split. The M value is obtained by performing Mxx and Mzz. The Mxx, Mzz, and Mx measurements determine a, b, and c. In addition to the control qubit |C and target qubit |T , CNOT requires an ancilla qubit |0 . The S and T gates require magic states |Y and |A , respectively

CNOT, S, and T operator
In the rotated surface code, CNOT, S, and T operators are decomposed into the merge and split operators based on the lattice surgery as shown in Fig. 4 [16,18,28,29]. LQBM also implements these operators as a combination of the merge and the split. For the convenience of understanding, this chapter summarizes only the final execution results, not the intermediate process, of the CNOT, S, and T operators, as shown in (27,28). After executing CNOT with |ψ L as a control and |ψ L as a target, the result is shown in (27).
The final execution results of the S and T operations are in (28). The S and T operators for the logical qubit are implemented using the X boundary merge and split. When an Mzz measurement is −1, a global phase is added and expressed as e iθ in (28). The exact value of θ is determined based on the combination of the Mzz measurement, an ancilla's Mx measurement, and an execution result of an additional S gate. θ values for S gate are 0, π/2, and 3π/2, and θ values for T gate are 0, π/4, 3π/4, 5π/4, and 7π/4.

Operation matrix
This section defines operation matrices for the logical operations described in Sects. 4 to 6. The operation matrices will help improve our understanding of LQBM as matrices for physical qubit operations have been useful. In addition, these matrices are expected to be helpful when performing logical qubit operations or simulations based on LQBM.
For the operation matrices, the number m of state vectors constituting logical qubits is added to the upper right of the state vector, as shown in (29). The number m of state vectors in N logical qubits is equal to m t p defined in (15).
The operation matrix for a logical qubit is similar to the operation matrix for a physical qubit, and w is added for the matrix, as shown in (30). w specifies the multiplier of increasing the number of state vectors after completing a logical qubit operation. w actually has meaning in the initialization, the state injection, the merge, and the split, and is always 1 in other operations. When a logical qubit operation is executed on a logical qubit composed of m state vectors, the result of the operation has w × m state vectors. C R 1 to C R n is the probability amplitudes of the output derived from the logical qubit operation.
LQBM defines the operation matrix and usage for the initialization and the state injection as (31). Since the state representation of the initialization is a subset of the state representation of the state injection, the state injection and the initialization use the same operation matrix. An input vector of the state injection is expressed as α and β of the desired qubit state to be injected, and it has only one state vector. The w value of the operation matrix for the state injection becomes m dependent on the distance d. Therefore, the input vector with one state vector has m state vectors after the state injection, and the probability amplitudes become α/ √ m and β/ √ m. The initializations for |0 L and |+ L are performed by specifying α and β for |0 and |1 , respectively.
The operation matrices for the X, Z, and H operators are presented in (32). The X operator part contains an example of using these operators. The X, Z, and H operations have the advantage of utilizing the existing operation matrix for the physical qubits as they are. w of the operations is set to 1. The matrices for the final outputs of CNOT, S, and T are also defined similarly.
Based on (22), an operation matrix for the Z boundary merge and its usage is defined as (33). w for the matrix is r in (19). From (23), an operation matrix for the Z boundary split is defined as (34), and w for the matrix is 1/r .
A matrix for the X boundary merge is derived as (35) using (25), where w is r in (24).
The X boundary split based on (26) can utilize the same operation matrix as the Z boundary split. An input state of the X boundary split uses an output state of the X boundary merge. In the output state of the X boundary merge with M = 0, C 2 and C 3 are 0. In the output state of the X boundary merge with M = 1, C 1 and C 4 are 0. Utilizing this, the X boundary split can use the same matrix as the Z boundary split, as shown in (36).

Experimental results
We wrote a simple simulator for LQBM by utilizing the GMP library supporting highprecision arithmetic calculation [36]. For comparison, we also implemented the logical qubit operations on the popular QuEST simulator [35]. Intel Xeon Gold 6132 CPU (2.6G) and 1TB memory were used for experiments. Both simulators did not use a GPU acceleration option. The experiments were performed using a single process and thread although the experimental environment supports the multicore environment.

|0 L initialization with various distances
Conventional quantum simulators cannot perform the |0 L initialization if the distance exceeds 5. However, this experiment shows that LQBM can initialize a logical qubit to |0 L state regardless of the distance size. Figure 5 and Table 1 show the change in the number of state vectors and the probability amplitude according to the distance when a logical qubit is initialized to |0 L . This experiment was performed only on LQBM.
In this experiment, dx and dz are set equal, and they are the same as the distance d of the logical qubit. Figure 5a and Table 1 show the change in the number of state vectors constituting the |0 L state as the distance increases. The vertical axis is the value obtained by taking log 10 on the number of state vectors. The number m of state vectors is 2 to the power of (d 2 − 1)/2 according to (7). So as the distance d increases, the number m of state vectors increases exponentially. The logical qubit of distance 3 has 0.16 × 10 2 state vectors, and the logical qubit of distance 9999 has 0.3042 × 10 15048490 state vectors.
When d = 3, 17 physical qubits are required for one logical qubit, and 2 17 state vectors are necessary to express the 17 physical qubits. However, after the |0 L initialization, only 0.16 × 10 2 of 2 17 state vectors are valid to describe the |0 L state. In  Figure 5b shows the probability amplitude of each state vector as the distance increases. The vertical axis is the value obtained by taking log 10 on the probability amplitude of each state vector. The probability amplitude in the |0 L state is 1/ √ m. As the distance of the logical qubit increases, the probability amplitude also decreases exponentially. The logical qubit of distance 3 has a probability amplitude of 0.25 × 10 0 , and the logical qubit of distance 9999 has a probability amplitude of 0.1812 × 10 −7524244 .
From the experiments of this section, it can be seen that LQBM can perform the |0 L initialization regardless of the distance size using the simple formula in (7).

Execution times of LQBM according to distance
The execution times of logical qubit operations were measured while increasing the distance from 3 to 33333 in LQBM. The time unit of the experiment is nanosecond.  Table 2 shows that as the distance increases 11111 times from 3 to 33333, the execution time of each logical qubit operation increases from 1.00 to 3.89 times. The initialization and the state injection show a time increase of 3.89 and 2.14 times, respectively. This is because they perform power-of-two calculations with the O(log d) complexity to compute m and pa. The values of m and pa computed in the initialization and the state injection are reused in subsequent logical qubit operations. The X, Z, and H operations have no complex computations, so there is little increase in the execution time. The merge and split operations perform mainly multiplicative computations based on m and pa derived from the initialization and the state injection, which show the 1.x time increase.
The execution time increases up to 3.89 times as the distance increases. However, it can be seen that the absolute execution time of the logical qubit operations is still fast within several thousand nanoseconds.

Operators for single logical qubit
The execution times of the initialization, the state injection, and the logical X, Z, and H operations, which are performed on a single logical qubit, were measured. Since the QuEST simulator does not model qubit errors, the |0 L initialization was run in one round of ESM, not the d rounds. The ESM and error corrections were also not executed after the logical X, Z, and H operations. This experiment was performed on the logical qubit with distances of 3 and 5. The logical qubit with distance 5 requires 49 physical qubits, but QuEST cannot simulate 49 qubits. So, only 25 physical data qubits and one stabilizer qubit were used for QuEST. Using one stabilizer qubit, one X or Z stabilizer was generated and measured at a time, and this process was repeated for a total of 24 X/Z stabilizers. In Table 3, the time unit of the QuEST experiment result is second, and the time unit of LQBM is nanosecond. In QuEST, the state injection with d = 5 consists of complex operations such as the state injection with d = 3 and two additional ESMs, which increase the distance to 5. Therefore, this result was estimated by summing the three execution times, which are the state injection time (9.49 ns) with the distance 3 and two |0 L initialization (ESM) times (17.44 and 27.67 ns) with the distance 4 and 5. The execution time, 17.44 ns, of ESM with the distance 4 was approximated by interpolating the execution times, which are two |0 L initialization times (9.49 and 27.67 ns) with the distance 3 and 5.
According to Table 3 with the distance of 3 and 5, first, LQBM operates at least 0.61 million times faster than QuEST and up to 24.75 million times faster. The performance improvement of 24.75 million times is achieved in the |0 L initializationn with d = 5. Second, as the distance increases, the improvement of LQBM over QuEST becomes greater. In the case of state injection, when the distance increases from 3 to 5, the improvement of LQBM increases from 4.03 to 20.24 million times.

Operations based on lattice surgery
The execution times of the merge and the split are shown in Table 4. Since it is impossible to perform the merge and split operations when d = 5 in QuEST, the   Table 3 Execution time of operations for single logical qubit   Table 4 also shows that LQBM outperforms QuEST distinctly. The Z boundary split is performed 5.87 million times faster by LQBM than by QuEST. Table 5 shows the execution times for the logical CNOT, S, and T using the merge and the split, as shown in Fig. 4. The T operation shows two cases depending on whether an additional S operation is executed or not according to an Mzz value. The results of LQBM are derived from Table 4, not actual experiments. For example, the CNOT result of LQBM is the sum of the execution times of XMerge, XSplit, ZMerge and ZSplit. Table 5 indicates that LQBM offers approximately 3 to 4 million times higher performance than QuEST.
From the experimental results of Sect. 8, we can summarize three advantages of LQBM. First, LQBM can perform logical operations with high distances, which are impossible in conventional quantum simulators. Second, even though the distance increases 11111 times from 3 to 33333, the execution time of LQBM only increases by a maximum of 3.89 times. Third, LQBM is 0.61 to 24.75 million times faster than QuEST at distances of 3 and 5. In particular, the |0 L initialization of d = 5 shows up to 24.75 million times faster performance.

Conclusions
We proposed LQBM that calculates the output state of a logical qubit after the logical qubit operation without performing a complex process of ESM. LQBM is the model working at the mixed level of the logical and physical qubit. At the physical qubit level, it can simply calculate the probability amplitudes and the number of state vectors of physical qubits constituting a logical qubit. At the logical qubit level, the state vector composed of the physical qubits is abstracted to the value of the logical level. These calculations are performed without the complex ESM operations. LQBM consists of the state representation of the logical qubits and the operations. The state representation of the logical qubits converts the initialization and state injection processes into simple arithmetic calculations. The logical qubit operation of LQBM can calculate the output states of the universal gates, the merge, and the split for the logical qubits.
In addition, the execution of the logical qubit operation using LQBM is more simplified by expressing all the logical qubit operations of LQBM in the form of the operation matrix. The ESM operation of the rotated surface code has the operation complexity of O(d 2 ). However, LQBM provides the operation complexity of O(log d), so it has high performance. Through the comparative experiments of LQBM and QuEST, we found three advantages of LQBM over QuEST. First, LQBM can simulate the surface code whose distance exceeds 5, which is impossible with conventional quantum simulators. Second, even though the distance increases 11111 times from 3 to 33333, the execution time of LQBM only increases by a maximum of 3.89 times. And the absolute execution time of LQBM is still fast within several thousand nanoseconds. Third, LQBM is 0.61 to 24.75 million times faster than QuEST at distances of 3 and 5. In particular, LQBM provided up to 24.75 million times faster performance in the |0 L initialization of d = 5. In future works, we would like to develop a model that computes an exact combination of the physical qubits for the logical qubit instead of the value of the logical qubit level and add an error correction model.