The number of cnots in the call graph for the Add bloq doesn't account for when a_bitsize < b_bitsize. In the decomposition, there is a cnot yielded conditioned on a_bitsize=b_bitsize
|
if len(input_bits) == len(output_bits): |
|
yield CNOT().on(input_bits[-1], output_bits[-1]) |
but the call graph always includes this gate in the count
This results in different gate counts depending on what level of decomposition you count. For example
from qualtran.bloqs.arithmetic import Add
a_dtype = QUInt(2)
b_dtype = QUInt(3)
gate = Add(a_dtype=a_dtype,b_dtype=b_dtype)
gate.t_complexity() == gate.decompose_bloq().t_complexity()
returns False.