ISAContext Class
Context passed through enumeration, holding shared state.
Initialize the ISA context for the given architecture.
Constructor
ISAContext(arch: Architecture)
Parameters
| Name | Description |
|---|---|
|
arch
Required
|
The architecture providing the base ISA. |
Methods
| add_instruction |
Create an instruction and add it to the provenance graph. Can be called in two ways:
Provenance is recorded when transform and/or source are supplied:
|
| make_isa |
Create an ISA backed by this context's provenance graph from the given node indices. |
add_instruction
Create an instruction and add it to the provenance graph.
Can be called in two ways:
With keyword args to create a new instruction:
ctx.add_instruction(T, encoding=LOGICAL, time=1000, error_rate=1e-8)With a pre-existing
Instructionobject (e.g. fromwith_id()):ctx.add_instruction(existing_instruction)
Provenance is recorded when transform and/or source are supplied:
transform — the
ISATransformthat produced the instruction.source — input instructions consumed by the transform.
add_instruction(id_or_instruction: int | Instruction, encoding: Encoding = 0, *, arity: int | None = 1, time: int | _IntFunction = 0, space: int | None | _IntFunction = None, length: int | _IntFunction | None = None, error_rate: float | _FloatFunction = 0.0, transform: ISATransform | None = None, source: list[Instruction] | None = None, **kwargs: int) -> int
Parameters
| Name | Description |
|---|---|
|
id_or_instruction
Required
|
Either an instruction ID (int) for creating
a new instruction, or an existing |
|
encoding
|
The instruction encoding (0 = Physical, 1 = Logical).
Ignored when passing an existing Default value: 0
|
|
arity
Required
|
The instruction arity. |
|
time
Required
|
Instruction time in ns (or |
|
space
Required
|
Instruction space in physical qubits (or |
|
length
Required
|
Arity including ancilla qubits. Ignored when passing an
existing |
|
error_rate
Required
|
Instruction error rate (or |
|
transform
Required
|
The |
|
source
Required
|
List of source |
|
**kwargs
Required
|
Additional properties (e.g. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
arity
|
Default value: 1
|
|
time
|
Default value: 0
|
|
space
|
Default value: None
|
|
length
|
Default value: None
|
|
error_rate
|
Default value: 0.0
|
|
transform
|
Default value: None
|
|
source
|
Default value: None
|
Returns
| Type | Description |
|---|---|
|
The node index in the provenance graph. |
Exceptions
| Type | Description |
|---|---|
|
If an unknown property name is provided in kwargs. |
make_isa
Attributes
isa
The ISA provided by the architecture for this context.