Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
MarquessV
commented
Mar 26, 2024
mhodson-rigetti
approved these changes
Mar 27, 2024
bramathon
reviewed
Mar 28, 2024
| This cast will raise a ValueError if simplification doesn't result in a real number. | ||
| """ | ||
| value = self._evaluate() | ||
| if value.imag != 0: |
Collaborator
There was a problem hiding this comment.
Can we use np.isclose with a fairly moderate threshold here? Perhaps 1e-8?
Contributor
There was a problem hiding this comment.
I'd thought about this too but decided it wasn't necessary; if the inputs are all real, imag == 0.0 in all of the inputs and there are no complex operations I can think of that would accumulate a rounding error. So I'd be inclined to leave it unless you have a specific case that would trip it.
Contributor
Author
There was a problem hiding this comment.
@bramathon Any thoughts on the above? Just want to make sure before I merge as-is.
Shadow53
reviewed
Apr 8, 2024
…contains-expressions-but-not-parameters
…contains-expressions-but-not-parameters
…contains-expressions-but-not-parameters
…contains-expressions-but-not-parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #1682.
This implements the numpy array protocol by leaning on quil-rs expression simplification to get a numpy compatible number from the expression, if possible. If not, we still fallback to the default numpy behavior as to not break existing code.
Checklist
masterbranch