-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cirq inverse seems to (at least sometimes) modify the values given to it, is this intended? #1087
Comments
Indeed, This is intended behavior; using iterators to generate operations is a common pattern in Cirq. |
This is why I've been moving away from exposing methods returning In other words, I do think that this is a bug but I think it's a usability bug in |
Thanks for the explanation! It certainly wasn't the expected behavior but I'm coming to understand the way that iterators are used throughout the codebase as I get deeper into it. Thanks, Bill |
First of all, I apologize if this should have been posted to Stack Exchange instead. It seemed specific enough to the code that I thought I would post it here.
It seems that, at least for some inputs, cirq.inverse(val) modifies the input that it is given. Is this the intended behavior? It seems counterintuitive from a user perspective that
would yield anything other than an effective identity operation.
This behavior can be seen specifically in the example notebook provided by OpenFermion-Cirq here:
https://github.com/quantumlib/OpenFermion-Cirq/blob/master/examples/tutorial_1_basis_change.ipynb
In particular, one can modify the second cell in the notebook in the following way:
to yield something which no longer acts as expected.
The text was updated successfully, but these errors were encountered: