qrisp.QuantumCircuit.inverse#

QuantumCircuit.inverse()[source]#

Returns the inverse/daggered QuantumCircuit.

Returns:
inverted_circuitQuantumCircuit

The inverted QuantumCircuit.

Examples

Daggering a QuantumCircuit reverses the order and daggers each operation.

>>> from qrisp import QuantumCircuit
>>> import numpy as np
>>> qc = QuantumCircuit(1)
>>> qc.x(0)
>>> qc.p(np.pi/2, 0)
>>> qc.y(0)
>>> print(qc.inverse())
      ┌───┐┌─────────┐┌───┐
qb_0: ┤ Y ├┤ P(-π/2) ├┤ X ├
      └───┘└─────────┘└───┘

For the phase gate, a daggering implies the reversal of the phase - Pauli gates however are invariant under daggering.