Repetition codes and error recovery

oracq.algorithms.qec.error_correction

Coherent encoding and single-error recovery circuits of the three-bit repetition code.

oracq.algorithms.qec.error_correction.repetition_encode(*, error='bit')[source]

Encode one logical bit into the three-bit repetition code.

Parameters:

error – bit for a single X error, phase for a single Z error.

Returns:

target is the one-bit logical input; syndrome is two bits and must be zero on input.

Return type:

Operation

The three encoded physical bits are laid out as target, syndrome[0], syndrome[1].

oracq.algorithms.qec.error_correction.repetition_recover(*, error='bit')[source]

Coherently recover a single error of the given kind in the three-bit repetition code.

Parameters:

error – bit or phase, matching the encoder.

Returns:

target restores the logical state; the error information stays in syndrome.

Return type:

Operation

No measurement or reset is included; a nonzero syndrome must not be treated as already-clean work space.