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 composed of reset and any other instructions

    except measurement instructions,

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

    that is not a measurement or a reset),

  3. one moment composed of measurement and any other instructions

    except reset 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 reset and a measurement operation.

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