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
177 stars 44 forks source link

Add explicit `controlled-U` bloqs for single qubit unitaries `U` and annotate them with costs / decompositions #878

Open tanujkhattar opened 6 months ago

tanujkhattar commented 6 months ago

Some bloqs which need this are

etc.

mpharrigan commented 3 months ago

CHadamard is implemented. I've annotated it with 2 rotations and 4 cliffords with the following description:

This is based on the decomposition provided by cirq.decompose_multi_controlled_rotation which uses three cirq.MatrixGate's to do a controlled version of any single-qubit gate. The first MatrixGate happens to be a clifford, Hadamard operation in this case. The other two are considered 'rotations'.

tanujkhattar commented 3 months ago

We should update the annotation with 2 T gates + 9 cliffords instead of 2 rotations as per my comment in https://github.com/quantumlib/Qualtran/issues/233

Here is a quirk link that shows the decomposition

Specifically, this part:

image
mpharrigan commented 2 months ago

CHadamard and CZPowGate exist.

CRx, CRy, CRz, CXPowGate, CYPowGate are needed.

I've encountered CS and CT in the library; we need those as well.


For Rx(theta) and friends; we do angle simplification in the QECGatesCost resource counting. We look for angles that are actually clifford or the T gate. The existing hacky logic (that links to this issue) treats any Controlled(Rotation) as one rotation

mpharrigan commented 2 months ago

Circuits for CT https://quantumcomputing.stackexchange.com/a/13135

mpharrigan commented 1 month ago

A user points out that the QECGatesCost doesn't accurately track clifford count for controlled rotations.