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

Numbers in parameters not converted back to their symbolic representation #1804

Open
2 tasks done
cosenal opened this issue Oct 8, 2024 · 0 comments
Open
2 tasks done
Labels
bug 🐛 An issue that needs fixing.

Comments

@cosenal
Copy link

cosenal commented Oct 8, 2024

Pre-Report Checklist

Issue Description

With the new parser (introduced in v4), parameters are no longer converted to symbolic number, e.g., $\pi/2$ is left as 1.5707963267948966 and not parsed back to pi/2.

The old behaviour was convenient, because it would make conversion from other languages (e.g. Cirq) to a Pyquil program and viceversa idempotent (related to Cirq#6714)

How to Reproduce

Code Snippet

from pyquil import Program
Program("RX(1.5707963267948966) 0").out()

Error Output

Until pyquil v3, the output used to be

'RX(pi/2) 0\n'

The parser had this feature of figuring out the representation of pi from a truncated decimal approximation.

Starting from pyquil v4, the number stays as

'RX(1.5707963267948966) 0\n'

Perhaps more accurate, but less convenient for the conversions I mentioned above.

Environment Context

Operating System:

Python Version (python -V): Python 3.12.7

Quilc Version (quilc --version): N/R

QVM Version (qvm --version): N/R

Python Environment Details (pip freeze or conda list):

anyio==4.6.0
certifi==2024.8.30
Deprecated==1.2.14
grpc-interceptor==0.15.4
grpcio==1.66.2
h11==0.14.0
httpcore==1.0.6
httpx==0.27.2
idna==3.10
matplotlib-inline==0.1.7
msgpack==1.1.0
networkx==3.3
numpy==1.26.4
packaging==23.2
-e git+https://github.com/rigetti/pyquil.git@8eb4b970c25d47c047c14d3a03e07ca20658e73d#egg=pyquil
python-rapidjson==1.20
pyzmq==26.2.0
qcs-api-client-common==0.10.0
qcs-sdk-python==0.20.1
quil==0.13.0
rpcq==3.11.0
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
scipy==1.14.1
setuptools==75.1.0
sniffio==1.3.1
traitlets==5.14.3
types-Deprecated==1.2.9.20240311
typing_extensions==4.12.2
wheel==0.44.0
wrapt==1.16.0
@cosenal cosenal added the bug 🐛 An issue that needs fixing. label Oct 8, 2024
@cosenal cosenal changed the title Parameters are not converted back to symbolic numbers Numbers in parameters not converted back to their symbolic representation Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue that needs fixing.
Projects
None yet
Development

No branches or pull requests

1 participant