Density matrix simulation of quantum error correction codes for near-term quantum devices

Fault-tolerant quantum computing requires many qubits with long lifetimes and accurate quantum gate operations. However, external noise limits the computing time and hampers accurate quantum gate operations. Quantum error correction (QEC) codes may extend such limits, but imperfect gate operations during QEC cause errors, which could cancel out QEC. We used density matrix simulations to examine the performance of QEC codes with five qubits. In current quantum devices, less than ten qubits are needed to conduct sufficient gate operations within their lifetime so that it is feasible to implement QEC codes. We analyzed the maximum tolerable error rate and error correction effect of individual QEC codes according to the qubit arrangement and gate accuracy. Assuming a 0.1% gate error probability, a logical ∣ 1 〉 state encoded by a five-qubit QEC code is expected to have a 0.25 higher fidelity than its physical counterpart.


Introduction
The increasing need for powerful computers has drawn attention to the use of quantum computers for applications such as big data searching, quantum chemistry, machine learning, and quantum cryptography [1][2][3][4][5]. Quantum computers are expected to surpass the computational power of their classical counterparts when a system has more than 50 qubits. In anticipation of quantum supremacy, scalable qubit systems have been under thorough investigation by Google [6], IBM [7], and Intel. In addition to these, superconducting qubits, multiple qubit systems such as ion traps, nitrogen-vacancy centers, and quantum dots have been investigated [8][9][10][11]. However, physical qubits are not suited to operate on large-scale algorithms due to their limited coherence time and gate accuracy. The main goal is to achieve fault-tolerant quantum computing that retains quantum information over a long period and utilizes accurate and frequent quantum gate operations without irreversible loss of data [12]. Thus, for effective quantum error correction (QEC), it is important to analyze the maximum tolerable error rate required for physical qubits [13][14][15][16].
QEC was introduced in 1995 when researchers started trying to build a coherent and large scale quantum system [17][18][19][20]. The major difference between QEC and classical error correction is that quantum information cannot be duplicated due to the no-cloning theorem, necessitating a new approach. Initially, the type and properties of QEC codes were investigated and corresponding theories and logical gate operations were developed [21][22][23][24]. Later, a fault-tolerant quantum computing technique was developed, which prevented an error from prevailing over an entire quantum circuit [25][26][27]. Subsequently, the protocols and fault tolerance of surface codes applicable to locally interacting qubits, was developed [28][29][30][31][32].
QEC simulations for logical operations, protocols, and gate error thresholds have been conducted [33][34][35]. These simulations utilize Monte-Carlo methods and perturbative methods to reduce the resource cost for computation. Recently, surface code simulations using density matrix or Monte-Carlo methods, have been analyzed to evaluate the advantages of the codes and protocols [36][37][38][39][40][41][42]. Nevertheless, these approaches are targeted at large-scale quantum computing, and so an appropriate delineation of QEC for near-term quantum devices has been investigated. It has been suggested that success in researching QEC codes in small qubit systems could be a precursor for large-scale quantum computing [43,44]. Several conditions for the preparation of error detections [45,46] have been examined, enabling the entire procedure from initialization to detection to be evaluated. After it was experimentally verified that QEC codes are effective to resist artificial errors [47][48][49], resisting the environmental error through QEC codes should be investigated as a next step.
The current status of quantum computing devices is as follows. The number of implemented qubits varies from 2 to 50 qubits depending on the device platform. In most systems, nearest neighbor interactions are allowed. The gate fidelity for one-qubit and two-qubit gate operations is usually in the range of 99%-99.9%. The number of operable gates, defined as coherence time divided by gate operation time, varies from approximately 100-1000. QEC codes, in contrast, are designed for less than 10 qubits and less than 20 operations to ensure that effective results can be achieved. This paper seeks to find conditions for effective error correction.
One of the simplest and most well-known QEC codes is a three-qubit bit-flip QEC code. Considering conditions such as gate accuracy, and interacting regime, it is necessary to evaluate which QEC codes will be successful in retaining quantum information over an extended period. The three qubit bit-flip QEC code is seemingly straightforward to implement. However, unexpected problems can occur. To counter these, a Toffoli gate should be decomposed, connectivity should change the circuits, and H and T gates should be appropriately substituted with native quantum gates. We analyzed what conditions should be considered and what requirements needed to be satisfied.
QEC circuits described in terms of the standard gate set such as H, S, and T gates should be translated to QEC circuits that use their own native gates such as X, Y rotation or X, Z rotation in one qubit operations, and CNOT gates and controlled-Z gates in two qubit operations. After transforming the circuits, the number of gates and depth of circuitry can be increased. Contrary to expectations that one is a high enough gate accuracy, the required gate accuracy can and should be higher. Similarly, the qubit layout can change the circumstances. We therefore analyzed a number of factors for conducting successful error correction using the simple QEC code.
In this study, we aimed to analyze the situation where the QEC is applied successfully on quantum devices. Using density matrix simulation, the effects on performance of a single logical qubit was examined. QEC codes with a small number of qubits were selected so that they could be implemented quickly. We anticipated that the performance of the logical qubit using this simulation would be more accurate: it keeps track of every change in quantum state including decoherence and gate operation; it includes examinations on operation errors during gate operations; and the errors are treated differently depending on their types, which can be described in the density matrix. Thus, the evolution of the density matrix is expected to describe quantum states close to actual qubits. In addition, the density matrix simulation result is consistent with the results performed with IBM quantum experience qubits.
We have proposed three application examples for using density matrix simulation: it can be used to assess how long quantum information is maintained according to a QEC code; the maximum tolerable error rate, affected by the layout-originated constraints of qubits, can be analyzed; and, given the number and gate accuracy of the currently implemented qubits, it can be used to predict whether QEC codes will work or not. In this paper, considering the gate error probability of 0.1% and the gate operation time of a thousandth of coherence time in an all-to-all connected layout, the fidelity of logical qubits encoded by five-qubit QEC codes is expected to be higher than that of a physical qubit by 0.25 when the initial state is set as | ñ 1 .

