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
179 stars 45 forks source link

Add leaf bloqs for relative phase Toffoli gates #1499

Open tanujkhattar opened 2 days ago

tanujkhattar commented 2 days ago

Relative phase toffoli's can be implemented using 4 T gates and T-depth 1 and can be used in place of Toffoli gates in cases where the Toffoli's appear in compute / uncompute pairs (eg: arithmetic circuits) and the relative phase cancels each other out. A useful example of relative phase Toffoli is the CCiX gate defined in https://arxiv.org/abs/1210.0974 as

image

Other examples of uses of relative phase toffoli's are given in https://arxiv.org/abs/1508.03273. This issue is to add a new leaf bloq for relative phase Toffoli and use it in higher level bloqs instead of the Toffoli gate.

Note that when compiling to a surface code layout, each of the 3 constructions have different costs and so it's important to clearly make the distinction between the 3 leaf bloqs in algorithms that can then be compiled down without ambiguity.

tanujkhattar commented 2 days ago

xref https://github.com/quantumlib/Qualtran/issues/620