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?
Asked
Active
Viewed 284 times
6

Gopal Dahale
- 177
- 1
- 6
1 Answers
7
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.

Nikita Nemkov
- 1,605
- 5
- 18