quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
452 stars 73 forks source link

Add: define-compiler decomposing CAN gates to <= 3 SQISWAP gates #871

Closed macrologist closed 1 year ago

macrologist commented 1 year ago

Defines two mutually exclusive compiler rules that match CAN gates. One rule decomposes a CAN into two SQISWAP gates interleaved by 1 qubit rotations; call this the case-2 rule. The other rule, call it case-3, decomposes a CAN into an SQISWAP gate and another CAN gate to which case-2 is applicable.

There are some inline "tests" in comment blocks that I have left in for the time being as an aid to understanding. I can remove them if desired.

This PR partially addresses #766

stylewarning commented 1 year ago

@macrologist Congratulations and welcome to being a QUILC contributor!