-
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
Ensure scalar parameter names are preserved during conversion #6755
Conversation
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. |
I was able to reproduce this locally, but the CI failure made me look at it again. It seems that I'm a bit stumped as to what the best approach would be to resolve the underlying issue. Any advice would be appreciated. |
@natestemen - it seems the CLA check is failing (the second comment here). |
Ah sorry about that! Didn't realize it was blocking a review. Resolved now. |
@natestemen - after testing this a bit, I would argue the current cirq parameters naming is more close to the pyquil's Unless this is a bug in pyquil I feel it is better to leave the code as is. BTW, the test quil code added in this PR renders the same for pyquil 3 and 4 with parameter expression from pyquil import Program
print(Program("DECLARE theta REAL[1]\nRZ(theta) 0")) output:
|
The main point of confusion is that parameter names are no longer consistent across SDKs. E.g. I define a a pyquil program with a parameter, I have to do some amount of logic to figure out what the parameter name is in the cirq circuit. That's a surprising behavior IMO. That said, I understand where you're coming from, and the current implementation keeps things simple. I appreciate you taking a look! |
Description: When converting Quil programs with single-value (scalar) parameters, ensure that the parameter name remains consistent by returning the symbolic name.
Motivation: When upgrading from pyquil v3 to v4, the output of a simple program changes subtly. If the starting pyquil program is
Then the diff between v3
program.out()
and v4program.out()
is as follows.So far, this has nothing to do with cirq, but when calling
cirq_rigetti.circuit_from_quil(program.out())
the instantiatedcirq.Circuit
now has a parameter nametheta_0
which was never specified by the user.