Skip to content

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

@ValentinS4t1qbit

Description

@ValentinS4t1qbit

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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions