QasmQobjInstruction
class qiskit.qobj.QasmQobjInstruction(name, params=None, qubits=None, register=None, memory=None, condition=None, conditional=None, label=None, mask=None, relation=None, val=None, snapshot_type=None)
Bases: object
(opens in a new tab)
A class representing a single instruction in an QasmQobj Experiment.
Instantiate a new QasmQobjInstruction object.
The class qiskit.qobj.qasm_qobj.QasmQobjInstruction
is deprecated as of qiskit 1.2. It will be removed in the 2.0 release. The Qobj class and related functionality are part of the deprecated BackendV1 workflow, and no longer necessary for BackendV2. If a user workflow requires Qobj it likely relies on deprecated functionality and should be updated to use BackendV2.
Parameters
- name (str(opens in a new tab)) – The name of the instruction
- params (list(opens in a new tab)) – The list of parameters for the gate
- qubits (list(opens in a new tab)) – A list of
int
representing the qubits the instruction operates on - register (list(opens in a new tab)) – If a
measure
instruction this is a list ofint
containing the list of register slots in which to store the measurement results (must be the same length as qubits). If abfunc
instruction this is a singleint
of the register slot in which to store the result. - memory (list(opens in a new tab)) – If a
measure
instruction this is a list ofint
containing the list of memory slots to store the measurement results in (must be the same length as qubits). If abfunc
instruction this is a singleint
of the memory slot to store the boolean function result in. - condition (tuple(opens in a new tab)) – A tuple of the form
(int, int)
where the firstint
is the control register and the secondint
is the control value if the gate has a condition. - conditional (int(opens in a new tab)) – The register index of the condition
- label (str(opens in a new tab)) – An optional label assigned to the instruction
- mask (int(opens in a new tab)) – For a
bfunc
instruction the hex value which is applied as anAND
to the register bits. - relation (str(opens in a new tab)) – Relational operator for comparing the masked register to the
val
kwarg. Can be either==
(equals) or!=
(not equals). - val (int(opens in a new tab)) – Value to which to compare the masked register. In other words, the output of the function is
(register AND mask)
- snapshot_type (str(opens in a new tab)) – For snapshot instructions the type of snapshot to use
Methods
from_dict
classmethod from_dict(data)
Create a new QasmQobjInstruction object from a dictionary.
Parameters
data (dict(opens in a new tab)) – A dictionary for the experiment config
Returns
The object from the input dictionary.
Return type
to_dict
to_dict()
Return a dictionary format representation of the Instruction.
Returns
The dictionary form of the QasmQobjInstruction.
Return type