Instruction#
- class Instruction(*, params: dict | None = None, extra_params: dict | None = None)#
Base class for all instructions.
- Parameters:
params – Mapping of parameters specified by the users.
extra_params – Mapping of extra parameters, typically calculated ones.
- on_modes(*modes: int) Instruction #
Specifies the modes on which the state should be executed.
- Returns:
The same instruction with the modes specified.
- Return type:
- classmethod from_dict(dict_: dict) Instruction #
Creates an
Instruction
instance from a dict specified.- Parameters:
dict (dict) – The desired
Instruction
instance in the format of a dict.- Returns:
An
Instruction
initialized using the specified dict.- Return type:
- classmethod set_subclass(instruction: Type[Instruction]) None #
Registers a class in the instruction subclass map.
This is meaningful in contexts when one has multiple instructions with the same name.
Example
When one creates a custom beamsplitter with name Beamsplitter and subclasses
Beamsplitter
, then for e.g. executing a Blackbird code will be performed with the custom one, not the original one. When one wants to use the original one in this case, one can reset it with this method.- Parameters:
instruction (Type[Instruction]) – The instruction class to be registered.
- Raises:
PiquassoException – When the class is not actually an instance of
Insruction
.
- classmethod get_subclass(name: str) Type[Instruction] #
Returns the instruction subclass specified by its name.
- Returns:
The instruction class.
- Return type:
Type[Instruction]
- class BatchInstruction(*, params: dict | None = None, extra_params: dict | None = None)#
Base class to control batch processing.