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

[BUG] Circuit.simplify does not remove rotations with angles multiples of 2*pi #409

Open
ValentinS4t1qbit opened this issue Sep 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ValentinS4t1qbit
Copy link
Collaborator

ValentinS4t1qbit commented Sep 17, 2024

Circuit.simplify should remove small rotations, but it currently only looks whether the angle is sufficiently close to 0.
If the angle somehow ends up being 2pi or 4 pi, we would also like the gate to be removed, as it is the identity operation. It is currently not the case.

remove_small_rotations should remove rotations with angles that are 0 modulo 2*pi instead of just 0.

easy test:

import numpy as np
from tangelo.linq import Gate, Circuit

c = Circuit([Gate('H',0), Gate('Rx, 0, parameter=4*np.pi)])
c.simplify

# Assert c is now just a single H gate.
@ValentinS4t1qbit ValentinS4t1qbit added the bug Something isn't working label Sep 17, 2024
@ValentinS4t1qbit ValentinS4t1qbit self-assigned this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant