Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to implement gates up to relative phase #3829

Open
Cryoris opened this issue Feb 13, 2020 · 0 comments
Open

Allow to implement gates up to relative phase #3829

Cryoris opened this issue Feb 13, 2020 · 0 comments
Assignees
Labels
type: enhancement It's working, but needs polishing

Comments

@Cryoris
Copy link
Contributor

Cryoris commented Feb 13, 2020

What is the expected enhancement?

In several applications we have a compute -> operation -> uncompute flow: we apply a certain series of gates, do some operation, and then apply the daggered series of gates. The gates that are uncomputed can be implemented up to multiplication with a diagonal unitary (a.k.a. up to relative phase). The relative phase version of the gates can have shorter, more efficient implementations than the exact gate. For example the Toffoli gate uses 6 CX gates whereas the relative phase version, sometimes called Margolus gate, requires only 3.

A generic implementation for multi-controlled single qubit gates exists already within Terra, but remains mostly unused. We could add a relative_phase/up_to_diagonal boolean flag to the gate initializers that indicate whether the gate could be implemented up to relative phase. Since we already plan a global_phase keyword (#3472) this doesn't disrupt the gate signature and could significantly simplify complex circuits.
Note that the relative phase CCX and CCCX are already used in computing the multi-controlled Toffoli.

From the implementation point-of-view, the functionality to decompose the relative phase version could become a transpiler pass / synthesizer (@ajavadia) during transpilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement It's working, but needs polishing
Projects
None yet
Development

No branches or pull requests

3 participants