Skip to main contentIBM Quantum Documentation Mirror

Diagonal

class qiskit.circuit.library.Diagonal(diag)

GitHub

Bases: QuantumCircuit

Circuit implementing a diagonal transformation.

Deprecated since version 2.1

The class qiskit.circuit.library.generalized_gates.diagonal.Diagonal is deprecated as of Qiskit 2.1. It will be removed in Qiskit 3.0. Use DiagonalGate instead.

Parameters

diag (Sequence[complex]) – List of the 2k2^k diagonal entries (for a diagonal gate on kk qubits).

Raises

CircuitError – if the list of the diagonal entries or the qubit list is in bad format; if the number of diagonal entries is not 2k2^k, where kk denotes the number of qubits.


Attributes

name

Type: str

A human-readable name for the circuit.

Example

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit