6
$\begingroup$

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?

$\endgroup$

1 Answer 1

7
$\begingroup$

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')

enter image description here

Note that for this method to work all T gates must be explicit in the circuit description.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.