Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK. Go to the latest version

Operation

class Operation

GitHub

Bases: abc.ABC

Quantum Operation Interface Class. For objects that can be added to a QuantumCircuit. These objects include Gate, Reset, Barrier, Measure, and operators such as Clifford. The main purpose is to add an Operation to a QuantumCircuit without synthesizing it before the transpilation.

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()
     ┌───────────┐     
q_0:0          ├──■──
     │  Clifford │  │  
q_1:1          ├──■──
     └───────────┘┌─┴─┐
q_2: ─────────────┤ X ├
                  └───┘

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.