1 Introduction

Quantum error correction codes play an important role in quantum communication as they can resist quantum noise and improve the reliability of quantum communication.

The 9-bit quantum encoding proposed by Shor in 1995 can correct single-bit phase-flip error or bit-flip error [1], which is considered the first attempt on quantum error correction. On this basis, Calderbank, Shor and Steane proposed a basic quantum block coding framework using the idea of classical linear block error correction codes and two special classical binary error correction codes in 1996 [2, 3]. This quantum error correction code is called Calderbank–Shor–Steane (CSS) code. In the same year, Gottesman proposed the quantum stabilizer codes using the stabilizer formalism to protect the target qubits from the noise of channels [4].

In recent years, several kinds of quantum error correction codes developed from stabilizer codes are proposed and developed. The surface code requires only nearest-neighbour interactions so that it has comparatively high threshold [5, 6]. Toric codes use tensors to construct geometric-looking codes with highly non-trivial properties [7, 8]. The complex code constructions are represented as tensor networks built from the tensors of simple codes or states in a modular fashion [9]. Graph states are used to provide a fruitful approach to the construction and characterization of topological quantum error correction codes [10]. The approaches mentioned above are naturally local, which make them appealing for practical implementations with locality constraints. When we hope to transmit a series of quantum states, using quantum convolutional codes is a better choice. Quantum convolutional codes can link information transmitted back and forth with uncomplicated quantum circuits.

Quantum convolutional codes are proposed to protect quantum information and achieve reliable quantum communication by combining traditional coding and quantum information. In the beginning, Chau proposed a type of quantum convolutional code based on classical convolutional codes in 1998 [11]. Then, based on the concept of traditional convolutional codes [12], quantum convolutional codes are constructed using the CSS code framework and methods of the stabilizer codes. Ollivier and Tillich first described quantum convolutional codes in 2003, using stabilizer forms and providing an explicit encoding circuit [13]. Forney proposed a tail-biting quantum convolutional code, which has a higher rate and lower decoding complexity [14, 15].

In recent years, improved quantum convolutional codes have been proposed, but they are all focused on improving the ability of codewords and reducing complexity [16,17,18,19]. However, the errors generated during the transmission of qubits cannot all be described as phase-flip errors or bit-flip errors. Consider a more complicated situation where the errors are continuous. Lately, continuous quantum error correction attracts great attention. We hope to extend the quantum convolutional code so that it can handle continuous quantum errors.

To correct the continuous errors, Gottesman, Kitaev and Preskill proposed an encoding mode that encodes quantum information in a harmonic oscillator, which is inherently fault-tolerant [20]. Such kind of quantum code is called the GKP code, and it works well in dealing with continuous quantum errors.

In this paper, we proposed a quantum convolutional code concatenated with the GKP codes to correct the continuous quantum errors. Furthermore, we also proposed an algorithm to enhance the error correction capability of the code.

2 Basic concepts

To construct a quantum convolutional code that can deal with continuous errors, we have to change the structure of existing quantum convolutional codes. The GKP code is a typical and practical case for protecting the qubits from small shift errors which are continuous. In this case, we attempt to concatenate the quantum convolutional codes with the GKP code to give them the capacity to correct continuous errors. This section will briefly introduce quantum convolutional codes and the GKP code.

2.1 Quantum convolutional codes

Quantum convolutional codes use the stabilizer formalism which was first proposed by Gottesman [21, 22]. The error syndrome is defined by the Pauli matrix.

(1)

Pauli matrix \({\mathbf {X}}\) refers to bit flipping, \({\mathbf {Z}}\) refers to phase flipping, and \({\mathbf {Y}}\) refers to both. The code subspace \({\mathcal {C}}\) of any stabilizer codes is defined as the largest subspace stabilized by an Abelian group \({\mathcal {S}}\) acting on the N physical qubits of the code. In practice, \({\mathcal {S}}\) is a subgroup of the multiplicative Pauli group \({\mathcal {G}}_{N}={\text {sp}}\{I, X, Y, Z\}^{\otimes N}\) [23]. The code subspace \({\mathcal {C}}\) can be defined by a set of independent generators \(\left\{ M_{i}\right\} \) of \({\mathcal {S}}\):

