# Convolutional-Neural-Network-Based Hexagonal Quantum Error Correction Decoder
## 2 Background  
A surface code is a type of stabilizer code whose layout is created by arranging and combining four-dimensional square matrices defined on a two-dimensional plane [23]. In the structure of a heavy hexagonal code, the degrees of the qubits are usually two (i.e., they can only interact with two qubits) and three, with most of them being of degree two. Heavy hexagonal codes are a hybrid of surface and Bacon-Shor codes [24] and significantly increase the average qubit density while retaining qubits of degree four compared to the surface code structure. The lattice of heavy hexagonal codes is used to encode logical qubits, with \"heavy\" indicating that the qubits are located at the vertices and edges of the hexagonal lattice. The heavy hexagonal code is a special type of subsystem code [25] that combines elements from both the surface code and the Bacon-Shor code. Subsystem codes can be defined through the use of stabilizer groups, which are mathematical constructs that describe how to detect errors and preserve quantum information. The stabilizer group can be represented by the tensor product of n one-dimensional Pauli operators. \[P_{n}=\{w_{1}\otimes w_{2}\otimes\cdots\otimes w_{n}:w_{i}\in\{I,X,Y,Z\}(1\leq i \leq n)\}. \tag{1}\]  
Like other error-correcting codes, heavy hexagonal codes are also defined by a set of gauge operators, denoted by \(\mathcal{G}\). Since the code space in a subsystem code consists of multiple equivalent subsystems [26], the role of the gauge operator is to bring a codeword to an equivalent subsystem. In the heavy hexagonal code structure, logical information is encoded and protected in a subsystem, and the Hilbert space of the entire codeword will be expanded into a larger Hilbert space, which is beneficial to the protection subsystems that are immune to noise [27]. The gauge operators for the heavy hexagonal code are similar to other quantum error-correcting codes and are also represented by Pauli operators. Next, we give the gauge operator definitions for the heavy hexagonal code:  
\[ \begin{split}\mathcal{G}=&\langle Z_{i,j}Z_{i+1,j},X_{ i,j}X_{i,j+1}X_{i+1,j}X_{i+1,j+1},\\ & X_{1,2m-1}X_{1,2m},X_{d,2m}X_{d,2m+1}\rangle.\end{split}  \tag{2}\]  
Here, \(i\) and \(j\) are used to represent the row index and column index, respectively, and \(i\),\(j=1,2\),..., \(d\)-1,\(m=1,2\),..., \((d-1/2)\). The constraint is that \(i+j\) is even for the second term. Figure 1 is a schematic diagram of the lattice layout of the heavy hexagonal code with \(d=5\) and the controlled-NOT (CNOT) gates coding for the syndrome measurement. As shown in the figure, it is mainly composed of two areas, where the red areas are composed of weight-four \(X\)-type gauge generators and weight-two \(X\)-type gauge generators (red area), and the blue areas are composed of weight-two \(Z\)-type gauge generators (blue area). The \(X\)-type and \(Z\)-type gauge generators are used to correct for bit flips and phase errors, respectively. As previously stated, the heavy hexagonal code belongs to the family of stabilizer codes, and its stabilizer group is defined as follows:  
\[ \begin{split}\mathcal{S}=&\langle Z_{i,j}Z_{i+1,j}Z_{ i+1,j+1},Z_{2m-1,d}Z_{2m,d},\\ & Z_{2m,1}Z_{2m+1,1},\Pi_{i}X_{i,j}X_{i,j+1}\rangle,\end{split}  \tag{3}\]  
where \(Z_{i,j}Z_{i,j+1}Z_{i+1,j}Z_{i+1,j+1}\) is a weight-four stabilizer. The measurement outcome of the stabilizer is the product of the measured eigenvalues of the two weight-two gauge generators \(Z_{i,j}Z_{i+1,j}\)and \(Z_{i,j+1}Z_{i+1,j+1}\), with the constraint that \(i+j\) is even for the first term. As shown in Figure 1, the left and right boundaries of the heavy hexagonal code are composed of weight-two surface-type stabilizer operators, and the top and down boundaries are composed of Bacon-Shor type stabilizers. The middle areas are mainly composed of bulk operators with a weight of four.