73 lines
3.2 KiB
Plaintext
73 lines
3.2 KiB
Plaintext
---
|
||
title: InstructionSet (dev version)
|
||
description: API reference for qiskit.circuit.InstructionSet in the dev version of qiskit
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.circuit.InstructionSet
|
||
---
|
||
|
||
# InstructionSet
|
||
|
||
<Class id="qiskit.circuit.InstructionSet" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit/tree/main/qiskit/circuit/instructionset.py#L30-L132" signature="qiskit.circuit.InstructionSet(*, resource_requester=None)" modifiers="class">
|
||
Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)")
|
||
|
||
Instruction collection, and their contexts.
|
||
|
||
New collection of instructions.
|
||
|
||
The context (`qargs` and `cargs` that each instruction is attached to) is also stored separately for each instruction.
|
||
|
||
**Parameters**
|
||
|
||
**resource\_requester** (*Callable\[...,* [*ClassicalRegister*](circuit#qiskit.circuit.ClassicalRegister "qiskit.circuit.ClassicalRegister") *|*[*Clbit*](circuit#qiskit.circuit.Clbit "qiskit.circuit.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`](circuit#qiskit.circuit.Clbit "qiskit.circuit.Clbit") instances, and returns the concrete resource. If this is not given, specifying a condition with an index is forbidden, and all concrete [`Clbit`](circuit#qiskit.circuit.Clbit "qiskit.circuit.Clbit") and [`ClassicalRegister`](circuit#qiskit.circuit.ClassicalRegister "qiskit.circuit.ClassicalRegister") resources will be assumed to be valid.
|
||
|
||
<Admonition title="Note" type="note">
|
||
The callback `resource_requester` 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.
|
||
</Admonition>
|
||
|
||
## Attributes
|
||
|
||
### cargs
|
||
|
||
<Attribute id="qiskit.circuit.InstructionSet.cargs">
|
||
Legacy getter for the cargs components of an instruction set. This does not support mutation.
|
||
</Attribute>
|
||
|
||
### instructions
|
||
|
||
<Attribute id="qiskit.circuit.InstructionSet.instructions">
|
||
Legacy getter for the instruction components of an instruction set. This does not support mutation.
|
||
</Attribute>
|
||
|
||
### qargs
|
||
|
||
<Attribute id="qiskit.circuit.InstructionSet.qargs">
|
||
Legacy getter for the qargs components of an instruction set. This does not support mutation.
|
||
</Attribute>
|
||
|
||
## Methods
|
||
|
||
### add
|
||
|
||
<Function id="qiskit.circuit.InstructionSet.add" github="https://github.com/Qiskit/qiskit/tree/main/qiskit/circuit/instructionset.py#L76-L84" signature="add(instruction, qargs=None, cargs=None)">
|
||
Add an instruction and its context (where it is attached).
|
||
</Function>
|
||
|
||
### inverse
|
||
|
||
<Function id="qiskit.circuit.InstructionSet.inverse" github="https://github.com/Qiskit/qiskit/tree/main/qiskit/circuit/instructionset.py#L91-L108" signature="inverse(annotated=False)">
|
||
Invert all instructions.
|
||
|
||
<Admonition title="Note" type="note">
|
||
It is preferable to take the inverse *before* appending the gate(s) to the circuit.
|
||
</Admonition>
|
||
|
||
**Parameters**
|
||
|
||
**annotated** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) –
|
||
</Function>
|
||
</Class>
|
||
|