$$\begin{aligned} \forall i,|\psi \rangle =M_{i}|\psi \rangle \Leftrightarrow |\psi \rangle \in {\mathcal {C}} \end{aligned}$$
(2)

An \(\left[ n,k,m \right] \) stabilizer code is possible to encode k qubits of quantum information in n qubits and correct at most \((m-1)/2\) errors. Similarly, the stabilizer group S for an \(\left[ n,k,m \right] \) convolutional code can be given by:

$$\begin{aligned} {\mathcal {S}}={\text {sp}}\left\{ M_{j, i}=I^{\otimes j \times n} \otimes M_{0, i}, 1 \le i \le n-k, 0 \le j\right\} \end{aligned}$$
(3)

where \(M_{0, i} \in {\mathcal {G}}_{n+m}\). Above \(M_{j, i}\)’s are required to be independent and to commute with each other. The encoding circuit mapping the to-be-protected qubits \(c_{j, i}\) onto the code subspace is written as follows:

$$\begin{aligned} \left| c_{0,1}, \ldots , c_{q-1, k}\right\rangle \rightarrow \left( \prod _{i, j} \frac{1+M_{j, i}}{\sqrt{2}}\right) \prod _{r, s} \bar{X}_{s, r}^{c_{s, r}}|0, \ldots , 0\rangle \end{aligned}$$
(4)

for \(c_{s, r} \in \{0,1\}, 0<i \le n-k, 0 \le j<q+\lambda , 0 \le s<q\) and \(1 \le r \le k\). The \(\bar{X}_{i}\) operator is the encoded Pauli operator \({\mathbf {X}}\). This operation can be decomposed into two steps. First, \(\prod _{r, s} \bar{X}_{s, r}^{c_{s, r}}\) applies the different flip operators depending on the value of the to-be-protected qubits on the computational basis. Second, this state is projected onto the code subspace.

Take the [5,1,2] convolutional code, for example, [24]. The generator matrix of the stabilizer group can be written as:

(5)

From the generator matrix, it is easy to obtain the encoding circuit as Fig. 1 [24].

Fig. 1
figure 1

Circuit for encoding the first three qubits of a stream of quantum information with the 5-qubit convolutional code

To estimate the error at the receiver, the quantum Viterbi algorithm was introduced. The algorithm examines the syndromes block by block and updates a list of error candidates among which one of them coincides with the most likely error. Through the algorithm, the most likely error can be selected and then corrected.

2.2 The GKP code

The GKP code was designed to protect the qubits from small continuous shift errors by encoding the qubit \(\left| 0 \right\rangle \) and qubit \(\left| 1 \right\rangle \) with the harmonic oscillator [20]. For a harmonic oscillator, the position and momentum operators are defined as \(\hat{q} \) and \(\hat{p} \) quadratures. Their eigenstates are called quadrature states, which are defined as \(\left| q \right\rangle \) and \(\left| p \right\rangle \) with the Fourier transformation relation written as:

$$\begin{aligned} \left| q \right\rangle =\int \frac{dp}{\sqrt{2\pi } } e^{ipq} \left| p \right\rangle \end{aligned}$$
(6)

The arbitrary errors will influence both quadratures as they cannot be separated. Consider the errors u and v occur on the \(\hat{q} \) and \(\hat{p} \) quadratures. The affect can be written as

$$\begin{aligned} \left| q+u \right\rangle =e^{-iup} \hat{q},\left| p+v \right\rangle =e^{-ivq} \hat{p} \end{aligned}$$
(7)

where qp are arbitrary real numbers representing the original quantum state and uv are arbitrary real numbers representing the shift error. With the property of the harmonic oscillator, the logical \(\left| 0 \right\rangle \) and \(\left| 1 \right\rangle \) expanded in the quadrature states \(\left| q \right\rangle \) and \(\left| p \right\rangle \) can be defined as:

