I am trying to familiarize myself with QEC codes and their use in quantum communication. Right now, I am trying to implement some more widely known codes in Qiskit. My main problem is I cannot wrap my head around that how I create the circuit depending on the stabilizer generators. For example, how do I get the circuit seen in the attached figure (https://quantumcomputinguk.org/tutorials/quantum-error-correction-shor-code-in-qiskit) from: \begin{align} \begin{split} Z_{j0}Z_{j1}I_{j2} &\rightarrow \{Z_0Z_1, Z_3Z_4, Z_6Z_7\} \\ Z_{j0}I_{j1}Z_{j2} &\rightarrow \{Z_0Z_2, Z_3Z_5, Z_6Z_8\} \\ X_0 X_1I_2 &\rightarrow \{X_0X_1X_2X_3X_4X_5\}\\ X_0 I_1X_2 &\rightarrow \{X_0X_1X_2X_6X_7X_8\}. \end{split} \tag*{(4)}\end{align}
1 Answer
You have not specified what $j$ is in your question. The section before the first vertical dotted line is the encoding circuit. You can use the stabilizer formalism to see that this encoding circuit generates the stabilizer of the Shor code if the ancilla qubits (labeled q1-q8) start in the $\vert 0 \rangle$ state. You can check all 8 stabilizers by starting of with a single $Z$ stabilizer at the start of the circuit.
For example, the propagation of the purple $Z$ generates the stabilizer $Z_1Z_2$. The green $Z$ generates $Z_3Z_5$..The red $Z$ generates $X_1X_2X_3X_4X_5X_6$.
Personally I find the easiest way to understand the circuit is to note that the encoding circuits for a repetition code and phase-flip code are