Operation
class qiskit.circuit.Operation
Bases: ABC
Quantum operation interface.
The minimal interface that any object must fulfil in order to be added to a QuantumCircuit
.
Concrete instances of this interface include Gate
, Reset
, Barrier
, Measure
, and operators such as Clifford
.
The main purpose is to allow abstract mathematical objects to be added directly onto abstract circuits, and for the exact syntheses of these to be determined later, during compilation.
Example
Add a Clifford and a Toffoli gate to a QuantumCircuit
.
from qiskit import QuantumCircuit
from qiskit.quantum_info import Clifford, random_clifford
qc = QuantumCircuit(3)
cliff = random_clifford(2)
qc.append(cliff, [0, 1])
qc.ccx(0, 1, 2)
qc.draw('mpl')
Attributes
name
Unique string identifier for operation type.
num_clbits
Number of classical bits.
num_qubits
Number of qubits.
Was this page helpful?
Report a bug or request content on GitHub.