Qualtran icon indicating copy to clipboard operation
Qualtran copied to clipboard

Single-qubit and Controlled Z rotations

Open mpharrigan opened this issue 1 year ago • 1 comments

Update single-qubit Z rotations ZPowGate and Rz. These are atomic operations.

Introduce actual constructions for CZPowGate and CRz for better resource counting. The previous hack would just count them as "one rotation". Now the former is a rotation and two Toffolis (TODO: can these be And?); the latter is two rotations and two cliffords.

Connect the single-qubit gates to their controlled versions via the controlled protocol.

There's still hacks for Controlled-S and Controlled-T, which I will port in a follow-up.

How should we handle X and Y rotations? One possibility is to make them compile to ZPow/Rz. Otherwise: duplicate the controlled construction for each flavor.

@tanujkhattar there are two tests failing that I'd like your help with

  • the TextbookQFT uses cirq controlled_by which is causing breaking simulation tests in a weird way. This triggers #1446 but even after hack-fixing that it runs into a different issue.
  • I don't understand the flamegraph format. test_get_flame_graph_data_qft_textbook has different numbers now but I don't know how to verify that these are correct.

mpharrigan avatar Oct 08 '24 22:10 mpharrigan

TODO: can these be And?

Yep you can use CZPow = And^dagger . ZPow . And

anurudhp avatar Oct 09 '24 09:10 anurudhp

@tanujkhattar do you have any thoughts on the cirq simulation failure

mpharrigan avatar Oct 15 '24 21:10 mpharrigan