InstructionSet¶
- class InstructionSet(circuit_cregs=None, *, resource_requester=None)[fuente]¶
Bases:
object
Instruction collection, and their contexts.
New collection of instructions.
The context (
qargs
andcargs
that each instruction is attached to) is also stored separately for each instruction.Obsoleto desde la versión 0.19.0:
qiskit.circuit.instructionset.InstructionSet.__init__()
”s argumentcircuit_cregs
is deprecated as of qiskit-terra 0.19.0. It will be removed no earlier than 3 months after the release date. Instead, pass a complete resource requester with the “resource_requester” argument. The classical registers are insufficient to access all classical resources in a circuit, as there may be loose classical bits as well. It can also cause integer indices to be resolved incorrectly if any registers overlap.- Parámetros
circuit_cregs (list[ClassicalRegister]) – Optional. List of
cregs
of the circuit to which the instruction is added. Default: None.resource_requester (Callable[..., ClassicalRegister | Clbit] | None) –
A callable that takes in the classical resource used in the condition, verifies that it is present in the attached circuit, resolves any indices into concrete
Clbit
instances, and returns the concrete resource. If this is not given, specifying a condition with an index is forbidden, and all concreteClbit
andClassicalRegister
resources will be assumed to be valid.Nota
The callback
resource_requester
is called once for each call toc_if()
, and assumes that a call implies that the resource will now be used. It may throw an error if the resource is not valid for usage.
- Muestra
CircuitError – if both
resource_requester
andcircuit_cregs
are passed. Only one of these may be passed, and it should beresource_requester
.
Methods
Add an instruction and its context (where it is attached).
Set a classical equality condition on all the instructions in this set between the
ClassicalRegister
orClbit
classical
and valueval
.Invert all instructions.
Attributes
- cargs¶
Legacy getter for the cargs components of an instruction set. This does not support mutation.
- instructions¶
Legacy getter for the instruction components of an instruction set. This does not support mutation.
- qargs¶
Legacy getter for the qargs components of an instruction set. This does not support mutation.