qrisp.QuantumCircuit.cnot_depth#

QuantumCircuit.cnot_depth()[source]#

This function returns the CNOT-depth of an self.

In NISQ-era devices, CNOT gates are the restricting bottleneck for quantum circuit execution. This function can be used as a gate-speed specifier for the :meth:`compile <qrisp.QuantumSession.compile>`_ method.

Returns:
int

The CNOT depth of self.

Examples

We create a QuantumCircuit and evaluate it’s 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_59: ──■────────────┤ X ├─────
       ┌─┴─┐┌───┐     └─┬─┘     
qb_60: ┤ X ├┤ X ├──■────■───────
       └───┘└───┘┌─┴─┐┌───┐     
qb_61: ──────────┤ X ├┤ Y ├──■──
                 └───┘└───┘┌─┴─┐
qb_62: ────────────────────┤ X ├
                           └───┘
>>> qc.cnot_depth()
3