$$\begin{aligned} |\overline{0}\rangle&= \sum _{n} \delta (q-2 n \sqrt{\pi })|q\rangle = \frac{1}{\sqrt{2}} \sum _{n} \delta (p-n \sqrt{\pi })|p\rangle \end{aligned}$$
(8)
$$\begin{aligned} |\overline{1}\rangle&= \sum _{n} \delta (q-(2 n+1) \sqrt{\pi })|q\rangle = \frac{1}{\sqrt{2}} \sum _{n}(-1)^{n} \delta (p-n \sqrt{\pi })|p\rangle \end{aligned}$$
(9)

Apart from the encoding qubits, the quantum gates also need to be defined. In quantum stabilizer code, the X operator can turn \(\left| 0 \right\rangle \) state to \(\left| 1 \right\rangle \) state and turn \(\left| 1 \right\rangle \) state to \(\left| 0 \right\rangle \) state. The Z operator can turn \(\left| 1 \right\rangle \) state to -\(\left| 1 \right\rangle \) state and keep the \(\left| 0 \right\rangle \) state the same. In this case, the logic X and logic Z gates in \(\hat{q} \) and \(\hat{p} \) quadratures are written as [25] :

$$\begin{aligned} \overline{ X }=e^{-i \sqrt{\pi } \hat{p}} ,\quad \overline{ Z }=e^{i \sqrt{\pi } \hat{q}} \end{aligned}$$
(10)

It is easy to prove that the X and Z gates have the same action as them in quantum stabilizer codes. Similarly, the Clifford gate under the quadratures of \(\hat{q} \) and \(\hat{p} \) can act as:

$$\begin{aligned} \begin{aligned} \text{ Hadamard: }&\hat{q} \longrightarrow \hat{p}, \hat{p} \longrightarrow -\hat{q} \\ \text{ CNOT: }&\hat{q_{1}} \longrightarrow \hat{q}_{1}, \hat{p}_{1} \longrightarrow \hat{p}_{1}+\hat{p_{2}} \\&\hat{q_{2}} \longrightarrow \hat{q}_{2}-\hat{q}_{1}, \hat{p}_{2} \longrightarrow \hat{p}_{2} \\ \text{ Phase } \text{ S: }&\hat{q} \longrightarrow \hat{q}, \hat{p} \longrightarrow \hat{p}-\hat{q} \end{aligned} \end{aligned}$$
(11)

To correct the shift errors, Steane proposed an error correction circuit using an ancilla qubit and the CNOT gate to perform the homodyne measurement [26]. It can correct small shift errors of position or momentum quadrature fault-tolerantly. There are two kinds of ancilla qubits defined as

$$\begin{aligned} |\overline{+}\rangle&= \sum _{n} \delta (p-2 n \sqrt{\pi })|p\rangle = \sum _{n}|p = 2 n \sqrt{\pi }\rangle \end{aligned}$$
(12)
$$\begin{aligned} |\overline{-}\rangle&= \sum _{n} \delta (p-(2 n+1) \sqrt{\pi })|p\rangle = \sum _{n}|p = (2 n+1) \sqrt{\pi }\rangle \end{aligned}$$
(13)

Since \(\left| p \right\rangle \) and \(\left| q \right\rangle \) are orthogonal and independent, we consider that the input state in the \(\left| q \right\rangle \) has only a shift error \(u_{1}\), while the ancillary state is affected by the shift error \(u_{2}\). Normalize the input qubits and ancilla qubits. The initial state of the combined system is

\(e^{-iu_{1}\hat{p} _{1} } e^{-iu_{2}\hat{p} _{2} } \left| \overline{\psi } \right\rangle \left| \overline{+} \right\rangle \)

Using the CNOT gate, the error correction circuit can be proposed as in Fig. 2:

Fig. 2
figure 2

Circuit of Steane error correction for shift errors in \(\hat{q} \) quadrature

After error correction, we can measure that \(q_{out}=u_{1}+u_{2}+n\sqrt{\pi }\), \(q_{\text{ cor } }=q_{\text{ out } } \bmod \sqrt{\pi }\). Then, the errors on the \(\left| q \right\rangle \) are transferred:

