How to find T-depth in Qiskit? Is there any inbuilt function or some method to find T-depth? I know that the .depth()
function exists which returns circuit depth (i.e., length of critical path), but is there any method for T-depth?
1 Answer
The depth
method can be customized with a gate subset you want to consider. To compute the $T$-depth you most likely want to include both $T$ and $T^\dagger$ gates. Here is an example
qc = QuantumCircuit(3)
qc.ccx(0,1,2)
qc = qc.decompose()
t_depth = qc.depth(lambda gate: gate[0].name in ['t', 'tdg'])
print('t depth:', t_depth) ## Output -> 4
qc.draw(output='mpl')
Note that for this method to work all T gates must be explicit in the circuit description.