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 coefficient type for GlobalPhase, and convert from cirq correctly #901

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

anurudhp
Copy link
Contributor

The gate now supports symbolic phase coefficients.

The _cirq_gate_to_bloq was changed in #891 to only consider float|complex. This PR fixes the type in GlobalPhase, so that every cirq.GlobalPhaseGate can be converted to it.

@anurudhp anurudhp changed the title Fix coefficient type GlobalPhase, and convert from cirq correctly Fix coefficient type for GlobalPhase, and convert from cirq correctly Apr 25, 2024
Comment on lines 52 to 56
coefficient = (
sympy.conjugate(self.coefficient)
if is_symbolic(self.coefficient)
else complex(self.coefficient).conjugate()
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

worth adding as a helper function to symbolic_counting_utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved it there, and added a new type alias SymbolicComplex

@anurudhp anurudhp force-pushed the 2024-04-fix-gphase-cirq-to-bloq branch from e0683f4 to 94d53b1 Compare April 26, 2024 22:17
@anurudhp anurudhp force-pushed the 2024-04-fix-gphase-cirq-to-bloq branch from 94d53b1 to 5f3bf9c Compare April 27, 2024 11:33
@mpharrigan mpharrigan merged commit 480f863 into quantumlib:main Apr 29, 2024
6 checks passed
@anurudhp anurudhp deleted the 2024-04-fix-gphase-cirq-to-bloq branch April 29, 2024 20:06
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