$$\begin{aligned} u_{1} \rightarrow -u_{2} \end{aligned}$$
(14)

In this way, the errors can be reduced with the limitation that \(\left| u_{1}+u_{2}\right| \le \sqrt{\pi } / 2\).

3 Methods

In quantum convolutional codes, the possible errors have three types: bit-flip errors, phase-flip errors and both kinds of errors occurred at the same time. We hope to make the encoding formalism suitable for continuous errors which have the form:

$$\begin{aligned} |\overline{0}\rangle \overset{{\mathcal {N}} }{\longrightarrow } \alpha _{0} |\overline{0}\rangle +\beta _{0} |\overline{1}\rangle \end{aligned}$$
(15)
$$\begin{aligned} |\overline{1}\rangle \overset{{\mathcal {N}} }{\longrightarrow } \alpha _{1} |\overline{0}\rangle +\beta _{1} |\overline{1}\rangle \end{aligned}$$
(16)

where \(\alpha _{i}^{2}+\beta _{i}^{2}=1\). Obviously, a \(\left| 0 \right\rangle \) state or a \(\left| 1 \right\rangle \) state will be transformed into a superposition state of \(\left| 0 \right\rangle \) and \(\left| 1 \right\rangle \) after the noisy channel \({\mathcal {N}} \). When the quantum state is measured, it will collapse to \(\left| 0 \right\rangle \) state or \(\left| 1 \right\rangle \) state with a certain probability and may lead to the wrong result.

To reduce the errors occurred in the measurement, we use the GKP code to resist small shift errors. Moreover, we concatenate the quantum convolutional code with the GKP code in order to reduce the error probability more effectively. Here, we use the [4,2,2] stabilizer code with the generator matrix G=[1 0 0 1 0 1 1 0 ; 1 1 1 1 1 0 0 1] for example.

Then, we provide the circuit model as Fig. 3. In the circuit, all the input quantum states are prepared in standard GKP states. The \(\left| \delta _{i}\right\rangle \) states are target qubits which need to be protected, and the \(\left| 0\right\rangle \) states refer to ancilla qubits. The block of GSC refers to the Gaussian shift channel. The block of QEC refers to the Steane error correction proposed in Fig. 2. The \(\left| \delta _{o}\right\rangle \) states are the final output of the circuit. As error types are limited in the early quantum convolutional codes, they can be decoded using the Viterbi algorithm to determine the error syndrome. But it does not work when the errors are continuous. So we use the decoding circuit after Steane error correction.

Fig. 3
figure 3

[4,2,2] stabilizer code concatenated with the GKP code

As the encoding circuit is based on stabilizer formalism, we choose the standard decoding circuit of stabilizer codes [23]. The decoding circuit is the inverse circuit of the encoding circuit. It can be represented as follows.

$$\begin{aligned} \prod _{i=1}^{K}\left( \bar{X}_{i}\right) ^{\delta _{i}} \prod _{l=1}^{K} X_{a_{l}}^{\delta _{l}}\left| \overline{\delta _{1} \ldots \delta _{K}}\right\rangle \otimes |0 \ldots 0\rangle _{K}=|\overline{0 \ldots 0}\rangle \otimes \left| \delta _{1} \ldots \delta _{K}\right\rangle \end{aligned}$$
(17)

\(X_{a_{l}}^{\delta _{l}}\) refers to the Pauli gate X acting on the l-th qubit in \(|0 \ldots 0\rangle _{K}\) when \(\delta _{1}\) is 1.

In session 2.2, we pointed out that the logic X and logic Z gates have the same action as them in quantum stabilizer code. There is no doubt that the circuit also works under the GKP states.

Fig. 4
figure 4

Circuit of [4,2,2] quantum convolutional codes concatenated with the GKP code

To reflect the property of convolutional codes, the generator matrix of every single part should be associated with the previous one as G=[\( D^{-1}\) 0 0 1 0 1 1 0 ; 1 1 1 1 1 0 0 1]. The whole circuit is the combination of several single circuits. The combination of two single circuits is shown in Fig. 4. Longer circuits are also generated in this way.

For a single circuit, 4 independent input qubits turn into a 4-qubit entangled state via the controlled quantum gates. Table 1 shows the corresponding encoded states of different input states after the encoding circuit. The decoding circuit turns the ancilla qubits \(\left| 00 \right\rangle \) to the corresponding input state and the encoded state \(|\bar{00}\rangle \), where \(|\bar{00}\rangle = \frac{1}{2}(\left| 0000 \right\rangle +\left| 1001 \right\rangle +\left| 0110 \right\rangle +\left| 1111 \right\rangle )\).

Table 1 Evolution in encoding circuit

We define the encoded state \(|\bar{00}\rangle \) as ancillary zero state. Because of the noisy channel, the decoded state might be different from the input state, so we use an algorithm making use of the ancillary zero state to further reduce the error probability. With the influence of the noisy channel, the ancillary zero state may also be wrong. The error probability of ancillary zero state and decoded state is strongly related. Thus, we can deduce whether the decoded state is reliable by measuring the ancillary zero state.

First, we use the same decoding circuit on the ancillary zero state. If the output state of ancillary zero state is not \(|00\rangle \), we consider the result of the decoding circuit on the target qubits incorrect. So we apply the CNOT gate between the output of ancillary zero state and the output of the target qubits to correct the error. The latter error correction circuit is shown in Fig. 5.

Fig. 5
figure 5

Circuit to further reduce error with the ancillary zero states

Fig. 6
figure 6

Circuit to further reduce error with the ancillary zero states with two iteration times

The \(*\) after \(\left| \bar{00} \right\rangle \) denotes that the state should be \(\left| \bar{00} \right\rangle \) if there is no error. \(\left| \varphi _{i} \right\rangle \) denotes the decoded state in the previous circuit, and \(\left| \varphi _{o} \right\rangle \) is the final output.

It is obvious that the error correction circuit based on ancillary zero state can be iterated several times as the errors cannot be eliminated. The circuit with two iteration times is provided in Fig. 6.

As the figure shows, we use CNOT gates and Toffoli gates to achieve the iteration circuit. The Toffoli gate achieves the function that the target qubit is flipped if both control qubits are set to \(|1\rangle \). The matrix of Toffoli gate [27] is :

(18)

Any of the corresponding output qubits of the ancillary zero states are ought to be \(\left| 0 \right\rangle \). If it is not, the corresponding \(\left| \varphi _{i} \right\rangle \) is assumed to be wrong. So we apply bit-flip operation to correct it.

With the number of iteration times increasing, the accuracy may increase at first. But with the correlation between ancillary zero states and the previous output decreasing, the reliability of the result goes down. It is necessary to find a compromise by simulation.

4 Simulation and analysis

4.1 BER analysis

In order to verify the correctness of the algorithm, we applied simulation to prove it. We use the [4,2,2] quantum convolutional codes in simulation. The generator matrix of the code is which we used before: G=[\( D^{-1}\) 0 0 1 0 1 1 0 ; 1 1 1 1 1 0 0 1]. We defined the error model:

$$\begin{aligned} \left| \bar{0} \right\rangle \rightarrow \left| \bar{0 } +u_{0} \right\rangle , \left| \bar{1} \right\rangle \rightarrow \left| \bar{1 } +u_{1} \right\rangle \end{aligned}$$
(19)

\(u_{0}\) and \(u_{1}\) are the normalized noise. We use u to represent the arbitrary noise below. The judgment is correct when \(|u|<0.5\), and the judgment is wrong when \(|u|\ge 0.5\). As the power of \(\left| \bar{0} \right\rangle \) and \(\left| \bar{1} \right\rangle \) is normalized, we define the Eb/No as \(10\lg _{}{(1/u)} \). Use the Steane error correction method to correct the error. The error on the ancilla qubit used for error correction is \(u_{2}\). The ratio of \(u_{2}\) and u is called the ancillary qubit error ratio.

