sf.program_utils.Command

class Command(op, reg)[source]

Bases: object

Represents a quantum operation applied on specific subsystems of the register.

A Command instance is immutable once created, and can be shared between several Program instances.

Parameters
  • op (Operation) – quantum operation to apply

  • reg (Sequence[RegRef]) – Subsystems to which the operation is applied. Note that the order matters here.

get_dependencies()

Subsystems the command depends on.

get_dependencies()[source]

Subsystems the command depends on.

Combination of self.reg and self.op.measurement_deps.

Note

measurement_deps are used to ensure that the measurement happens before the result is used, but this is a bit too strict: two gates depending on the same measurement result but otherwise acting on different subsystems should commute.

Returns

set of subsystems the command depends on

Return type

set[RegRef]