For $[n,k]$ stabilizer code, we can prepare an encoded state by simply measuring an initial state $|0\rangle^{\otimes n}$ with the stabilizers $g_1, \dots ,g_{n-k}$ and fixing it according to the measurement result. However, this does not apply to encoding an unknown state $|\psi\rangle \in \mathcal{H}^{\otimes k}$.

Is there any systematic way to perform such encoding?


2 Answers 2


Encoding circuits exist for all stabilizer codes. You can find a procedure to construct them in literature [1,2].

I previously outlined this procedure, with a worked out example for the Steane code.

[1] D. Gottesman, Stabilizer Codes and Quantum Error Correction, arXiv:quant-ph/9705052.

[2] Gaitan, Frank, Quantum Error Correction and Fault Tolerant Quantum Computing (CRC Press, 2008).


Basically, think of any circuit between two qubits that you might want to apply. In this case, a SWAP where one of the qubits is prepared in $|0\rangle$. (This is implemented by two controlled-nots, the first one controlled off the unknown qubit state, the second targeting the unknown state.) Then, all you have to do is consider one of the qubits as a normal qubit, with normal gates, and the second qubit as a logical qubit, i.e. encoded in an error correcting code, and the gates you apply are the logical gates. It'll work exactly as you expect (provided there are no errors in the circuit).

  • $\begingroup$ The controled-not targeting the logical state is simple, but the controled-not targeting unknown normal state is not that explicit--we need to find the control according to eigenspaces of logical operators. $\endgroup$
    – Jiawei Wu
    Mar 12 at 4:37
  • $\begingroup$ That's true. Just build it based on the projectors $(I\pm Z_L)$. Alternatively, you do the one controlled not from the input to the logical, and then measure the input qubit in the $X$ basis. Depending on the measurement result, you may just need to apply a corrective $Z_L$. (This is basically just teleportation). $\endgroup$
    – DaftWullie
    Mar 13 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.