qrisp.QuantumCircuit.cnot_depth#

QuantumCircuit.cnot_depth() int[source]#

Returns the CNOT depth of this QuantumCircuit.

In NISQ-era devices, CNOT gates are the restricting bottleneck for quantum circuit execution. This method can be used as a gate-speed specifier for the compile method.

Returns:
int

The CNOT depth of this QuantumCircuit.

Examples

We create a QuantumCircuit and evaluate its CNOT depth:

>>> from qrisp import QuantumCircuit
>>> qc = QuantumCircuit(4)
>>> qc.cx(0, 1)
>>> qc.x(1)
>>> qc.cx(1, 2)
>>> qc.y(2)
>>> qc.cx(2, 3)
>>> qc.cx(1, 0)
>>> print(qc)
                     ┌───┐
qb_0: ──■────────────┤ X ├─────
      ┌─┴─┐┌───┐     └─┬─┘
qb_1: ┤ X ├┤ X ├──■────■───────
      └───┘└───┘┌─┴─┐┌───┐
qb_2: ──────────┤ X ├┤ Y ├──■──
                └───┘└───┘┌─┴─┐
qb_3: ────────────────────┤ X ├
                          └───┘
>>> qc.cnot_depth()
3