Preliminaries
2.1. QEC code for near-term quantum devices A lot of QEC codes have been devised, each with their own specific strengths. Nevertheless, there are only a few QEC codes that are appropriate for near-term quantum devices, and a three-qubit bit-flip QEC code is one of them. A three-qubit bit-flip QEC code has one data and two ancilla qubits to correct a bit error occurring in the data qubit. Three-qubit QEC codes have been used experimentally in many physical systems [49][50][51][52][53]. It was confirmed that the QEC code works with intentional errors, however it has not been demonstrated that the code can correct a naturally occurring error yet. At least three qubits are required to implement the simplest QEC, a three-qubit bit-flip QEC. Even for syndrome measurements, two more qubits need to be added. This can be a serious burden for near-term quantum devices. Moreover, coherence time of three-qubit bit-flip QECs is short, making it difficult to operate even simple QEC codes. In this regard, the quantum information is directly and destructively read without syndrome measurements so that the final data can be corrected. A five-qubit QEC code, which is imperfect for correcting both bit and phase errors yet is resilient to those errors, is therefore proposed.
A three-qubit QEC code and five-qubit QEC code, illustrated in figures 1(a) and (b), respectively, is composed of four parts: encoding, memory, detection, and correction. This five-qubit code aims at correcting the data qubit's X and Z errors, which correspond to the first two gates and latter H and CNOT gates, respectively. In spite of their imperfection of error correction, these codes are simple and do not require additional qubits so that it is easier to implement. It is these two QEC codes that we have mainly focused on.
The memory time of a logical qubit is a counterpart of the lifetime of a physical qubit because gate operations can be conducted within that time. In these circuits, quantum information is not detected by syndrome measurements but by direct measurements. Considering near-term quantum devices, the number of qubits is few, and the coherence time is short. It is difficult to perform QEC repeatedly to ensure that the direct measurement will have similar effects on quantum information.

Linear approximation model
One way to evaluate the closeness of two quantum states is the fidelity. The value of fidelity between pure states such as | | r y y = ñá and | | s f f = ñá can be interpreted as the transition probability from |yñ to |fñ, or overlapping of them as follows: Quantum errors can be regarded as probabilistic and discrete [54] because they can be modeled by a set of error channels such as Pauli matrices. In this model, error probability p is small enough so that the fidelity becomes where E k is a set of error channels [55]. Assuming c=1, the error probability directly affects the closeness of quantum states.
In a linear approximation model, the accuracy of quantum information is determined by the fidelity with a small enough error probability p. The fidelity of a physical qubit is F p =1−P M , where P M are the errors caused in memory time. The fidelity of a logical qubit, F L , is defined as where the error probability for memory time P M is defined as P e T M , and P QEC are the errors caused in memory time and QEC time, respectively [56]. P e is the error probability per unit time, and T G is the quantum gate operation error. The fidelity of a logical qubit can be decomposed of four parts. The first of these is unity because no error happens. The second means errors occurring during memory time. The third considers introduced errors during QEC time, T QEC , which is defined as the sum of encoding, detection, and correction times. The last takes account of the probability that the two errors in the data qubit occurring in QEC and memory time will cancel each other.
The fidelity gain, G=F L −F P , is the fidelity difference between the physical and logical qubit. A positive gain means that the accuracy of the logical qubit is improved at the same computing time. This model is limited to when the error is small even though it proposes the concept of computing time, which is beneficial to the logical qubit. Thus, it can estimate the critical points of QEC codes such as

