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
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
name of the quantum operation
name of the implementation, for experimental use only
names of the logical qubits the operation acts on
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:
- 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) –