Skip to content

Conversation

cifrzak
Copy link

@cifrzak cifrzak commented Jan 25, 2025

Fix #6764
Add global_shift parameter validation in eigen gate init plus test.

Range is currently set to (-2,2), though issue comment mentions [0,2).

Also another comment mentions the value could be symbolic, but the current code seems to expect plain float only.

Copy link

google-cla bot commented Jan 25, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@CirqBot CirqBot added the size: S 10< lines changed <50 label Jan 25, 2025
@cifrzak cifrzak marked this pull request as ready for review January 25, 2025 14:04
@cifrzak cifrzak requested review from a team and vtomole as code owners January 25, 2025 14:04
@cifrzak cifrzak marked this pull request as draft January 25, 2025 17:09
@cifrzak cifrzak marked this pull request as ready for review January 25, 2025 17:20
super().__init__(exponent=exponent, global_shift=global_shift)
if global_shift <= -2.0 or global_shift >= 2.0:
raise ValueError(
f"Gate global shift must be in the range (-2,2). Invalid Value: {global_shift}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This introduces a backwards incompatibility, as initialization of larger values will fail now.
Wouldn't it be better to normalize the global_shift rather than fail?

Also, should this behavior be consistent for all the pow gates?

Copy link
Collaborator

Choose a reason for hiding this comment

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

#7057 will fix this in a consistent and backwards-compatible way.

@cifrzak cifrzak marked this pull request as draft February 7, 2025 09:42
@cifrzak
Copy link
Author

cifrzak commented Feb 13, 2025

Will be solved with #7057

@cifrzak cifrzak closed this Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimizer failure

4 participants