qrisp.QuantumSession.depth#
- QuantumSession.depth(depth_indicator: Callable[[Operation], int] = <function QuantumCircuit.<lambda>>, transpile: bool = True) int#
Returns the depth of the QuantumCircuit.
Note
The depth of a circuit that has not been transpiled may have very little correlation with its actual runtime, since composite gates are counted as a single layer.
- Parameters:
- depth_indicatorCallable[[Operation], int], optional
A function that receives an Operation instance and returns the time or logical depth that operation takes. By default every operation contributes a depth of 1.
- transpilebool, optional
If
True, the circuit is transpiled before the depth is calculated so that composite gates are fully decomposed into primitive operations. The default is True.
- Returns:
- int
The depth of the QuantumCircuit.
Examples
>>> from qrisp import QuantumCircuit >>> qc = QuantumCircuit(3) >>> qc.h(0) >>> qc.cx(0, 1) >>> qc.cx(1, 2) >>> qc.depth() 3