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.
|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:
|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
|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.