Density matrix simulation
The density matrix simulation has several advantages to describe the behavior of qubits. In the simulation, Xand Z-type errors are considered differently. In addition, two qubit gates differentiate control and target the qubit, and the operation type. The errors are not described in a scalar value p anymore. The evolution of density matrix simulation takes two steps: faulty gate operation and independent qubit errors as described in figure 2. In faulty gate operations, perfect operation E 0 occurs with the probability 1−p, and imperfect operation E 1 occurs with the probability p as follows: where U ä {X, Y, Z, CNOT, SWAP}. The operation A is properly chosen by gate operation U gate and it becomes an identity matrix for the gates in a set U. The decoherence error during a gate operation is dealt with separately from the gate operation error.
The decoherence errors consist of T 1 relaxation, T 2 dephasing errors. The amplitude damping channel is [55]. The error probability γ is derived from the T 1 relaxation time. Similarly, the phase error model is given as [55]. The error probability 1−α is derived from the T 2 dephasing time. In idle time, relaxation errors are followed by dephasing errors.
The measurement basis is fixed to the X axis, so that the bit-flip error is reflected in simulated measurement. Nevertheless, the measurement time is not considered as a finite measurement time but as an instant operation. This is because measurement time as the last step is relatively short in many groupsgroups [50,[57][58][59]. The syndrome measurement is also omitted due to the limited number of qubits in near-term quantum devices.

Comparison with linear approximation model
To determine when density matrix simulation is advantageous and why the simulation is reliable, the increase in fidelity needs to be measured at the same memory time. Coherence time, T c , was assumed to be 1 to preserve the generality of the simulation. A controlled-Z gate was used as the primitive two-qubit gate with nearest neighbor interaction. Since the gate operation time was different for different systems, the ratio between the actual operation time and coherence time was used [59]. Qubits that make up QEC codes were subjected to individual dephasing processes and the gate operation error.
It is important to determine the precise maximum tolerable error rate before applying the QEC code. The linear approximation model provided a direct relationship between the fidelity of the logical qubit and error Figure 2. The evolution process of a density matrix for gate operation and dephasing is described. First, the density matrix is prepared in a pure state. Second, given quantum circuits, gate operation is applied to target qubits, which includes gate operation errors. Third, relaxation and dephasing errors during gate operation are reflected. Next, remaining quantum circuits are examined sequentially in the same way as for the second and third steps. After n operations, the faulty measurement is conducted. The measurement basis is fixed to the X axis, so that the bit-flip error is applied.
probabilities so that the range of memory time could be calculated. On the other hand, the density matrix calculation used the detailed procedures such as the initial state, the operations for QEC codes, and the layout of circuits. Hence, feasible simulation results were expected.
Before comparing the predictions of these two models, the importance of the initial state is briefly discussed. First and foremost, a near-term quantum device is easily affected by an initial state and an applied circuit. This is because it is regarded as a noisy quantum system that is highly sensitive to the surrounding environment and its gate operation accuracy is poor. Secondly, in the case of the linear approximation model, the amount of noise is subtracted from the fidelity of 1, while in the case of the density matrix simulation, a pure state or mixed state is required for evaluation. The initial state can be set as any state. It is not unreasonable to specify an initial state for QEC. This is because the preserved information is intentionally determined at first and the QEC code is used in order to prevent the noise. In addition, the bit-flip QEC does not work at all to correct the noise because there is no bit error.
These two models have a common goal that is to estimate the requirement when the logical qubit is beneficial. Considering the logical | ñ 1 state encoded by five-qubit QEC codeswith QEC time of 0.02 T c , the estimated minimum and maximum memory time for the linear approximation model were consistent with those for the density matrix model, which is shown in the figure 3(a). However, the expectation based on the linear approximation model was not always valid when the initial state became different, which is illustrated in figure 3(b). In this regard, the expected range based on the linear approximation model was not precisely determined. Nevertheless, the density matrix simulation model can evaluate the impact of the initial states so that the effectiveness of QEC codes for arbitrary states can be predicted.

Comparison with IBM QX results
The IBM quantum experience (IBM QX) provided 5 superconducting qubit systems, which were available to use via the IBM cloud platform. The average T 1 and T 2 coherence times of qubits were 54 μs and 44 μs, respectively [60]. The average accuracies of one-qubit and two-qubit gate operations were over 99.9%, and 99% respectively. The average operation times of H and CNOT gates were 50 ns and 122 ns, respectively. The three-qubit QEC circuit, described in figure 1, was chosen due to its simplicity.
If a QEC code works successfully, the fidelity of a logical qubit outperforms that of a physical qubit at the same memory time. If it fails, intersection of logical and physical qubit's fidelities does not exist. In figure 4, there is no cross point between a physical and logical qubit. It can be deduced that the QEC code does not work because physical qubits are not accurate enough. Thus, this result does not contradict the accuracy of the simulation. Nevertheless, there is a discrepancy between the fidelity of the simulation and the IBM QX data of the logical qubit. This could originate from the two-gate operation mechanism or the system of physical qubits, which is not available from the IBM QX. Overall, the IBM QX result was consistent with the simulation confirming that the performance of logical qubits can be predicted in the simulation. state the estimation from the linear approximation is comparatively wide.

QEC dependency
Using the density matrix simulation, it is possible to accurately evaluate how much fidelity gain the arbitrary QEC code can get. A lot of QEC codes are being suggested, but the circuitry for encoding and correction is different. Additionally, the depth of the circuits may increase depending on the type of primitive gate. These effects can be confirmed in advance. When evaluating the performance of QEC in general, the initial state was unknown or arbitrary. Nonetheless, a specific state was set in this study. This is because the purpose of the analysis of QEC codes here was to demonstrate that the QEC circuit worked successfully. While it was conceded that the versatility and generality was inadequate, it was still possible to confirm the viability of QEC codes in physical devices. In this study, the QEC codes, which required a small number of qubits were selected due to their possible implementation in the near future.
The simulation result for a logical qubit encoded by three-qubit QEC and five-qubit QEC is shown in figure 5. To compare QEC codes, the initial states, the gate operation time, connectivity of qubits, and gate error probability were considered to have the same values. In general, a negative gain will be obtained when the memory time is too short due to the errors during the QEC process. On the other hand, if the memory time is too long, both physical and logical qubit lose their quantum information, and the gain goes to zero. For the initial state | ñ 1 , the positive gain was increased as the gate error probability decreased, which is shown in figure 5(a). At the gate error of 0.1% and operation time of 0.001T c , the memory time should be between 0.45 and 1.1T c , and its maximum gain is 0.13. If the error probability is 0.01%, the maximum gain is increased to 0.25. Compared to the three-qubit QEC code, the maximum gain is merely 0.05, which is shown in figure 5(c).
The five-qubit QEC also showed better performance for states having relative phase. This was because | ñ 1 state only suffered from T 1 dephasing. The initial state of ( ) | ñ p R 1 was affected by both bit and phase flip errors. If a logical state is encoded by a five-qubit QEC, the maximum gain is up to 0.14, which is illustrated in figure 5(b). On the other hand, bit-flip three-qubit QEC did not have any positive gain, shown in figure 5(d). Therefore, the five-qubit QEC is expected to correct both bit and phase errors, and higher fidelity is obtained.

Layout dependency
The second application was to evaluate the QEC codes in arbitrary connected qubit layouts. In the current technology, it is difficult to have a structure in which all qubits are connected to each other. That causes an additional burden for successfully performing QEC codes. This is because partial connection among qubits demands additional imperfect SWAP gates. The connection problem becomes important not only for large-size QEC codes but also for three-qubit QEC codes. A SWAP gate can be composed of 3 CNOT gates. A Toffoli gate is decomposed into 6 controlled-Z gates, two SWAP gates, and multiple single qubit gates. Hence, it is worth knowing the impact of the overhead cost on the fidelity.
The five-qubit QEC codes are illustrated in figure 1(b). We considered two layouts: X layout in figure 6(a) and linear layout in figure 6(b), which are promising candidates for fabricating qubits [61,62]. Considering nearest neighbor interaction, the data qubit should be placed at the center of both layouts so that the minimum number of SWAP gates is introduced. Although the X layout, where ancilla qubits are next to the data qubit, is close to the all-to-all connected circuit, a decomposed Toffoli gate asks for two SWAP gates that is shown in figure 6(c). Qubit A1 and A2, located next to the data qubit, preserve phase flip error in the data qubit. Qubit A3 and A4, placed at each end, preserves bit flip error in the data qubit. The final circuit of figure 1(b) is depicted in figure 6(d). As shown in figure 7, the increased operation time yielded the lower gain. Considering the 99% (99.9%) accuracy of gate operations, the all-to-all connected layout had the maximum gain of 0.15 (0.17), and the X and 1D linear layout had the maximum gain of 0.13 (0.16) and 0.12 (0.16), respectively. According to the gate accuracy, the all-to-all connected layout of 99% and the 1D layout of 99.9% gave almost the same results. Consequently, the additional burden should be properly considered for the qubit connection.

Evaluation of physical qubits
The last application example was to evaluate the performance of physical qubits. Even though many qubit systems are proposed and implemented, it is difficult to evaluate each of them for obtaining high fidelity gain. Thus, our simulation allowed us to evaluate the performance of a logical qubit according to the gate operation and coherence time. The number of operations was considered as the ratio between them. To evaluate the expected performance of logical qubits encoded by five-qubit QEC codes, recent superconducting qubits [50,57] and quantum dot qubits [58,59] were used. The data is summarized in table 1. Even though five qubits in the quantum dot system have not been fabricated yet, it was assumed that hypothetical five qubits were placed in the layouts.
In the simulation, the reported operation and coherence time was used. All one-qubit gates were assumed to have the same operation time, and a two-qubit gate was considered as controlled-Z. For the gate accuracy of 99% respectively. This implied that the number of possible gate operations was increased. For example, at the same 90% fidelity, physical qubits conducted 230 gates, while logical qubits did 330-520 gates, assuming transversal logical gates.

Conclusion
In this study, we analyzed the feasibility of which QEC codes are appropriate for implementation and how effective the QEC codes are for near-term quantum devices using density matrix simulation. The density matrix model was found to be beneficial for several reasons. Firstly, dephasing errors, determined by physical parameters such as T 1 , T 2 coherence time, are reflected. Secondly, gate operations are treated in an imperfect operation and decomposed into equivalent primitive gate circuits. Finally, successive errors for dephasing and gates depending on their type can be traced in a density matrix form. In this work, we looked at the existence, importance and benefits of using QEC codes. It is expected to represent a milestone for implementing logical qubits operating for longer computing times. Based on these advantages, we suggest three application examples: the evaluation of arbitrary QEC codes, the interaction of qubit layouts with nearest neighbors, and an evaluation of the maximum tolerable error rate of QEC codes affecting the accuracy of gate operation of qubits. Considering the conditions described above, we investigated how to obtain the longest computing time in density matrix simulation, using three-qubit QEC codes. Given the error probability of 0.1%, the gain for using a logical qubit was up to 0.25 for | ñ 1 .  Figure 8. The expected performance evaluation of physical qubits and logical qubits of superconducting qubits and quantum dot qubits, which were encoded by five-qubit QEC codes. The initial state was | ñ 1 state. The reported gate operation times were used [50,[57][58][59]. The fidelities of logical qubits composed of superconducting (quantum dot) qubits of 1% gate error and 0.1% gate error are blue hexagons (green circles) and light blue hexagons (light green circles), respectively.