In the simulation, we assume that the encoding and decoding processes are without noise. The noise occurs in the Gaussian shift channel which brings error to the quantum states. We use Eb/No to describe the noise. It is the ratio of the energy of the encoded quantum states to the energy of noise in the form of dB. The ancilla qubit is also with noise which is described by the Eb/No and ancillary qubit error ratio. Figure 7 shows the performance of the whole circuit under different ancillary qubit error ratios. With the increase of the Eb/No from 1 dB to 3 dB, the BER interval is \([10.71\%,0.12\%]\) without the Steane error correction circuit. When the ancillary qubit error ratio of the Steane error correction is \(50\%\), the BER interval is \([13.27\%, 0.049\%]\). When the ancillary qubit error ratio of the Steane error correction is \(40\%\), the BER interval is \([10.63\%,0.019\%]\). When the ancillary qubit error ratio of the Steane error correction is \(30\%\), the BER interval is \([9.2\%,0.018\%]\). If we hope to achieve the BER of less than \(1\%\) with a \(30\%\) ancillary qubit error ratio, the Eb/No is required to be larger than 2 dB. If we hope to achieve the BER of less than \(0.1\%\) with a \(30\%\) ancillary qubit error ratio, the Eb/No is required to be larger than 2.7 dB.

Fig. 7
figure 7

Bit error rate of [4,2,2] quantum convolutional codes with different ancillary qubit error ratios

The curve shows that the smaller the ancillary qubit error ratio, the lower the bit error rate. However, there are two crosses in the figure. The left one happens in low Eb/No between the curve without ancilla qubits and the curve whose ancillary qubit error ratio is 0.5. The noise of the qubit needs to be protected, and the noise of the ancilla qubit is independent. In low Eb/No, the big ancillary qubit error ratio such as 0.5 cannot feed the condition that \(\left| u+u_{2}\right| \le \sqrt{\pi } / 2\) which leads to higher BER. The right cross happens because the amount of simulation data limited by the insufficient machine computation capability is not big enough.

Fig. 8
figure 8

Influence of different iteration times of the error correction circuit with [4,2,2] quantum convolutional code

Fig. 9
figure 9

Influence of different iteration times of the error correction circuit with [8,3,3] quantum convolutional code

As described above, we use a correction circuit to further reduce the error. However, the number of suitable iteration times is uncertain. We provide the result of the simulation in Fig. 8 showing the most suitable iteration times. The ancillary qubit error ratio of Steane error correction in the simulation is set to \(40\%\).

As shown in Fig. 8, the result is just consistent with speculation. With the increase of the Eb/No from 1 dB to 3 dB, the BER interval is \([10.63\%,0.019\%]\) without the correction circuit. The BER interval with 1 iteration time is \([6.34\%,0.008\%]\). The BER interval with 2 iteration times is \([5.81\%,0.002\%]\). The BER interval with 3 iteration times is \([6.83\%,0.006\%]\). The BER interval with 4 iteration times is \([8.78\%,0.013\%]\). When the iteration time is no more than 2, the qubit error rate goes down with the iteration times go up. When the number of iteration times reaches 3, the effect becomes worse.

Table 2 shows the gain in Eb/No under different BER standards. From the table, we can see that the algorithm performs better when the required BER is less than \(1\%\) as it provides less gain in Eb/No when the required BER is \(5\%\). When it is hard to enhance the Eb/No, using the further error correction circuit can help achieve higher precision.

Table 2 The gain in Eb/No under different BER standards

To confirm our speculation more powerfully, we also conduct the simulation of [8,3,3] convolutional codes in Fig. 9. The generator of the code can be listed as follows:\(\mathrm {g} _{1} =\mathrm {X_{1} X_{2} X_{3} X_{4} X_{5} X_{6} X_{7} X_{8}}\), \(\mathrm {g} _{2} =\mathrm {Z_{1} Z_{2} Z_{3} Z_{4} Z_{5} Z_{6} Z_{7} Z_{8}}\), \(\mathrm {g} _{3} =\mathrm {X_{2} X_{4} Y_{5} Z_{6} Y_{7} Z_{8}}\), \(\mathrm {g} _{4} =\mathrm {X_{2} Z_{3} Y_{4} X_{6} Z_{7} Y_{8}}\), \(\mathrm {g} _{5} =\mathrm {Y_{2} X_{3} Z_{4} X_{5} Z_{6} Y_{8}} \). As shown in Fig. 9, the lowest curve also refers to 2 iteration times.

