Subsections

Quantum Error Correction

Quantum error correction (QEC) is a method to minimize the impacts of decoherence and other errors. libquantum provides an interface to encode a quantum register with a QEC code and to perform error-correction. Several operations can be executed directly on the encoded register, these are quantum_sigma_x, quantum_cnot and quantum_toffoli.

quantum_qec_encode

extern void quantum_qec_encode(int type, int width, quantum_reg *reg);

This function encodes a quantum register with a QEC code. The first width qubits are actually protected against errors, the rest gets only expanded to make operations on the encoded register easier. In the future, libquantum will support several ways of QEC, these can be requested by the appropriate type. The following values for type have been implemented:

Type Description
0 No QEC. This is the default when a quantum register is created.
1 Steane's 3-bit code [Steane, 1996]. This QEC code protects against decoherence errors by encoding the two basis states of a qubit as follows:
$\vert\rangle \longrightarrow \vert00\rangle + \vert11\rangle + \vert 101\rangle +
\vert 110\rangle$
$\vert 1\rangle \longrightarrow \vert01\rangle + \vert10\rangle + \vert 100\rangle +
\vert 111\rangle$

quantum_qec_decode

extern void quantum_qec_decode(int type, int width, quantum_reg *reg);

A previoulsy encoded quantum register can be decoded with this function. The values for type and width are the same as in quantum_qec_encode. After the decoding, the actual process of error correction is performed.