OperationRep¶
Bases: ABC, Displayable
Abstract base class for gate and instrument operation representations.
Describes the qubits an operation acts on; each concrete subclass
adds descriptive, named fields for exactly the data it needs, and
validates them itself in __init__, raising
RepConstructionError for an invalid value.
OperationRep
abstractmethod
¶
OperationRep(qubit_labels: str | int | Sequence[str | int] | None = ()) -> None
Initialize the qubits this representation applies to.
Marked abstract only to keep this class and GateRep/
InstrumentRep non-instantiable; every concrete leaf class
overrides __init__ and so satisfies Python's abc machinery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubit_labels
|
str | int | Sequence[str | int] | None
|
Qubit label(s) this operation acts upon. A bare |
()
|
Attributes¶
| Name | Type | Value | Doc |
|---|---|---|---|
qubit_labels |
tuple[str | int, ...] |
unset | Qubit labels that this representation should be applied to. |
decode¶
Inherited static method from Serializable.decode().
display¶
Inherited method from Displayable.display().
dump¶
Inherited method from Serializable.dump().
encode¶
Inherited static method from Serializable.encode().
load¶
Inherited class method from Serializable.load().
read¶
Inherited class method from Serializable.read().
serialize_function¶
Inherited static method from Serializable.serialize_function().
with_qubit_labels ¶
with_qubit_labels(qubit_labels: str | int | Sequence[str | int]) -> 'OperationRep'
Return a copy of this representation retargeted onto different qubits.
Reconstructs via type(self)'s own __init__ (also retargeting
any nested OperationRep/Mapping fields), so the result is
re-validated and can't drift from its own type contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubit_labels
|
str | int | Sequence[str | int]
|
The new qubit label(s) to attach. |
required |
Returns:
| Type | Description |
|---|---|
OperationRep
|
A new |
Raises:
| Type | Description |
|---|---|
RepConstructionError
|
If retargeting the payload onto |
write¶
Inherited method from Serializable.write().