quantumlib / Qualtran

Qᴜᴀʟᴛʀᴀɴ is a Python library for expressing and analyzing Fault Tolerant Quantum algorithms.
https://qualtran.readthedocs.io/en/latest/
Apache License 2.0
132 stars 35 forks source link

Optimize gate count of Subtract to n-1 Toffolis #1057

Open NoureldinYosri opened 1 month ago

NoureldinYosri commented 1 month ago

This uses the bit-magic a-b = ~(~a + b)

mpharrigan commented 3 weeks ago

This uses the bit-magic a-b = ~(~a + b)

would be useful to include in the description

mpharrigan commented 1 week ago

@NoureldinYosri can you make the requested changes

NoureldinYosri commented 1 week ago

@mpharrigan done, I was getting test failures when doing the classical simulation test because classical simulation tools couldn't handle negative values and both Add and Subtract bloqs had faulty classical action definitions for the case of signed inputs... I fixed all of these issues

NoureldinYosri commented 1 week ago

@mpharrigan ptal

mpharrigan commented 6 days ago

What happens if a_bitsize is equal to b_bitsize?

This is a good example of a bloq that should support symbolic decomposition; at least for sizeof(a) == sizeof(b)