We show the simulation of both codes under 2.5 dB with different iteration times in Fig. 10. It is clear that we obtain the lowest BER at 2 iteration times.

Fig. 10
figure 10

Bit error rate of [4,2,2] code and [8,3,3] code under 2.5 dB with different iteration times

4.2 Resource consumption

Table 3 shows the resources needed for the whole circuit for every two target qubits. We use 2 ancilla qubits, 2 Hadamard gates and 6 controlled Pauli gates to encode 2 target qubits into a 4-qubit entangled state. The resources for decoding include the Steane error correction circuit and the decoding circuit. The Steane error correction circuit uses 1 ancilla qubit to reduce the error probability via a CNOT gate for each qubit in the entangled state. For the decoding circuit, we apply 9 controlled Pauli gates on 2 ancilla qubits to turn the encoding states into a 4-qubit entangled state \(|\bar{00}\rangle \) and 2 decoded qubits which should be the same as the target qubits.

The resources used in the further error correction circuit are also listed in the table. As the circuit is the same as the decoding circuit, it uses 2 ancilla qubits and 9 controlled gates. If we apply the circuit once, we use 2 CNOT gates to correct the errors. If we apply the circuit twice, we use 2 Toffoli gates and 6 Hadamard gates to correct the errors.

Table 3 Resources used in the whole circuit for every two target qubits
Fig. 11
figure 11

The gain of BER reduction of [4,2,2] code caught by different iteration times

Consider the situation that we apply the [4,2,2] code under 2.5 dB with a \(30\%\) ancillary qubit error ratio. If we only use the encoding and decoding circuit, the BER is \(0.37\%\) with 8 ancilla qubits, 2 1-qubit quantum gates and 19 2-qubit quantum gates. If we apply the further error correction circuit once, the BER reaches \(0.14\%\) with 8 ancilla qubits, 2 1-qubit quantum gates and 30 2-qubit quantum gates. BER can reach \(0.12\%\) using the further error correction circuit twice with 10 ancilla qubits, 8 1-qubit quantum gates, 37 2-qubit quantum gates and 2 3-qubit quantum gates.

Considering the resource consumption, the best iteration time is uncertain. We estimate the gain rate of the error correction circuit with different iteration times. As shown in Fig. 11, the gain rate brought by the first iteration is much larger than that brought by the second iteration. We suggest using the error correction circuit once to balance BER and resource consumption. When a higher correctness probability is required, using the circuit twice is optimal.

5 Conclusion

Based on the existing concept of quantum convolutional codes, this paper proposes an error correction method in the case of continuous errors. Because all output qubits will be transformed into superposition states of \(\left| \bar{0} \right\rangle \) and \(\left| \bar{1} \right\rangle \) under continuous errors, they will collapse to \(\left| \bar{0} \right\rangle \) state or \(\left| \bar{1} \right\rangle \) state with a certain probability after measurement, so the output of the same input is jointly measured at the output, and then, the result is obtained via classical Viterbi decoding. As the errors are continuous, it is suitable to use the GKP codes in encoding. The \(\left| \bar{0} \right\rangle \) state, \(\left| \bar{1} \right\rangle \) state and the operators in the encoding circuit are all encoded in the standard form of GKP formalism before the encoding circuit, and Steane error correction is performed at the receiver and then decoded by the decoding circuit. When the error probability is small in the ancilla qubits, the GKP code has a great enhancement to the encoding method.

Furthermore, we make use of the output information of the decoding circuit to construct an error correction circuit after the original decoding circuit. This circuit can further reduce the error probability and can iterate several times. However, the most suitable iteration times cannot be deduced only by the algorithm. So we conduct a simulation to find out the best number. We confirm our speculation with another group of quantum convolutional codes. From the simulation, we deduce that the lowest BER is reached at 2 iteration times. Considering the resource consumption, using the error correction circuit only once is the optimal choice.