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

PiGate: A gate for working exactly with multiples of pi #183

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

ScottWe
Copy link
Contributor

@ScottWe ScottWe commented Nov 19, 2024

Summary

This pull request introduces a gate which allows for working exactly with multiples of pi. This commit is the first step towards verifying circuits with rotations parameterized by multiples of pi.

Details

Currently, the parameterized equivalence checker in src/python/verifier does not support constant parameters. This is because, given an arbitrary real (or rational number) x, it is not possible to represent sin(x) exactly using only addition, multiplication, subtraction, division, and square roots (or even n-th roots). For special values of x, this is possible though.

This pull request introduces a new named gate, called pi(n), which corresponds to the constant angle pi/n. The implementation in this pull request handles many values of n which appear in quantum computing, such as when n is a power of two. More precisely, the techniques in this pull request can be extended to any n such that the regular n-gon is constructible (see the Gauss-Wantzel Theorem). The cases which I do not support (e.g., 17*2^k and 257*2^k) are unlikely to appear in real quantum algorithms and have horrendous formulas.

Future Work

In a follow-up pull request, I plan to integrate this with the OpenQASM 2 parser.

Copy link
Collaborator

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@xumingkuan xumingkuan merged commit c37803e into quantum-compiler:master Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants