Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

RepetitionCode

class RepetitionCode(d, T=0, xbasis=False, resets=False, delay=0)

GitHub

Bases: object

Implementation of a distance d repetition code, implemented over T syndrome measurement rounds.

Creates the circuits corresponding to a logical 0 and 1 encoded using a repetition code.

Parameters

  • d (int) – Number of code qubits (and hence repetitions) used.
  • T (int) – Number of rounds of ancilla-assisted syndrome measurement.
  • xbasis (bool) – Whether to use the X basis to use for encoding (Z basis used by default).
  • resets (bool) – Whether to include a reset gate after mid-circuit measurements.
  • delay (float) – Time (in dt) to delay after mid-circuit measurements (and delay).

Additional information:

No measurements are added to the circuit if T=0. Otherwise T rounds are added, followed by measurement of the code qubits (corresponding to a logical measurement and final syndrome measurement round).


Methods

get_circuit_list

RepetitionCode.get_circuit_list()

Returns

self.circuit as a list, with circuit_list[0] = circuit[‘0’] circuit_list[1] = circuit[‘1’]

Return type

circuit_list

process_results

RepetitionCode.process_results(raw_results)

Parameters

raw_results (dict) – A dictionary whose keys are logical values, and whose values are standard counts dictionaries, (as obtained from the get_counts method of a qiskit.Result object).

Returns

Dictionary with the same structure as the input, but with

the bit strings used as keys in the counts dictionaries converted to the form required by the decoder.

Return type

results

Additional information:

The circuits must be executed outside of this class, so that their is full freedom to compile, choose a backend, use a noise model, etc. The results from these executions should then be used to create the input for this method.

readout

RepetitionCode.readout()

Readout of all code qubits, which corresponds to a logical measurement as well as allowing for a measurement of the syndrome to be inferred.

syndrome_measurement

RepetitionCode.syndrome_measurement(final=False, barrier=False, delay=0)

Application of a syndrome measurement round.

Parameters

  • final (bool) – Whether this is the final syndrome measurement round.
  • barrier (bool) – Boolean denoting whether to include a barrier at the end.
  • delay (float) – Time (in dt) to delay after mid-circuit measurements (and delay).

x

RepetitionCode.x(logs=('0', '1'), barrier=False)

Applies a logical x to the circuits for the given logical values.

Parameters

  • logs (list or tuple) – List or tuple of logical values expressed as strings.
  • barrier (bool) – Boolean denoting whether to include a barrier at the end.
Was this page helpful?
Report a bug or request content on GitHub.