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

fix: Fix bug in JsonScalar::from_scalar #74

Merged
merged 5 commits into from
Oct 17, 2024
Merged

Conversation

rafaelha
Copy link
Contributor

@rafaelha rafaelha commented Oct 16, 2024

As @ColbyDeLisle mentioned in issue #63, pow refers to powers of two, whereas pyzx's power2 refers to powers of sqrt(2). This was handled incorrectly in the Exact arm of JsonScalar::from_scalar. I have reworked that now so this fixes #63.

I believe that full_simplify usually leads to scalars of the form sqrt(2)^n * exp(m*i*pi/4) for Clifford+T graphs. I refactored the match arm so that these values are always treated exactly. For other scalars, they are simply split up as phase and floatfactor.

@rafaelha rafaelha changed the title Fix bug in JsonScalar::from_scalar #63 Fix bug in JsonScalar::from_scalar, fixes #63 Oct 16, 2024
@rafaelha rafaelha changed the title Fix bug in JsonScalar::from_scalar, fixes #63 Fix bug in JsonScalar::from_scalar Oct 16, 2024
@ABorgna ABorgna changed the title Fix bug in JsonScalar::from_scalar fix: Fix bug in JsonScalar::from_scalar Oct 17, 2024
Copy link
Collaborator

@ABorgna ABorgna left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@ABorgna ABorgna merged commit 9a6c6cb into zxcalc:master Oct 17, 2024
9 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.

Serialization of Exact Scalars fails with √2
2 participants