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] RotationComposer does not have support for integral mutliples of pi/8 rotations #271

Open
isolatedinformation opened this issue Mar 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@isolatedinformation
Copy link
Contributor

Issue Description

As suggested in the discussion of PR #269, LLOPs only has support for [pi/2, +/- pi/4 , +/- pi/8 ]!

if r.rotation_amount == Fraction(1, 2):
return self.pi_over_two(r.get_ops_map(), r.get_condition())
elif r.rotation_amount == Fraction(1, 4):
return self.add_pi_over_four(r.get_ops_map(), False, r.get_condition())
elif r.rotation_amount == Fraction(-1, 4):
return self.add_pi_over_four(r.get_ops_map(), True, r.get_condition())
elif r.rotation_amount == Fraction(1, 8):
return self.add_pi_over_eight(r.get_ops_map(), False, r.get_condition())
elif r.rotation_amount == Fraction(-1, 8):
return self.add_pi_over_eight(r.get_ops_map(), True, r.get_condition())
else:
raise Exception(
"Unsupported pauli rotation angle pi*%d/%d"
% (r.rotation_amount.numerator, r.rotation_amount.denominator)
)

To fully take leverage of the compression from this PR, LLOPs should have support for all integral multiples of pi/8

How to Reproduce

If possible, please provide us with the steps that lead to the behavior that you are seeing, and include the snippet of the code that generates the error as well as the error message from python below.

Code Snippet

from fractions import Fraction
from lsqecc.pauli_rotations import PauliOpCircuit, PauliRotation, PauliOperator
import lsqecc.logical_lattice_ops.logical_lattice_ops as llops

Z = PauliOperator.Z

circ = PauliOpCircuit(1)
circ.add_pauli_block(PauliRotation.from_list([Z], rotation=Fraction(3, 8)))
print(circ)

log_comp = llops.LogicalLatticeComputation(circ)

Error Output

Traceback (most recent call last):
  File "/home/varunseshadri/projects/lattice-surgery/lattice-surgery-compiler/debug/debug_non_standard_rotation_composer.py", line 15, in <module>
    log_comp = llops.LogicalLatticeComputation(circ)
  File "/home/varunseshadri/projects/lattice-surgery/lattice-surgery-compiler/src/lsqecc/logical_lattice_ops/logical_lattice_ops.py", line 100, in __init__
    self._load_circuit()
  File "/home/varunseshadri/projects/lattice-surgery/lattice-surgery-compiler/src/lsqecc/logical_lattice_ops/logical_lattice_ops.py", line 121, in _load_circuit
    reversed(rotations_composer.expand_rotation(current_op))
  File "/home/varunseshadri/projects/lattice-surgery/lattice-surgery-compiler/src/lsqecc/logical_lattice_ops/logical_lattice_ops.py", line 170, in expand_rotation
    raise Exception(
Exception: Unsupported pauli rotation angle pi*3/8

Environment Context

Please add information about your operating system, python version and dependencies here.

Copy and paste the output of pip freeze or conda list here.
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