iqm.iqm_client.instruction.Instruction#

class iqm.iqm_client.instruction.Instruction(*, name, implementation=None, qubits, args)#

Bases: BaseModel

An instruction in a quantum circuit.

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

name

name of the quantum operation

implementation

name of the implementation, for experimental use only

qubits

names of the logical qubits the operation acts on

args

arguments for the operation

Methods

args_validator(value, info)

Check argument names and types for a given instruction

implementation_validator(value)

Check if the implementation of the instruction is set to a non-empty string

name_validator(value)

Check if the name of instruction is set to one of the supported quantum operations

qubits_validator(value, info)

Check if the instruction has the correct number of qubits according to the instruction's type

Parameters:
implementation: str | None#

name of the implementation, for experimental use only

qubits: tuple[str, ...]#

names of the logical qubits the operation acts on

args: dict[str, Any]#

arguments for the operation

name: str#

name of the quantum operation

classmethod name_validator(value)#

Check if the name of instruction is set to one of the supported quantum operations

classmethod implementation_validator(value)#

Check if the implementation of the instruction is set to a non-empty string

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'args': FieldInfo(annotation=dict[str, Any], required=True, examples=[{'key': 'm'}]), 'implementation': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, default=None), 'name': FieldInfo(annotation=str, required=True, examples=['measure']), 'qubits': FieldInfo(annotation=tuple[Annotated[str, Strict(strict=True)], ...], required=True, examples=[('alice',)])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod qubits_validator(value, info)#

Check if the instruction has the correct number of qubits according to the instruction’s type

Parameters:

info (ValidationInfo) –

classmethod args_validator(value, info)#

Check argument names and types for a given instruction

Parameters:

info (ValidationInfo) –