tqecd.fragment.Fragment#

class Fragment(circuit: Circuit)[source]#
__init__(circuit: Circuit)[source]#

A sub-circuit guaranteed to end with a moment filled by measurement instructions.

Fragment instances represent sub-circuits that contain:

  1. zero or more moments exclusively composed of reset, annotation or

    noisy-gate instructions,

  2. zero or more moments composed of “computation” instructions (anything

    that is not a measurement or a reset),

  3. one moment exclusively composed of measurement, annotation

    or noisy-gate instructions.

Raises:
  • TQECDException – if the provided stim.Circuit instance contains a stim.CircuitRepeatBlock instance.

  • TQECDException – if any moment from the provided circuit contains both a measurement (resp. reset) and a non-measurement (resp. non-reset) operation. Note that annotations and noisy-gates instructions (measurements excluded) are ignored, and so are excluded from this condition.

  • TQECDException – if the provided circuit does not end with at least one measurement.

Parameters:

circuit – the circuit represented by the instance.

Methods

__init__(circuit)

A sub-circuit guaranteed to end with a moment filled by measurement instructions.

get_tableau()

Attributes

circuit

measurements

Get the measurement instructions at the back on the Fragment.

measurements_qubits

num_measurements

resets

Get the reset instructions at the front on the Fragment.