diff --git a/dev_tools/requirements/deps/runtime.txt b/dev_tools/requirements/deps/runtime.txt index b4094fb85..63b03d5a7 100644 --- a/dev_tools/requirements/deps/runtime.txt +++ b/dev_tools/requirements/deps/runtime.txt @@ -1,5 +1,5 @@ -cirq-core==1.2.0 -cirq-ft==1.2.0 +cirq-core==1.3.0.dev20230925183640 +cirq-ft==1.3.0.dev20230925183640 # drawing pydot diff --git a/dev_tools/requirements/envs/dev.env.txt b/dev_tools/requirements/envs/dev.env.txt index 7bfa468b2..8e1f034aa 100644 --- a/dev_tools/requirements/envs/dev.env.txt +++ b/dev_tools/requirements/envs/dev.env.txt @@ -4,7 +4,7 @@ # # pip-compile --output-file=envs/dev.env.txt deps/dev-tools.txt deps/runtime.txt # -absl-py==1.4.0 +absl-py==2.0.0 # via tensorflow-docs accessible-pygments==0.0.4 # via pydata-sphinx-theme @@ -16,7 +16,7 @@ astor==0.8.1 # tensorflow-docs astroid==2.13.5 # via pylint -asttokens==2.2.1 +asttokens==2.4.0 # via stack-data attrs==23.1.0 # via @@ -41,10 +41,8 @@ beautifulsoup4==4.12.2 black==22.3.0 # via -r deps/format.txt bleach==6.0.0 - # via - # nbconvert - # readme-renderer -build==0.10.0 + # via nbconvert +build==1.0.3 # via pip-tools cachetools==5.3.1 # via cirq-ft @@ -54,32 +52,32 @@ cffi==1.15.1 # via cryptography charset-normalizer==3.2.0 # via requests -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via -r deps/runtime.txt -click==8.1.6 +click==8.1.7 # via # black # jupyter-cache # pip-tools -comm==0.1.3 +comm==0.1.4 # via # ipykernel # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via matplotlib -coverage[toml]==7.2.7 +coverage[toml]==7.3.1 # via pytest-cov -cryptography==41.0.3 +cryptography==41.0.4 # via secretstorage cycler==0.11.0 # via matplotlib cytoolz==0.12.2 # via quimb -debugpy==1.6.7 +debugpy==1.8.0 # via ipykernel decorator==5.1.1 # via ipython @@ -97,25 +95,27 @@ docutils==0.19 # sphinx duet==0.2.9 # via cirq-core -exceptiongroup==1.1.2 - # via pytest +exceptiongroup==1.1.3 + # via + # ipython + # pytest execnet==2.0.2 # via pytest-xdist executing==1.2.0 # via stack-data fastjsonschema==2.18.0 # via nbformat -filelock==3.12.2 +filelock==3.12.4 # via virtualenv flynt==0.78 # via -r deps/format.txt -fonttools==4.41.1 +fonttools==4.42.1 # via matplotlib greenlet==2.0.2 # via sqlalchemy -grpcio==1.56.2 +grpcio==1.58.0 # via grpcio-tools -grpcio-tools==1.56.2 +grpcio-tools==1.58.0 # via -r deps/packaging.txt idna==3.4 # via requests @@ -129,17 +129,17 @@ importlib-metadata==6.8.0 # twine iniconfig==2.0.0 # via pytest -ipykernel==6.25.0 +ipykernel==6.25.2 # via # -r deps/pytest.txt # myst-nb -ipython==8.14.0 +ipython==8.15.0 # via # -r deps/runtime.txt # ipykernel # ipywidgets # myst-nb -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via cirq-ft isort==5.10.1 # via @@ -159,13 +159,13 @@ jinja2==3.1.2 # nbconvert # sphinx # tensorflow-docs -jsonschema==4.18.4 +jsonschema==4.19.1 # via nbformat jsonschema-specifications==2023.7.1 # via jsonschema jupyter-cache==0.6.1 # via myst-nb -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # ipykernel # nbclient @@ -178,15 +178,15 @@ jupyter-core==5.3.1 # nbformat jupyterlab-pygments==0.2.2 # via nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via ipywidgets keyring==24.2.0 # via twine -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via matplotlib lazy-object-proxy==1.9.0 # via astroid -llvmlite==0.40.1 +llvmlite==0.41.0 # via numba markdown-it-py==2.2.0 # via @@ -197,7 +197,7 @@ markupsafe==2.1.3 # via # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via cirq-core matplotlib-inline==0.1.6 # via @@ -211,7 +211,7 @@ mdurl==0.1.2 # via markdown-it-py mistune==3.0.1 # via nbconvert -more-itertools==10.0.0 +more-itertools==10.1.0 # via jaraco-classes mpmath==1.3.0 # via sympy @@ -232,7 +232,7 @@ nbclient==0.7.4 # jupyter-cache # myst-nb # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -r deps/pytest.txt # cirq-ft @@ -245,13 +245,15 @@ nbformat==5.9.2 # nbclient # nbconvert # tensorflow-docs -nest-asyncio==1.5.7 +nest-asyncio==1.5.8 # via ipykernel networkx==3.1 # via cirq-core -numba==0.57.1 +nh3==0.2.14 + # via readme-renderer +numba==0.58.0 # via quimb -numpy==1.24.4 +numpy==1.25.2 # via # cirq-core # contourpy @@ -274,7 +276,7 @@ packaging==23.1 # pydata-sphinx-theme # pytest # sphinx -pandas==2.0.3 +pandas==2.1.1 # via cirq-core pandocfilters==1.5.0 # via nbconvert @@ -286,9 +288,9 @@ pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython -pillow==10.0.0 +pillow==10.0.1 # via matplotlib -pip-tools==7.1.0 +pip-tools==7.3.0 # via -r deps/pip-tools.txt pkginfo==1.9.6 # via twine @@ -298,11 +300,11 @@ platformdirs==3.10.0 # jupyter-core # pylint # virtualenv -pluggy==1.2.0 +pluggy==1.3.0 # via pytest prompt-toolkit==3.0.39 # via ipython -protobuf==4.23.4 +protobuf==4.24.3 # via # grpcio-tools # mypy-protobuf @@ -317,11 +319,11 @@ pure-eval==0.2.2 # via stack-data pycparser==2.21 # via cffi -pydata-sphinx-theme==0.13.3 +pydata-sphinx-theme==0.14.1 # via -r deps/docs.txt pydot==1.4.2 # via -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # accessible-pygments # ipython @@ -332,13 +334,13 @@ pygments==2.15.1 # sphinx pylint==2.15.10 # via -r deps/pylint.txt -pyparsing==3.0.9 +pyparsing==3.1.1 # via # matplotlib # pydot pyproject-hooks==1.0.0 # via build -pytest==7.4.0 +pytest==7.4.2 # via # -r deps/pytest.txt # pytest-asyncio @@ -355,7 +357,7 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via pandas pyyaml==6.0.1 # via @@ -363,15 +365,15 @@ pyyaml==6.0.1 # myst-nb # myst-parser # tensorflow-docs -pyzmq==25.1.0 +pyzmq==25.1.1 # via # ipykernel # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via -r deps/runtime.txt -readme-renderer==40.0 +readme-renderer==42.0 # via twine -referencing==0.30.0 +referencing==0.30.2 # via # jsonschema # jsonschema-specifications @@ -384,13 +386,13 @@ requests-toolbelt==1.0.0 # via twine rfc3986==2.0.0 # via twine -rich==13.5.2 +rich==13.5.3 # via twine -rpds-py==0.9.2 +rpds-py==0.10.3 # via # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # cirq-core # quimb @@ -405,7 +407,7 @@ snowballstemmer==2.2.0 # via sphinx sortedcontainers==2.4.0 # via cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via beautifulsoup4 sphinx==5.3.0 # via @@ -413,19 +415,24 @@ sphinx==5.3.0 # myst-nb # myst-parser # pydata-sphinx-theme -sphinxcontrib-applehelp==1.0.4 + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinxcontrib-applehelp==1.0.7 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.4 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.9 # via sphinx -sqlalchemy==2.0.19 +sqlalchemy==2.0.21 # via jupyter-cache stack-data==0.6.2 # via ipython @@ -456,11 +463,11 @@ tornado==6.3.3 # via # ipykernel # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # comm # ipykernel @@ -474,9 +481,9 @@ traitlets==5.9.0 # nbformat twine==4.0.2 # via -r deps/packaging.txt -types-protobuf==4.23.0.2 +types-protobuf==4.24.0.2 # via mypy-protobuf -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # astroid # cirq-core @@ -487,11 +494,11 @@ typing-extensions==4.7.1 # sqlalchemy tzdata==2023.3 # via pandas -urllib3==2.0.4 +urllib3==2.0.5 # via # requests # twine -virtualenv==20.24.2 +virtualenv==20.24.5 # via -r deps/packaging.txt wcwidth==0.2.6 # via prompt-toolkit @@ -499,15 +506,15 @@ webencodings==0.5.1 # via # bleach # tinycss2 -wheel==0.41.0 +wheel==0.41.2 # via # -r deps/packaging.txt # pip-tools -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via ipywidgets wrapt==1.15.0 # via astroid -zipp==3.16.2 +zipp==3.17.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/dev_tools/requirements/envs/docs.env.txt b/dev_tools/requirements/envs/docs.env.txt index 4fa9445cc..485bb7987 100644 --- a/dev_tools/requirements/envs/docs.env.txt +++ b/dev_tools/requirements/envs/docs.env.txt @@ -4,7 +4,7 @@ # # pip-compile --output-file=envs/docs.env.txt constrain.txt deps/docs.txt deps/runtime.txt # -absl-py==1.4.0 +absl-py==2.0.0 # via # -c envs/dev.env.txt # tensorflow-docs @@ -20,7 +20,7 @@ astor==0.8.1 # via # -c envs/dev.env.txt # tensorflow-docs -asttokens==2.2.1 +asttokens==2.4.0 # via # -c envs/dev.env.txt # stack-data @@ -66,25 +66,25 @@ charset-normalizer==3.2.0 # via # -c envs/dev.env.txt # requests -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt -click==8.1.6 +click==8.1.7 # via # -c envs/dev.env.txt # jupyter-cache -comm==0.1.3 +comm==0.1.4 # via # -c envs/dev.env.txt # ipykernel # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -96,7 +96,7 @@ cytoolz==0.12.2 # via # -c envs/dev.env.txt # quimb -debugpy==1.6.7 +debugpy==1.8.0 # via # -c envs/dev.env.txt # ipykernel @@ -118,6 +118,10 @@ duet==0.2.9 # via # -c envs/dev.env.txt # cirq-core +exceptiongroup==1.1.3 + # via + # -c envs/dev.env.txt + # ipython executing==1.2.0 # via # -c envs/dev.env.txt @@ -126,7 +130,7 @@ fastjsonschema==2.18.0 # via # -c envs/dev.env.txt # nbformat -fonttools==4.41.1 +fonttools==4.42.1 # via # -c envs/dev.env.txt # matplotlib @@ -147,18 +151,18 @@ importlib-metadata==6.8.0 # -c envs/dev.env.txt # jupyter-cache # myst-nb -ipykernel==6.25.0 +ipykernel==6.25.2 # via # -c envs/dev.env.txt # myst-nb -ipython==8.14.0 +ipython==8.15.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt # ipykernel # ipywidgets # myst-nb -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via # -c envs/dev.env.txt # cirq-ft @@ -173,7 +177,7 @@ jinja2==3.1.2 # nbconvert # sphinx # tensorflow-docs -jsonschema==4.18.4 +jsonschema==4.19.1 # via # -c envs/dev.env.txt # nbformat @@ -185,7 +189,7 @@ jupyter-cache==0.6.1 # via # -c envs/dev.env.txt # myst-nb -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # -c envs/dev.env.txt # ipykernel @@ -202,15 +206,15 @@ jupyterlab-pygments==0.2.2 # via # -c envs/dev.env.txt # nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via # -c envs/dev.env.txt # ipywidgets -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via # -c envs/dev.env.txt # matplotlib -llvmlite==0.40.1 +llvmlite==0.41.0 # via # -c envs/dev.env.txt # numba @@ -224,7 +228,7 @@ markupsafe==2.1.3 # -c envs/dev.env.txt # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -263,7 +267,7 @@ nbclient==0.7.4 # jupyter-cache # myst-nb # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -c envs/dev.env.txt # cirq-ft @@ -276,7 +280,7 @@ nbformat==5.9.2 # nbclient # nbconvert # tensorflow-docs -nest-asyncio==1.5.7 +nest-asyncio==1.5.8 # via # -c envs/dev.env.txt # ipykernel @@ -284,11 +288,11 @@ networkx==3.1 # via # -c envs/dev.env.txt # cirq-core -numba==0.57.1 +numba==0.58.0 # via # -c envs/dev.env.txt # quimb -numpy==1.24.4 +numpy==1.25.2 # via # -c envs/dev.env.txt # cirq-core @@ -312,7 +316,7 @@ packaging==23.1 # nbconvert # pydata-sphinx-theme # sphinx -pandas==2.0.3 +pandas==2.1.1 # via # -c envs/dev.env.txt # cirq-core @@ -332,7 +336,7 @@ pickleshare==0.7.5 # via # -c envs/dev.env.txt # ipython -pillow==10.0.0 +pillow==10.0.1 # via # -c envs/dev.env.txt # matplotlib @@ -344,7 +348,7 @@ prompt-toolkit==3.0.39 # via # -c envs/dev.env.txt # ipython -protobuf==4.23.4 +protobuf==4.24.3 # via # -c envs/dev.env.txt # tensorflow-docs @@ -361,7 +365,7 @@ pure-eval==0.2.2 # via # -c envs/dev.env.txt # stack-data -pydata-sphinx-theme==0.13.3 +pydata-sphinx-theme==0.14.1 # via # -c envs/dev.env.txt # -r deps/docs.txt @@ -369,7 +373,7 @@ pydot==1.4.2 # via # -c envs/dev.env.txt # -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # -c envs/dev.env.txt # accessible-pygments @@ -377,7 +381,7 @@ pygments==2.15.1 # nbconvert # pydata-sphinx-theme # sphinx -pyparsing==3.0.9 +pyparsing==3.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -388,7 +392,7 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via # -c envs/dev.env.txt # pandas @@ -399,16 +403,16 @@ pyyaml==6.0.1 # myst-nb # myst-parser # tensorflow-docs -pyzmq==25.1.0 +pyzmq==25.1.1 # via # -c envs/dev.env.txt # ipykernel # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt -referencing==0.30.0 +referencing==0.30.2 # via # -c envs/dev.env.txt # jsonschema @@ -417,12 +421,12 @@ requests==2.31.0 # via # -c envs/dev.env.txt # sphinx -rpds-py==0.9.2 +rpds-py==0.10.3 # via # -c envs/dev.env.txt # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # -c envs/dev.env.txt # cirq-core @@ -441,7 +445,7 @@ sortedcontainers==2.4.0 # via # -c envs/dev.env.txt # cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via # -c envs/dev.env.txt # beautifulsoup4 @@ -452,15 +456,20 @@ sphinx==5.3.0 # myst-nb # myst-parser # pydata-sphinx-theme -sphinxcontrib-applehelp==1.0.4 + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinxcontrib-applehelp==1.0.7 # via # -c envs/dev.env.txt # sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via # -c envs/dev.env.txt # sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.4 # via # -c envs/dev.env.txt # sphinx @@ -468,15 +477,15 @@ sphinxcontrib-jsmath==1.0.1 # via # -c envs/dev.env.txt # sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via # -c envs/dev.env.txt # sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.9 # via # -c envs/dev.env.txt # sphinx -sqlalchemy==2.0.19 +sqlalchemy==2.0.21 # via # -c envs/dev.env.txt # jupyter-cache @@ -509,12 +518,12 @@ tornado==6.3.3 # -c envs/dev.env.txt # ipykernel # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # -c envs/dev.env.txt # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # -c envs/dev.env.txt # comm @@ -527,7 +536,7 @@ traitlets==5.9.0 # nbclient # nbconvert # nbformat -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -539,7 +548,7 @@ tzdata==2023.3 # via # -c envs/dev.env.txt # pandas -urllib3==2.0.4 +urllib3==2.0.5 # via # -c envs/dev.env.txt # requests @@ -552,11 +561,11 @@ webencodings==0.5.1 # -c envs/dev.env.txt # bleach # tinycss2 -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via # -c envs/dev.env.txt # ipywidgets -zipp==3.16.2 +zipp==3.17.0 # via # -c envs/dev.env.txt # importlib-metadata diff --git a/dev_tools/requirements/envs/format.env.txt b/dev_tools/requirements/envs/format.env.txt index b4a2f0f52..8f24ee37f 100644 --- a/dev_tools/requirements/envs/format.env.txt +++ b/dev_tools/requirements/envs/format.env.txt @@ -8,7 +8,7 @@ astor==0.8.1 # via # -c envs/dev.env.txt # flynt -asttokens==2.2.1 +asttokens==2.4.0 # via # -c envs/dev.env.txt # stack-data @@ -43,24 +43,24 @@ cachetools==5.3.1 # via # -c envs/dev.env.txt # cirq-ft -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt -click==8.1.6 +click==8.1.7 # via # -c envs/dev.env.txt # black -comm==0.1.3 +comm==0.1.4 # via # -c envs/dev.env.txt # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -84,6 +84,10 @@ duet==0.2.9 # via # -c envs/dev.env.txt # cirq-core +exceptiongroup==1.1.3 + # via + # -c envs/dev.env.txt + # ipython executing==1.2.0 # via # -c envs/dev.env.txt @@ -96,16 +100,16 @@ flynt==0.78 # via # -c envs/dev.env.txt # -r deps/format.txt -fonttools==4.41.1 +fonttools==4.42.1 # via # -c envs/dev.env.txt # matplotlib -ipython==8.14.0 +ipython==8.15.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt # ipywidgets -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via # -c envs/dev.env.txt # cirq-ft @@ -121,7 +125,7 @@ jinja2==3.1.2 # via # -c envs/dev.env.txt # nbconvert -jsonschema==4.18.4 +jsonschema==4.19.1 # via # -c envs/dev.env.txt # nbformat @@ -129,7 +133,7 @@ jsonschema-specifications==2023.7.1 # via # -c envs/dev.env.txt # jsonschema -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # -c envs/dev.env.txt # nbclient @@ -144,15 +148,15 @@ jupyterlab-pygments==0.2.2 # via # -c envs/dev.env.txt # nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via # -c envs/dev.env.txt # ipywidgets -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via # -c envs/dev.env.txt # matplotlib -llvmlite==0.40.1 +llvmlite==0.41.0 # via # -c envs/dev.env.txt # numba @@ -161,7 +165,7 @@ markupsafe==2.1.3 # -c envs/dev.env.txt # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -185,7 +189,7 @@ nbclient==0.7.4 # via # -c envs/dev.env.txt # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -c envs/dev.env.txt # cirq-ft @@ -199,11 +203,11 @@ networkx==3.1 # via # -c envs/dev.env.txt # cirq-core -numba==0.57.1 +numba==0.58.0 # via # -c envs/dev.env.txt # quimb -numpy==1.24.4 +numpy==1.25.2 # via # -c envs/dev.env.txt # cirq-core @@ -224,7 +228,7 @@ packaging==23.1 # -c envs/dev.env.txt # matplotlib # nbconvert -pandas==2.0.3 +pandas==2.1.1 # via # -c envs/dev.env.txt # cirq-core @@ -248,7 +252,7 @@ pickleshare==0.7.5 # via # -c envs/dev.env.txt # ipython -pillow==10.0.0 +pillow==10.0.1 # via # -c envs/dev.env.txt # matplotlib @@ -277,12 +281,12 @@ pydot==1.4.2 # via # -c envs/dev.env.txt # -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # -c envs/dev.env.txt # ipython # nbconvert -pyparsing==3.0.9 +pyparsing==3.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -293,29 +297,29 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via # -c envs/dev.env.txt # pandas -pyzmq==25.1.0 +pyzmq==25.1.1 # via # -c envs/dev.env.txt # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt -referencing==0.30.0 +referencing==0.30.2 # via # -c envs/dev.env.txt # jsonschema # jsonschema-specifications -rpds-py==0.9.2 +rpds-py==0.10.3 # via # -c envs/dev.env.txt # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # -c envs/dev.env.txt # cirq-core @@ -330,7 +334,7 @@ sortedcontainers==2.4.0 # via # -c envs/dev.env.txt # cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via # -c envs/dev.env.txt # beautifulsoup4 @@ -359,12 +363,12 @@ tornado==6.3.3 # via # -c envs/dev.env.txt # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # -c envs/dev.env.txt # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # -c envs/dev.env.txt # comm @@ -376,7 +380,7 @@ traitlets==5.9.0 # nbclient # nbconvert # nbformat -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -393,7 +397,7 @@ webencodings==0.5.1 # -c envs/dev.env.txt # bleach # tinycss2 -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via # -c envs/dev.env.txt # ipywidgets diff --git a/dev_tools/requirements/envs/pip-tools.env.txt b/dev_tools/requirements/envs/pip-tools.env.txt index 2deb5f240..8d23e8c32 100644 --- a/dev_tools/requirements/envs/pip-tools.env.txt +++ b/dev_tools/requirements/envs/pip-tools.env.txt @@ -4,11 +4,11 @@ # # pip-compile --output-file=envs/pip-tools.env.txt constrain.txt deps/pip-tools.txt # -build==0.10.0 +build==1.0.3 # via # -c envs/dev.env.txt # pip-tools -click==8.1.6 +click==8.1.7 # via # -c envs/dev.env.txt # pip-tools @@ -16,7 +16,7 @@ packaging==23.1 # via # -c envs/dev.env.txt # build -pip-tools==7.1.0 +pip-tools==7.3.0 # via # -c envs/dev.env.txt # -r deps/pip-tools.txt @@ -30,7 +30,7 @@ tomli==2.0.1 # build # pip-tools # pyproject-hooks -wheel==0.41.0 +wheel==0.41.2 # via # -c envs/dev.env.txt # pip-tools diff --git a/dev_tools/requirements/envs/pylint.env.txt b/dev_tools/requirements/envs/pylint.env.txt index baf7911b9..695926bc4 100644 --- a/dev_tools/requirements/envs/pylint.env.txt +++ b/dev_tools/requirements/envs/pylint.env.txt @@ -8,7 +8,7 @@ astroid==2.13.5 # via # -c envs/dev.env.txt # pylint -asttokens==2.2.1 +asttokens==2.4.0 # via # -c envs/dev.env.txt # stack-data @@ -39,20 +39,20 @@ cachetools==5.3.1 # via # -c envs/dev.env.txt # cirq-ft -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt -comm==0.1.3 +comm==0.1.4 # via # -c envs/dev.env.txt # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -80,6 +80,10 @@ duet==0.2.9 # via # -c envs/dev.env.txt # cirq-core +exceptiongroup==1.1.3 + # via + # -c envs/dev.env.txt + # ipython executing==1.2.0 # via # -c envs/dev.env.txt @@ -88,16 +92,16 @@ fastjsonschema==2.18.0 # via # -c envs/dev.env.txt # nbformat -fonttools==4.41.1 +fonttools==4.42.1 # via # -c envs/dev.env.txt # matplotlib -ipython==8.14.0 +ipython==8.15.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt # ipywidgets -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via # -c envs/dev.env.txt # cirq-ft @@ -113,7 +117,7 @@ jinja2==3.1.2 # via # -c envs/dev.env.txt # nbconvert -jsonschema==4.18.4 +jsonschema==4.19.1 # via # -c envs/dev.env.txt # nbformat @@ -121,7 +125,7 @@ jsonschema-specifications==2023.7.1 # via # -c envs/dev.env.txt # jsonschema -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # -c envs/dev.env.txt # nbclient @@ -136,11 +140,11 @@ jupyterlab-pygments==0.2.2 # via # -c envs/dev.env.txt # nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via # -c envs/dev.env.txt # ipywidgets -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via # -c envs/dev.env.txt # matplotlib @@ -148,7 +152,7 @@ lazy-object-proxy==1.9.0 # via # -c envs/dev.env.txt # astroid -llvmlite==0.40.1 +llvmlite==0.41.0 # via # -c envs/dev.env.txt # numba @@ -157,7 +161,7 @@ markupsafe==2.1.3 # -c envs/dev.env.txt # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -181,7 +185,7 @@ nbclient==0.7.4 # via # -c envs/dev.env.txt # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -c envs/dev.env.txt # cirq-ft @@ -195,11 +199,11 @@ networkx==3.1 # via # -c envs/dev.env.txt # cirq-core -numba==0.57.1 +numba==0.58.0 # via # -c envs/dev.env.txt # quimb -numpy==1.24.4 +numpy==1.25.2 # via # -c envs/dev.env.txt # cirq-core @@ -220,7 +224,7 @@ packaging==23.1 # -c envs/dev.env.txt # matplotlib # nbconvert -pandas==2.0.3 +pandas==2.1.1 # via # -c envs/dev.env.txt # cirq-core @@ -240,7 +244,7 @@ pickleshare==0.7.5 # via # -c envs/dev.env.txt # ipython -pillow==10.0.0 +pillow==10.0.1 # via # -c envs/dev.env.txt # matplotlib @@ -269,7 +273,7 @@ pydot==1.4.2 # via # -c envs/dev.env.txt # -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # -c envs/dev.env.txt # ipython @@ -278,7 +282,7 @@ pylint==2.15.10 # via # -c envs/dev.env.txt # -r deps/pylint.txt -pyparsing==3.0.9 +pyparsing==3.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -289,29 +293,29 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via # -c envs/dev.env.txt # pandas -pyzmq==25.1.0 +pyzmq==25.1.1 # via # -c envs/dev.env.txt # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt -referencing==0.30.0 +referencing==0.30.2 # via # -c envs/dev.env.txt # jsonschema # jsonschema-specifications -rpds-py==0.9.2 +rpds-py==0.10.3 # via # -c envs/dev.env.txt # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # -c envs/dev.env.txt # cirq-core @@ -326,7 +330,7 @@ sortedcontainers==2.4.0 # via # -c envs/dev.env.txt # cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via # -c envs/dev.env.txt # beautifulsoup4 @@ -358,12 +362,12 @@ tornado==6.3.3 # via # -c envs/dev.env.txt # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # -c envs/dev.env.txt # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # -c envs/dev.env.txt # comm @@ -375,7 +379,7 @@ traitlets==5.9.0 # nbclient # nbconvert # nbformat -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # -c envs/dev.env.txt # astroid @@ -393,7 +397,7 @@ webencodings==0.5.1 # -c envs/dev.env.txt # bleach # tinycss2 -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via # -c envs/dev.env.txt # ipywidgets diff --git a/dev_tools/requirements/envs/pytest.env.txt b/dev_tools/requirements/envs/pytest.env.txt index dbcc8ec32..f91182f07 100644 --- a/dev_tools/requirements/envs/pytest.env.txt +++ b/dev_tools/requirements/envs/pytest.env.txt @@ -4,7 +4,7 @@ # # pip-compile --output-file=envs/pytest.env.txt constrain.txt deps/pytest.txt deps/runtime.txt # -asttokens==2.2.1 +asttokens==2.4.0 # via # -c envs/dev.env.txt # stack-data @@ -35,25 +35,25 @@ cachetools==5.3.1 # via # -c envs/dev.env.txt # cirq-ft -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt -comm==0.1.3 +comm==0.1.4 # via # -c envs/dev.env.txt # ipykernel # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via # -c envs/dev.env.txt # matplotlib -coverage[toml]==7.2.7 +coverage[toml]==7.3.1 # via # -c envs/dev.env.txt # pytest-cov @@ -65,7 +65,7 @@ cytoolz==0.12.2 # via # -c envs/dev.env.txt # quimb -debugpy==1.6.7 +debugpy==1.8.0 # via # -c envs/dev.env.txt # ipykernel @@ -81,9 +81,10 @@ duet==0.2.9 # via # -c envs/dev.env.txt # cirq-core -exceptiongroup==1.1.2 +exceptiongroup==1.1.3 # via # -c envs/dev.env.txt + # ipython # pytest execnet==2.0.2 # via @@ -97,7 +98,7 @@ fastjsonschema==2.18.0 # via # -c envs/dev.env.txt # nbformat -fonttools==4.41.1 +fonttools==4.42.1 # via # -c envs/dev.env.txt # matplotlib @@ -105,17 +106,17 @@ iniconfig==2.0.0 # via # -c envs/dev.env.txt # pytest -ipykernel==6.25.0 +ipykernel==6.25.2 # via # -c envs/dev.env.txt # -r deps/pytest.txt -ipython==8.14.0 +ipython==8.15.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt # ipykernel # ipywidgets -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via # -c envs/dev.env.txt # cirq-ft @@ -127,7 +128,7 @@ jinja2==3.1.2 # via # -c envs/dev.env.txt # nbconvert -jsonschema==4.18.4 +jsonschema==4.19.1 # via # -c envs/dev.env.txt # nbformat @@ -135,7 +136,7 @@ jsonschema-specifications==2023.7.1 # via # -c envs/dev.env.txt # jsonschema -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # -c envs/dev.env.txt # ipykernel @@ -152,15 +153,15 @@ jupyterlab-pygments==0.2.2 # via # -c envs/dev.env.txt # nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via # -c envs/dev.env.txt # ipywidgets -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via # -c envs/dev.env.txt # matplotlib -llvmlite==0.40.1 +llvmlite==0.41.0 # via # -c envs/dev.env.txt # numba @@ -169,7 +170,7 @@ markupsafe==2.1.3 # -c envs/dev.env.txt # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -190,7 +191,7 @@ nbclient==0.7.4 # via # -c envs/dev.env.txt # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -c envs/dev.env.txt # -r deps/pytest.txt @@ -202,7 +203,7 @@ nbformat==5.9.2 # cirq-ft # nbclient # nbconvert -nest-asyncio==1.5.7 +nest-asyncio==1.5.8 # via # -c envs/dev.env.txt # ipykernel @@ -210,11 +211,11 @@ networkx==3.1 # via # -c envs/dev.env.txt # cirq-core -numba==0.57.1 +numba==0.58.0 # via # -c envs/dev.env.txt # quimb -numpy==1.24.4 +numpy==1.25.2 # via # -c envs/dev.env.txt # cirq-core @@ -237,7 +238,7 @@ packaging==23.1 # matplotlib # nbconvert # pytest -pandas==2.0.3 +pandas==2.1.1 # via # -c envs/dev.env.txt # cirq-core @@ -257,7 +258,7 @@ pickleshare==0.7.5 # via # -c envs/dev.env.txt # ipython -pillow==10.0.0 +pillow==10.0.1 # via # -c envs/dev.env.txt # matplotlib @@ -265,7 +266,7 @@ platformdirs==3.10.0 # via # -c envs/dev.env.txt # jupyter-core -pluggy==1.2.0 +pluggy==1.3.0 # via # -c envs/dev.env.txt # pytest @@ -290,17 +291,17 @@ pydot==1.4.2 # via # -c envs/dev.env.txt # -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # -c envs/dev.env.txt # ipython # nbconvert -pyparsing==3.0.9 +pyparsing==3.1.1 # via # -c envs/dev.env.txt # matplotlib # pydot -pytest==7.4.0 +pytest==7.4.2 # via # -c envs/dev.env.txt # -r deps/pytest.txt @@ -325,30 +326,30 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via # -c envs/dev.env.txt # pandas -pyzmq==25.1.0 +pyzmq==25.1.1 # via # -c envs/dev.env.txt # ipykernel # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt -referencing==0.30.0 +referencing==0.30.2 # via # -c envs/dev.env.txt # jsonschema # jsonschema-specifications -rpds-py==0.9.2 +rpds-py==0.10.3 # via # -c envs/dev.env.txt # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # -c envs/dev.env.txt # cirq-core @@ -363,7 +364,7 @@ sortedcontainers==2.4.0 # via # -c envs/dev.env.txt # cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via # -c envs/dev.env.txt # beautifulsoup4 @@ -393,12 +394,12 @@ tornado==6.3.3 # -c envs/dev.env.txt # ipykernel # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # -c envs/dev.env.txt # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # -c envs/dev.env.txt # comm @@ -411,7 +412,7 @@ traitlets==5.9.0 # nbclient # nbconvert # nbformat -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -428,7 +429,7 @@ webencodings==0.5.1 # -c envs/dev.env.txt # bleach # tinycss2 -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via # -c envs/dev.env.txt # ipywidgets diff --git a/dev_tools/requirements/envs/runtime.env.txt b/dev_tools/requirements/envs/runtime.env.txt index b9913c45c..6ad09f06b 100644 --- a/dev_tools/requirements/envs/runtime.env.txt +++ b/dev_tools/requirements/envs/runtime.env.txt @@ -4,7 +4,7 @@ # # pip-compile --output-file=envs/runtime.env.txt constrain.txt deps/runtime.txt # -asttokens==2.2.1 +asttokens==2.4.0 # via # -c envs/dev.env.txt # stack-data @@ -35,20 +35,20 @@ cachetools==5.3.1 # via # -c envs/dev.env.txt # cirq-ft -cirq-core==1.2.0 +cirq-core==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt # cirq-ft -cirq-ft==1.2.0 +cirq-ft==1.3.0.dev20230925183640 # via # -c envs/dev.env.txt # -r deps/runtime.txt -comm==0.1.3 +comm==0.1.4 # via # -c envs/dev.env.txt # ipywidgets -contourpy==1.1.0 +contourpy==1.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -72,6 +72,10 @@ duet==0.2.9 # via # -c envs/dev.env.txt # cirq-core +exceptiongroup==1.1.3 + # via + # -c envs/dev.env.txt + # ipython executing==1.2.0 # via # -c envs/dev.env.txt @@ -80,16 +84,16 @@ fastjsonschema==2.18.0 # via # -c envs/dev.env.txt # nbformat -fonttools==4.41.1 +fonttools==4.42.1 # via # -c envs/dev.env.txt # matplotlib -ipython==8.14.0 +ipython==8.15.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt # ipywidgets -ipywidgets==8.1.0 +ipywidgets==8.1.1 # via # -c envs/dev.env.txt # cirq-ft @@ -101,7 +105,7 @@ jinja2==3.1.2 # via # -c envs/dev.env.txt # nbconvert -jsonschema==4.18.4 +jsonschema==4.19.1 # via # -c envs/dev.env.txt # nbformat @@ -109,7 +113,7 @@ jsonschema-specifications==2023.7.1 # via # -c envs/dev.env.txt # jsonschema -jupyter-client==8.3.0 +jupyter-client==8.3.1 # via # -c envs/dev.env.txt # nbclient @@ -124,15 +128,15 @@ jupyterlab-pygments==0.2.2 # via # -c envs/dev.env.txt # nbconvert -jupyterlab-widgets==3.0.8 +jupyterlab-widgets==3.0.9 # via # -c envs/dev.env.txt # ipywidgets -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via # -c envs/dev.env.txt # matplotlib -llvmlite==0.40.1 +llvmlite==0.41.0 # via # -c envs/dev.env.txt # numba @@ -141,7 +145,7 @@ markupsafe==2.1.3 # -c envs/dev.env.txt # jinja2 # nbconvert -matplotlib==3.7.2 +matplotlib==3.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -161,7 +165,7 @@ nbclient==0.7.4 # via # -c envs/dev.env.txt # nbconvert -nbconvert==7.7.3 +nbconvert==7.8.0 # via # -c envs/dev.env.txt # cirq-ft @@ -175,11 +179,11 @@ networkx==3.1 # via # -c envs/dev.env.txt # cirq-core -numba==0.57.1 +numba==0.58.0 # via # -c envs/dev.env.txt # quimb -numpy==1.24.4 +numpy==1.25.2 # via # -c envs/dev.env.txt # cirq-core @@ -200,7 +204,7 @@ packaging==23.1 # -c envs/dev.env.txt # matplotlib # nbconvert -pandas==2.0.3 +pandas==2.1.1 # via # -c envs/dev.env.txt # cirq-core @@ -220,7 +224,7 @@ pickleshare==0.7.5 # via # -c envs/dev.env.txt # ipython -pillow==10.0.0 +pillow==10.0.1 # via # -c envs/dev.env.txt # matplotlib @@ -248,12 +252,12 @@ pydot==1.4.2 # via # -c envs/dev.env.txt # -r deps/runtime.txt -pygments==2.15.1 +pygments==2.16.1 # via # -c envs/dev.env.txt # ipython # nbconvert -pyparsing==3.0.9 +pyparsing==3.1.1 # via # -c envs/dev.env.txt # matplotlib @@ -264,29 +268,29 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2023.3 +pytz==2023.3.post1 # via # -c envs/dev.env.txt # pandas -pyzmq==25.1.0 +pyzmq==25.1.1 # via # -c envs/dev.env.txt # jupyter-client -quimb==1.5.1 +quimb==1.6.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt -referencing==0.30.0 +referencing==0.30.2 # via # -c envs/dev.env.txt # jsonschema # jsonschema-specifications -rpds-py==0.9.2 +rpds-py==0.10.3 # via # -c envs/dev.env.txt # jsonschema # referencing -scipy==1.11.1 +scipy==1.11.2 # via # -c envs/dev.env.txt # cirq-core @@ -301,7 +305,7 @@ sortedcontainers==2.4.0 # via # -c envs/dev.env.txt # cirq-core -soupsieve==2.4.1 +soupsieve==2.5 # via # -c envs/dev.env.txt # beautifulsoup4 @@ -325,12 +329,12 @@ tornado==6.3.3 # via # -c envs/dev.env.txt # jupyter-client -tqdm==4.65.0 +tqdm==4.66.1 # via # -c envs/dev.env.txt # cirq-core # quimb -traitlets==5.9.0 +traitlets==5.10.0 # via # -c envs/dev.env.txt # comm @@ -342,7 +346,7 @@ traitlets==5.9.0 # nbclient # nbconvert # nbformat -typing-extensions==4.7.1 +typing-extensions==4.8.0 # via # -c envs/dev.env.txt # cirq-core @@ -359,7 +363,7 @@ webencodings==0.5.1 # -c envs/dev.env.txt # bleach # tinycss2 -widgetsnbextension==4.0.8 +widgetsnbextension==4.0.9 # via # -c envs/dev.env.txt # ipywidgets diff --git a/qualtran/_infra/composite_bloq_test.py b/qualtran/_infra/composite_bloq_test.py index 5671c3a14..a14222ed7 100644 --- a/qualtran/_infra/composite_bloq_test.py +++ b/qualtran/_infra/composite_bloq_test.py @@ -344,19 +344,20 @@ def test_complicated_target_register(): cirq.testing.assert_has_diagram( circuit, """\ -control: ───────────@───@───@───@───@───@─── - │ │ │ │ │ │ -target[0, 0, 0]: ───X───┼───┼───┼───┼───┼─── - │ │ │ │ │ -target[0, 1, 0]: ───────X───┼───┼───┼───┼─── - │ │ │ │ -target[0, 2, 0]: ───────────X───┼───┼───┼─── - │ │ │ -target[1, 0, 0]: ───────────────X───┼───┼─── - │ │ -target[1, 1, 0]: ───────────────────X───┼─── - │ -target[1, 2, 0]: ───────────────────────X───""", +control: ────────@───@───@───@───@───@─── + │ │ │ │ │ │ +target[0, 0]: ───X───┼───┼───┼───┼───┼─── + │ │ │ │ │ +target[0, 1]: ───────X───┼───┼───┼───┼─── + │ │ │ │ +target[0, 2]: ───────────X───┼───┼───┼─── + │ │ │ +target[1, 0]: ───────────────X───┼───┼─── + │ │ +target[1, 1]: ───────────────────X───┼─── + │ +target[1, 2]: ───────────────────────X─── +""", ) @@ -407,7 +408,6 @@ def signature(self) -> Signature: return Signature.build(stuff=1) def build_composite_bloq(self, bb: 'BloqBuilder', stuff: 'SoquetT') -> Dict[str, 'Soquet']: - for i in range(3): stuff = bb.add(Atom(), stuff=stuff) return {'stuff': stuff} diff --git a/qualtran/_infra/registers.py b/qualtran/_infra/registers.py index 8441e6426..d37aee001 100644 --- a/qualtran/_infra/registers.py +++ b/qualtran/_infra/registers.py @@ -171,10 +171,10 @@ def get_cirq_quregs(self) -> Dict[str, 'NDArray[cirq.Qid]']: import cirq_ft cirq_regs = [ - cirq_ft.Register(name=reg.name, shape=reg.shape + (reg.bitsize,)) + cirq_ft.Register(name=reg.name, bitsize=reg.bitsize, shape=reg.shape) for reg in self.lefts() ] - return cirq_ft.Registers(cirq_regs).get_named_qubits() + return cirq_ft.infra.get_named_qubits(cirq_regs) def __hash__(self): return hash(self._registers) diff --git a/qualtran/_infra/registers_test.py b/qualtran/_infra/registers_test.py index 7d613bc36..b01b3e381 100644 --- a/qualtran/_infra/registers_test.py +++ b/qualtran/_infra/registers_test.py @@ -103,10 +103,10 @@ def test_agg_split(): def test_get_named_qubits_multidim(): - regs = Signature([Register('matt', shape=(2, 3), bitsize=4)]) + regs = Signature([Register('q', shape=(2, 3), bitsize=4)]) quregs = regs.get_cirq_quregs() - assert quregs['matt'].shape == (2, 3, 4) - assert quregs['matt'][1, 2, 3] == cirq.NamedQubit('matt[1, 2, 3]') + assert quregs['q'].shape == (2, 3, 4) + assert quregs['q'][1, 2, 3] == cirq.NamedQubit('q[1, 2][3]') def test_duplicate_names(): diff --git a/qualtran/bloqs/arithmetic.py b/qualtran/bloqs/arithmetic.py index 84abbe762..9882c4f6f 100644 --- a/qualtran/bloqs/arithmetic.py +++ b/qualtran/bloqs/arithmetic.py @@ -12,17 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from functools import cached_property -from typing import Dict, Tuple, Union - -import cirq from attrs import frozen -from cirq_ft import LessThanEqualGate as CirqLessThanEqual -from cirq_ft import LessThanGate as CirqLessThanGate from cirq_ft import TComplexity -from qualtran import Bloq, CompositeBloq, Register, Signature -from qualtran.cirq_interop import CirqQuregT, decompose_from_cirq_op +from qualtran import Bloq, Register, Signature @frozen @@ -219,74 +212,3 @@ def t_complexity(self): # See: https://github.com/quantumlib/cirq-qubitization/issues/219 # See: https://github.com/quantumlib/cirq-qubitization/issues/217 return TComplexity(t=8 * self.bitsize) - - -@frozen -class LessThanEqual(Bloq): - r"""Implements $U|x,y,z\rangle = |x, y, z \oplus {x \le y}\rangle$. - - Args: - x_bitsize: bitsize of x register. - y_bitsize: bitsize of y register. - - Registers: - - x, y: Registers to compare against eachother. - - z: Register to hold result of comparison. - """ - - x_bitsize: int - y_bitsize: int - - @cached_property - def signature(self) -> Signature: - return Signature( - [ - Register("x", bitsize=self.x_bitsize), - Register("y", bitsize=self.y_bitsize), - Register("z", bitsize=1), - ] - ) - - def decompose_bloq(self) -> 'CompositeBloq': - return decompose_from_cirq_op(self) - - def as_cirq_op( - self, qubit_manager: 'cirq.QubitManager', **cirq_quregs: 'CirqQuregT' - ) -> Tuple[Union['cirq.Operation', None], Dict[str, 'CirqQuregT']]: - less_than = CirqLessThanEqual(x_bitsize=self.x_bitsize, y_bitsize=self.y_bitsize) - x = cirq_quregs['x'] - y = cirq_quregs['y'] - z = cirq_quregs['z'] - return (less_than.on(*x, *y, *z), cirq_quregs) - - -@frozen -class LessThanConstant(Bloq): - r"""Implements $U_a|x\rangle = U_a|x\rangle|z\rangle = |x\rangle |z ^ (x < a)\rangle" - - Args: - bitsize: bitsize of x register. - val: integer to compare x against (a above.) - - Registers: - - x: Registers to compare against val. - - z: Register to hold result of comparison. - """ - - bitsize: int - val: int - - @cached_property - def signature(self) -> Signature: - return Signature.build(x=self.bitsize, z=1) - - def decompose_bloq(self) -> 'CompositeBloq': - return decompose_from_cirq_op(self) - - def as_cirq_op( - self, qubit_manager: 'cirq.QubitManager', **cirq_quregs: 'CirqQuregT' - ) -> Tuple[Union['cirq.Operation', None], Dict[str, 'CirqQuregT']]: - less_than = CirqLessThanGate(bitsize=self.bitsize, less_than_val=self.val) - x = cirq_quregs['x'] - z = cirq_quregs['z'] - return (less_than.on(*x, *z), cirq_quregs) diff --git a/qualtran/bloqs/arithmetic_test.py b/qualtran/bloqs/arithmetic_test.py index bb60208cf..6afdaead6 100644 --- a/qualtran/bloqs/arithmetic_test.py +++ b/qualtran/bloqs/arithmetic_test.py @@ -12,21 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cirq_ft.algos import LessThanEqualGate as CirqLessThanEquals -from cirq_ft.algos import LessThanGate as CirqLessThanConstant -from cirq_ft.infra import t_complexity - -import qualtran.testing as qlt_testing from qualtran import BloqBuilder, Register -from qualtran.bloqs.arithmetic import ( - Add, - GreaterThan, - LessThanConstant, - LessThanEqual, - Product, - Square, - SumOfSquares, -) +from qualtran.bloqs.arithmetic import Add, GreaterThan, Product, Square, SumOfSquares from qualtran.testing import execute_notebook @@ -109,19 +96,5 @@ def test_greater_than(): cbloq = bb.finalize(a=q0, b=q1, result=anc) -def test_less_than_equal(): - lte = LessThanEqual(5, 5) - qlt_testing.assert_valid_bloq_decomposition(lte) - cirq_lte = CirqLessThanEquals(5, 5) - assert lte.decompose_bloq().t_complexity() == t_complexity(cirq_lte) - - -def test_less_than_constant(): - ltc = LessThanConstant(5, 7) - qlt_testing.assert_valid_bloq_decomposition(ltc) - cirq_ltc = CirqLessThanConstant(5, 7) - assert ltc.decompose_bloq().t_complexity() == t_complexity(cirq_ltc) - - def test_notebook(): execute_notebook('arithmetic') diff --git a/qualtran/bloqs/multi_control_multi_target_pauli.py b/qualtran/bloqs/multi_control_multi_target_pauli.py deleted file mode 100644 index 0c26a4b63..000000000 --- a/qualtran/bloqs/multi_control_multi_target_pauli.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from functools import cached_property -from typing import Dict, Tuple - -import cirq -import numpy as np -from attrs import frozen -from cirq_ft import MultiControlPauli as CirqMultiControlPauli - -from qualtran import Bloq, CompositeBloq, Register, Signature -from qualtran.cirq_interop import CirqQuregT, decompose_from_cirq_op - - -@frozen -class MultiControlPauli(Bloq): - """Implements multi-control, single-target C^{n}P gate. - - Implements $C^{n}P = (1 - |1^{n}><1^{n}|) I + |1^{n}><1^{n}| P^{n}$ using $n-1$ - clean ancillas using a multi-controlled `AND` gate. - - References: - [Constructing Large Controlled Nots] - (https://algassert.com/circuits/2015/06/05/Constructing-Large-Controlled-Nots.html) - - Args: - cvs: Control values. Expect a tuple of tuples of control values, where - each tuple of control values should be the same length as the number - of bits in the corresponding control register. E.g. cvs = ((1, 1), - (1,), (1,1,1)) would mean we have 3 control registers of sizes (2, - 1, 3). Currently we assume only control values of 1, a zero would - signify anti controls. - target_pauli: The name of the Pauli gate ("X", "Y", or "Z") - """ - - cvs: Tuple[Tuple[int, ...], ...] - pauli_name: str - - def __attrs_post_init__(self): - assert isinstance(self.pauli_name, str) - assert self.pauli_name in ("X", "Y", "Z") - - @cached_property - def signature(self) -> Signature: - regs = [Register(f"ctrl{i}", bitsize=len(cv)) for i, cv in enumerate(self.cvs)] - regs += [Register('trgt', bitsize=1)] - return Signature(regs) - - def decompose_bloq(self) -> 'CompositeBloq': - return decompose_from_cirq_op(self) - - def as_cirq_op( - self, qubit_manager: 'cirq.QubitManager', **cirq_quregs: 'CirqQuregT' - ) -> Tuple['cirq.Operation', Dict[str, 'CirqQuregT']]: - controls = np.concatenate( - [cirq_quregs[f'ctrl{i}'].tolist() for i, _ in enumerate(self.cvs)] - ) - target = cirq_quregs['trgt'].tolist() - gate_map = {'X': cirq.X, 'Y': cirq.Y, 'Z': cirq.Z} - return ( - CirqMultiControlPauli( - tuple(np.concatenate(self.cvs)), target_gate=gate_map[self.pauli_name] - ).on_registers(controls=controls, target=target), - cirq_quregs, - ) diff --git a/qualtran/bloqs/multi_control_multi_target_pauli_test.py b/qualtran/bloqs/multi_control_multi_target_pauli_test.py deleted file mode 100644 index 4737df286..000000000 --- a/qualtran/bloqs/multi_control_multi_target_pauli_test.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import cirq -from cirq_ft import MultiControlPauli as CirqMultiControlPauli -from cirq_ft.infra import t_complexity - -import qualtran.testing as qlt_testing -from qualtran.bloqs.multi_control_multi_target_pauli import MultiControlPauli - - -def test_multi_control_pauli_decomp(): - mcp = MultiControlPauli(((0, 1, 1, 1, 0),), "X") - qlt_testing.assert_valid_bloq_decomposition(mcp) - - -def test_tcomplexity(): - mcp = MultiControlPauli(((0, 1, 1, 0),), "Z") - cbloq = mcp.decompose_bloq() - cirq_mcp = CirqMultiControlPauli([0, 1, 1, 0], cirq.Z) - assert cbloq.t_complexity() == t_complexity(cirq_mcp) diff --git a/qualtran/bloqs/qrom.py b/qualtran/bloqs/qrom.py deleted file mode 100644 index d42f24598..000000000 --- a/qualtran/bloqs/qrom.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from functools import cached_property -from typing import Dict, Sequence, Tuple - -import cirq -from attrs import frozen -from cirq_ft import QROM as CirqQROM -from numpy.typing import NDArray - -from qualtran import Bloq, CompositeBloq, Register, Signature -from qualtran.cirq_interop import CirqQuregT, decompose_from_cirq_op - - -@frozen -class QROM(Bloq): - """Gate to load data[l] in the target register when the selection stores an index l. - - In the case of multi-dimensional data[p,q,r,...] we use multiple named - selection registers [selection0, selection1, selection2, ...] to index and - load the data. - - Args: - data: List of numpy ndarrays specifying the data to load. If the length - of this list is greater than one then we use the same selection indices - to load each dataset (for example, to load alt and keep data for - state preparation). Each data set is required to have the same - shape and to be of integer type. - selection_bitsizes: The number of bits used to represent each selection register - corresponding to the size of each dimension of the array. Should be - the same length as the shape of each of the datasets. - data_bitsizes: The number of bits used to represent the data - registers. This can be deduced from the maximum element of each of the - datasets. Should be of length len(data), i.e. the number of datasets. - num_controls: The number of controls registers. - """ - - data: Sequence[NDArray] - selection_bitsizes: Tuple[int, ...] - data_bitsizes: Tuple[int, ...] - num_controls: int = 0 - - @cached_property - def signature(self) -> Signature: - regs = [ - Register(f"selection{i}", bitsize=bs) for i, bs in enumerate(self.selection_bitsizes) - ] - regs += [Register(f"target{i}", bitsize=bs) for i, bs in enumerate(self.data_bitsizes)] - if self.num_controls > 0: - regs += [Register("control", bitsize=self.num_controls)] - return Signature(regs) - - def decompose_bloq(self) -> 'CompositeBloq': - return decompose_from_cirq_op(self) - - def as_cirq_op( - self, qubit_manager: 'cirq.QubitManager', **cirq_quregs: 'CirqQuregT' - ) -> Tuple['cirq.Operation', Dict[str, 'CirqQuregT']]: - qrom = CirqQROM( - data=self.data, - selection_bitsizes=self.selection_bitsizes, - target_bitsizes=self.data_bitsizes, - num_controls=self.num_controls, - ) - return (qrom.on_registers(**cirq_quregs), cirq_quregs) - - def __hash__(self): - # This is not a great hash. No guarantees. - # See: https://github.com/quantumlib/Qualtran/issues/339 - return hash(self.signature) - - def __eq__(self, other) -> bool: - return self.signature == other.signature - - def __ne__(self, other) -> bool: - return self.signature != other.signature diff --git a/qualtran/bloqs/qrom_test.py b/qualtran/bloqs/qrom_test.py deleted file mode 100644 index a28658d89..000000000 --- a/qualtran/bloqs/qrom_test.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import numpy as np -from cirq_ft import QROM as CirqQROM -from cirq_ft.infra import t_complexity - -import qualtran.testing as qlt_testing -from qualtran.bloqs.qrom import QROM - - -def test_qrom_decomp(): - data = np.ones((10, 10)) - sel_bitsizes = tuple((s - 1).bit_length() for s in data.shape) - qrom = QROM(data=[data], data_bitsizes=(4,), selection_bitsizes=sel_bitsizes) - qlt_testing.assert_valid_bloq_decomposition(qrom) - - -def test_qrom_decomp_with_control(): - data = np.ones((10, 10)) - sel_bitsizes = tuple((s - 1).bit_length() for s in data.shape) - qrom = QROM(data=[data], data_bitsizes=(4,), selection_bitsizes=sel_bitsizes, num_controls=1) - qlt_testing.assert_valid_bloq_decomposition(qrom) - - -def test_tcomplexity(): - data = np.ones((10, 10)) - sel_bitsizes = tuple((s - 1).bit_length() for s in data.shape) - qrom = QROM([data], selection_bitsizes=sel_bitsizes, data_bitsizes=(4,)) - cbloq = qrom.decompose_bloq() - cqrom = CirqQROM(data=[data], selection_bitsizes=sel_bitsizes, target_bitsizes=(4,)) - assert cbloq.t_complexity() == t_complexity(cqrom) - - -def test_hashing(): - data = np.ones((10, 10)) - sel_bitsizes = tuple((s - 1).bit_length() for s in data.shape) - qrom = QROM([data], selection_bitsizes=sel_bitsizes, data_bitsizes=(4,)) - assert hash(qrom) == hash(qrom) - qrom_2 = QROM([data], selection_bitsizes=sel_bitsizes, data_bitsizes=(5,)) - assert qrom == qrom - assert qrom_2 != qrom diff --git a/qualtran/bloqs/swap_network_cirq_test.py b/qualtran/bloqs/swap_network_cirq_test.py index 390f0534e..8f8198c1f 100644 --- a/qualtran/bloqs/swap_network_cirq_test.py +++ b/qualtran/bloqs/swap_network_cirq_test.py @@ -15,6 +15,7 @@ import random import cirq +import cirq_ft import cirq_ft.infra.testing as cq_testing import numpy as np import pytest @@ -73,7 +74,7 @@ def test_swap_with_zero_gate(selection_bitsize, target_bitsize, n_target_registe def test_swap_with_zero_gate_diagram(): gate = SwapWithZeroGate(3, 2, 4) q = cirq.LineQubit.range(cirq.num_qubits(gate)) - circuit = cirq.Circuit(gate.on_registers(**gate.registers.split_qubits(q))) + circuit = cirq.Circuit(gate.on_registers(**cirq_ft.infra.split_qubits(gate.registers, q))) cirq.testing.assert_has_diagram( circuit, """ diff --git a/qualtran/cirq_interop/_cirq_interop.py b/qualtran/cirq_interop/_cirq_interop.py index a42e2f129..c4f5978cc 100644 --- a/qualtran/cirq_interop/_cirq_interop.py +++ b/qualtran/cirq_interop/_cirq_interop.py @@ -13,7 +13,6 @@ # limitations under the License. """Functionality for the `Bloq.as_cirq_op(...)` protocol""" - import itertools from functools import cached_property from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union @@ -23,7 +22,7 @@ import networkx as nx import numpy as np import quimb.tensor as qtn -from attrs import frozen +from attrs import field, frozen from numpy.typing import NDArray from qualtran import ( @@ -42,14 +41,15 @@ SoquetT, ) from qualtran._infra.composite_bloq import _binst_to_cxns -from qualtran.bloqs.util_bloqs import Allocate, Free CirqQuregT = NDArray[cirq.Qid] CirqQuregInT = Union[NDArray[cirq.Qid], Sequence[cirq.Qid]] def signature_from_cirq_registers(registers: Iterable[cirq_ft.Register]) -> 'Signature': - return Signature([Register(reg.name, bitsize=1, shape=reg.shape) for reg in registers]) + return Signature( + [Register(reg.name, bitsize=reg.bitsize, shape=reg.shape) for reg in registers] + ) @frozen @@ -78,7 +78,9 @@ def cirq_registers(self) -> cirq_ft.Registers: if isinstance(self.gate, cirq_ft.GateWithRegisters): return self.gate.registers else: - return cirq_ft.Registers.build(qubits=cirq.num_qubits(self.gate)) + return cirq_ft.Registers( + [cirq_ft.Register('qubits', shape=(cirq.num_qubits(self.gate),), bitsize=1)] + ) def decompose_bloq(self) -> 'CompositeBloq': quregs = self.signature.get_cirq_quregs() @@ -98,7 +100,13 @@ def add_my_tensors( incoming: Dict[str, 'SoquetT'], outgoing: Dict[str, 'SoquetT'], ): - unitary = cirq.unitary(self.gate).reshape((2,) * 2 * self.cirq_registers.total_bits()) + new_shape = [ + *itertools.chain.from_iterable( + (2**reg.bitsize,) * int(np.prod(reg.shape)) + for reg in [*self.signature.rights(), *self.signature.lefts()] + ) + ] + unitary = cirq.unitary(self.gate).reshape(new_shape) incoming_list = [ *itertools.chain.from_iterable( [np.array(incoming[reg.name]).flatten() for reg in self.signature.lefts()] @@ -135,24 +143,69 @@ def wire_symbol(self, soq: 'Soquet') -> 'WireSymbol': begin = 0 symbol: str = soq.pretty() for reg in self.signature: - finish = begin + np.product(reg.shape) + finish = begin + int(np.prod(reg.shape)) if reg == soq.reg: symbol = np.array(wire_symbols[begin:finish]).reshape(reg.shape)[soq.idx] begin = finish return directional_text_box(text=symbol, side=soq.reg.side) -def _split_qvars_for_regs( - qvars: Sequence[Soquet], signature: Signature +@frozen +class _QReg: + """Used as a container for qubits that form a `cirq_ft.Register` of a given bitsize. + + Each instance of `_QReg` would correspond to a `Soquet` in Bloqs and represents and opaque collection + of qubits that together form a quantum register. + """ + + qubits: Tuple[cirq.Qid, ...] = field( + converter=lambda v: (v,) if isinstance(v, cirq.Qid) else tuple(v) + ) + + +def _ensure_in_reg_exists( + bb: BloqBuilder, in_reg: _QReg, qreg_to_qvar: Dict[_QReg, Soquet] +) -> None: + """Takes care of splits and joins to make sure `qreg_to_qvar[in_reg]` exists.""" + + if in_reg in qreg_to_qvar: + # This is the easy case when no split / joins are needed. + return + + # a. Split all registers containing at-least one qubit corresponding to `in_reg`. + in_reg_qubits = set(in_reg.qubits) + + new_qreg_to_qvar: Dict[_QReg, Soquet] = {} + for qreg, soq in qreg_to_qvar.items(): + if len(qreg.qubits) > 1 and any(q in qreg.qubits for q in in_reg_qubits): + new_qreg_to_qvar |= {_QReg(q): s for q, s in zip(qreg.qubits, bb.split(soq=soq))} + else: + new_qreg_to_qvar[qreg] = soq + qreg_to_qvar.clear() + + # b. Join all 1-bit registers, corresponding to individual qubits, that make up `in_reg`. + soqs_to_join = [] + for qreg, soq in new_qreg_to_qvar.items(): + if len(in_reg_qubits) > 1 and qreg.qubits and qreg.qubits[0] in in_reg_qubits: + assert len(qreg.qubits) == 1, "Individual qubits should have been split by now." + soqs_to_join.append(soq) + else: + qreg_to_qvar[qreg] = soq + if soqs_to_join: + qreg_to_qvar[in_reg] = bb.join(np.array(soqs_to_join)) + + +def _gather_input_soqs( + bb: BloqBuilder, op_quregs: Dict[str, NDArray[_QReg]], qreg_to_qvar: Dict[_QReg, Soquet] ) -> Dict[str, NDArray[Soquet]]: - """Split a flat list of soquets into a dictionary corresponding to `signature`.""" - qvars_regs = {} - base = 0 - for reg in signature: - assert reg.bitsize == 1 - qvars_regs[reg.name] = np.array(qvars[base : base + reg.total_bits()]).reshape(reg.shape) - base += reg.total_bits() - return qvars_regs + qvars_in: Dict[str, NDArray[Soquet]] = {} + for reg_name, quregs in op_quregs.items(): + flat_soqs: List[Soquet] = [] + for qureg in quregs.flatten(): + _ensure_in_reg_exists(bb, qureg, qreg_to_qvar) + flat_soqs.append(qreg_to_qvar[qureg]) + qvars_in[reg_name] = np.array(flat_soqs).reshape(quregs.shape) + return qvars_in def cirq_optree_to_cbloq( @@ -163,92 +216,87 @@ def cirq_optree_to_cbloq( ) -> CompositeBloq: """Convert a Cirq OP-TREE into a `CompositeBloq` with signature `signature`. - Each `cirq.Operation` will be wrapped into a `CirqGateAsBloq` wrapper. + Each `cirq.Operation` will be wrapped into a `CirqGateAsBloq` wrapper. + The signature of the resultant CompositeBloq is `signature`, if provided. Otherwise, use + one thru-register named "qubits" of shape `(n_qubits,)`. + + For multi-dimensional registers and registers with bitsize>1, this function automatically + splits the input soquets and joins the output soquets to ensure compatibility with the + flat-list-of-qubits expected by Cirq. + + When specifying a signature, users must also specify the `cirq_quregs` argument, which is a + mapping of cirq qubits used in the OP-TREE corresponding to the `signature`. If `signature` + has registers with entry - If `signature` is not None, the signature of the resultant CompositeBloq is `signature`. For - multi-dimensional registers and registers with > 1 bitsize, this function automatically - splits the input soquets into a flat list and joins the output soquets into the correct shape - to ensure compatibility with the flat API expected by Cirq. When specifying a signature, users - must also specify the `cirq_quregs` argument, which is a mapping of cirq qubits used in the - OP-TREE corresponding to the `signature`. If `signature` has registers with entry - `Register('x', bitsize=2, shape=(3, 4))` and - `Register('y', bitsize=1, shape=(10, 20))` + then `cirq_quregs` should have one entry corresponding to each register as follows: - - key='x'; value=`np.array(cirq_qubits_used_in_optree, shape=(3, 4, 2))` and - - key='y'; value=`np.array(cirq_qubits_used_in_optree, shape=(10, 20, 1))`. - If `signature` is None, the resultant composite bloq will have one thru-register named "qubits" - of shape `(n_qubits,)`. + - key='x'; value=`np.array(cirq_qubits_used_for_x, shape=(3, 4, 2))` and + - key='y'; value=`np.array(cirq_qubits_used_for_y, shape=(10, 20, 1))`. """ circuit = cirq.Circuit(optree) - # "qubits" means cirq qubits | "qvars" means bloq Soquets if signature is None: - assert cirq_quregs is None + if cirq_quregs is not None: + raise ValueError("`cirq_quregs` requires specifying `signature`.") all_qubits = sorted(circuit.all_qubits()) signature = Signature([Register('qubits', 1, shape=(len(all_qubits),))]) cirq_quregs = {'qubits': np.array(all_qubits).reshape(len(all_qubits), 1)} + elif cirq_quregs is None: + raise ValueError("`signature` requires specifying `cirq_quregs`.") - assert signature is not None and cirq_quregs is not None + cirq_quregs = {k: np.apply_along_axis(_QReg, -1, v) for k, v in cirq_quregs.items()} bb, initial_soqs = BloqBuilder.from_signature(signature, add_registers_allowed=False) - # Magic to make sure signature of the CompositeBloq matches `Signature`. - qubit_to_qvar = {} + # 1. Compute qreg_to_qvar. + qreg_to_qvar: Dict[_QReg, Soquet] = {} for reg in signature.lefts(): - assert reg.name in cirq_quregs + if reg.name not in cirq_quregs: + raise ValueError(f"Register {reg.name} from signature must be present in cirq_quregs.") soqs = initial_soqs[reg.name] if isinstance(soqs, Soquet): - soqs = np.asarray(soqs)[np.newaxis, ...] - if reg.bitsize > 1: - soqs = np.array([bb.split(soq) for soq in soqs.flatten()]) - soqs = soqs.reshape(reg.shape + (reg.bitsize,)) - assert cirq_quregs[reg.name].shape == soqs.shape - qubit_to_qvar |= zip(cirq_quregs[reg.name].flatten(), soqs.flatten()) - - allocated_qubits = set() + soqs = np.array(soqs) + if cirq_quregs[reg.name].shape != soqs.shape: + raise ValueError( + f"Shape {cirq_quregs[reg.name].shape} of cirq register " + f"{reg.name} should be {soqs.shape}." + ) + qreg_to_qvar |= zip(cirq_quregs[reg.name].flatten(), soqs.flatten()) + + # 2. Add allocated qubits to qreg_to_qvar + all_qubits = set(q for qreg in qreg_to_qvar for q in qreg.qubits) + allocated_qubits = _QReg(sorted(circuit.all_qubits() - all_qubits)) + if allocated_qubits.qubits: + qreg_to_qvar |= {allocated_qubits: bb.allocate(len(allocated_qubits.qubits))} + + # 3. Add each operation to the bloq. for op in circuit.all_operations(): if op.gate is None: raise ValueError(f"Only gate operations are supported, not {op}.") bloq = CirqGateAsBloq(op.gate) - for q in op.qubits: - if q not in qubit_to_qvar: - qubit_to_qvar[q] = bb.add(Allocate(1)) - allocated_qubits.add(q) - - qvars_in = [qubit_to_qvar[qubit] for qubit in op.qubits] - qvars_out = bb.add_t(bloq, **_split_qvars_for_regs(qvars_in, bloq.signature)) - qubit_to_qvar |= zip( - op.qubits, itertools.chain.from_iterable([arr.flatten() for arr in qvars_out]) - ) - - for q in allocated_qubits: - bb.add(Free(1), free=qubit_to_qvar[q]) - - qvars = np.array([*qubit_to_qvar.values()]) - final_soqs = {} - idx = 0 - for reg in signature.rights(): - name = reg.name - assert name in cirq_quregs - soqs = qvars[idx : idx + np.product(cirq_quregs[name].shape)] - idx = idx + np.product(cirq_quregs[name].shape) - if reg.bitsize > 1: - # Need to combine the soquets here. - if len(soqs) == reg.bitsize: - final_soqs[name] = bb.join(soqs) - else: - final_soqs[name] = np.array( - [ - bb.join(soqs[st : st + reg.bitsize]) - for st in range(0, len(soqs), reg.bitsize) - ] - ).reshape(reg.shape) - else: - if len(soqs) == 1 and reg.shape == (): - final_soqs[name] = soqs[0] - else: - final_soqs[name] = soqs.reshape(reg.shape) + # 3.1 Find input soquets. + op_quregs: Dict[str, NDArray[_QReg]] = { + k: np.apply_along_axis(_QReg, -1, v) + for k, v in cirq_ft.infra.split_qubits(bloq.cirq_registers, op.qubits).items() + } + qvars_in = _gather_input_soqs(bb, op_quregs, qreg_to_qvar) + # 3.2 Add Bloq + qvars_out = bb.add_d(bloq, **qvars_in) + + # 3.3 Update qubit registers to soquets mapping using output soquets. + for reg_name, quregs in op_quregs.items(): + qreg_to_qvar |= zip(quregs.flatten(), np.array(qvars_out[reg_name]).flatten()) + + # 4. Deallocated newly allocated qubits. + if allocated_qubits.qubits: + _ensure_in_reg_exists(bb, allocated_qubits, qreg_to_qvar) + bb.free(qreg_to_qvar.pop(allocated_qubits)) + + # 5. Combine Soquets to match the right signature. + final_soqs = _gather_input_soqs(bb, cirq_quregs, qreg_to_qvar) return bb.finalize(**final_soqs) @@ -452,8 +500,9 @@ def _init_legacy_regs(bloq: Bloq) -> Tuple[cirq_ft.Registers, Mapping[str, Regis for reg in bloq.signature: compat_name = f'{reg.name}{side_suffixes[reg.side]}' compat_name_map[compat_name] = reg - full_shape = reg.shape + (reg.bitsize,) - legacy_regs.append(cirq_ft.Register(name=compat_name, shape=full_shape)) + legacy_regs.append( + cirq_ft.Register(name=compat_name, shape=reg.shape, bitsize=reg.bitsize) + ) return cirq_ft.Registers(legacy_regs), compat_name_map @classmethod diff --git a/qualtran/cirq_interop/_cirq_interop_test.py b/qualtran/cirq_interop/_cirq_interop_test.py index 96681cd66..05ae4ac03 100644 --- a/qualtran/cirq_interop/_cirq_interop_test.py +++ b/qualtran/cirq_interop/_cirq_interop_test.py @@ -97,35 +97,37 @@ class CirqGateWithRegisters(cirq_ft.GateWithRegisters): def registers(self) -> cirq_ft.Registers: return cirq_ft.Registers([self.reg]) - reg1 = cirq_ft.Register('x', shape=(3, 4, 2)) - reg2 = cirq_ft.Register('y', shape=(12, 2)) - anc_reg = cirq_ft.Register('anc', shape=(2, 3)) + reg1 = cirq_ft.Register('x', shape=(3, 4), bitsize=2) + reg2 = cirq_ft.Register('y', shape=12, bitsize=2) + anc_reg = cirq_ft.Register('anc', shape=4, bitsize=2) qubits = cirq.LineQubit.range(24) - anc_qubits = cirq.NamedQubit.range(3, prefix='anc') + anc_qubits = cirq.NamedQubit.range(4, prefix='anc') circuit = cirq.Circuit( CirqGateWithRegisters(reg1).on(*qubits), - CirqGateWithRegisters(anc_reg).on(*anc_qubits, *qubits[:3]), + CirqGateWithRegisters(anc_reg).on(*anc_qubits, *qubits[:4]), CirqGateWithRegisters(reg2).on(*qubits), ) # Test-1: When no signature is specified, the method uses a default signature. Ancilla qubits # are also included in the signature itself, so no allocations / deallocations are needed. cbloq = cirq_optree_to_cbloq(circuit) assert cbloq.signature == qualtran.Signature( - [qualtran.Register(name='qubits', bitsize=1, shape=(27,))] + [qualtran.Register(name='qubits', bitsize=1, shape=(28,))] ) bloq_instances = [binst for binst, _, _ in cbloq.iter_bloqnections()] - assert bloq_instances[0].bloq == CirqGateAsBloq(CirqGateWithRegisters(reg1)) - assert bloq_instances[0].bloq.signature == qualtran.Signature( - [qualtran.Register(name='x', bitsize=1, shape=(3, 4, 2))] + assert all(bloq_instances[i].bloq == Join(2) for i in range(14)) + assert bloq_instances[14].bloq == CirqGateAsBloq(CirqGateWithRegisters(reg1)) + assert bloq_instances[14].bloq.signature == qualtran.Signature( + [qualtran.Register(name='x', bitsize=2, shape=(3, 4))] ) - assert bloq_instances[1].bloq == CirqGateAsBloq(CirqGateWithRegisters(anc_reg)) - assert bloq_instances[1].bloq.signature == qualtran.Signature( - [qualtran.Register(name='anc', bitsize=1, shape=(2, 3))] + assert bloq_instances[15].bloq == CirqGateAsBloq(CirqGateWithRegisters(anc_reg)) + assert bloq_instances[15].bloq.signature == qualtran.Signature( + [qualtran.Register(name='anc', bitsize=2, shape=(4,))] ) - assert bloq_instances[2].bloq == CirqGateAsBloq(CirqGateWithRegisters(reg2)) - assert bloq_instances[2].bloq.signature == qualtran.Signature( - [qualtran.Register(name='y', bitsize=1, shape=(12, 2))] + assert bloq_instances[16].bloq == CirqGateAsBloq(CirqGateWithRegisters(reg2)) + assert bloq_instances[16].bloq.signature == qualtran.Signature( + [qualtran.Register(name='y', bitsize=2, shape=(12,))] ) + assert all(bloq_instances[-i].bloq == Split(2) for i in range(1, 15)) # Test-2: If you provide an explicit signature, you must also provide a mapping of cirq qubits # matching the signature. The additional ancilla allocations are automatically handled. new_signature = qualtran.Signature( @@ -144,8 +146,8 @@ def registers(self) -> cirq_ft.Registers: bloqs_list = [binst.bloq for binst in cbloq.bloq_instances] assert bloqs_list.count(Split(3)) == 6 assert bloqs_list.count(Join(3)) == 6 - assert bloqs_list.count(Allocate(1)) == 3 - assert bloqs_list.count(Free(1)) == 3 + assert bloqs_list.count(Allocate(4)) == 1 + assert bloqs_list.count(Free(4)) == 1 @frozen @@ -299,29 +301,29 @@ def test_bloq_as_cirq_gate_multi_dimensional_signature(): │ selection1: ──────selection────── │ -targets[0, 0]: ───targets──────── +targets[0][0]: ───targets──────── │ -targets[0, 1]: ───targets──────── +targets[0][1]: ───targets──────── │ -targets[0, 2]: ───targets──────── +targets[0][2]: ───targets──────── │ -targets[1, 0]: ───targets──────── +targets[1][0]: ───targets──────── │ -targets[1, 1]: ───targets──────── +targets[1][1]: ───targets──────── │ -targets[1, 2]: ───targets──────── +targets[1][2]: ───targets──────── │ -targets[2, 0]: ───targets──────── +targets[2][0]: ───targets──────── │ -targets[2, 1]: ───targets──────── +targets[2][1]: ───targets──────── │ -targets[2, 2]: ───targets──────── +targets[2][2]: ───targets──────── │ -targets[3, 0]: ───targets──────── +targets[3][0]: ───targets──────── │ -targets[3, 1]: ───targets──────── +targets[3][1]: ───targets──────── │ -targets[3, 2]: ───targets──────── +targets[3][2]: ───targets──────── ''', ) cbloq = bloq.decompose_bloq() @@ -332,29 +334,29 @@ def test_bloq_as_cirq_gate_multi_dimensional_signature(): │ selection1: ──────@(approx)───@(approx)───┼─────────── │ │ │ -targets[0, 0]: ───×(x)────────┼───────────×(x)──────── +targets[0][0]: ───×(x)────────┼───────────×(x)──────── │ │ │ -targets[0, 1]: ───×(x)────────┼───────────×(x)──────── +targets[0][1]: ───×(x)────────┼───────────×(x)──────── │ │ │ -targets[0, 2]: ───×(x)────────┼───────────×(x)──────── +targets[0][2]: ───×(x)────────┼───────────×(x)──────── │ │ │ -targets[1, 0]: ───×(y)────────┼───────────┼─────────── +targets[1][0]: ───×(y)────────┼───────────┼─────────── │ │ │ -targets[1, 1]: ───×(y)────────┼───────────┼─────────── +targets[1][1]: ───×(y)────────┼───────────┼─────────── │ │ │ -targets[1, 2]: ───×(y)────────┼───────────┼─────────── +targets[1][2]: ───×(y)────────┼───────────┼─────────── │ │ -targets[2, 0]: ───────────────×(x)────────×(y)──────── +targets[2][0]: ───────────────×(x)────────×(y)──────── │ │ -targets[2, 1]: ───────────────×(x)────────×(y)──────── +targets[2][1]: ───────────────×(x)────────×(y)──────── │ │ -targets[2, 2]: ───────────────×(x)────────×(y)──────── +targets[2][2]: ───────────────×(x)────────×(y)──────── │ -targets[3, 0]: ───────────────×(y)──────────────────── +targets[3][0]: ───────────────×(y)──────────────────── │ -targets[3, 1]: ───────────────×(y)──────────────────── +targets[3][1]: ───────────────×(y)──────────────────── │ -targets[3, 2]: ───────────────×(y)──────────────────── +targets[3][2]: ───────────────×(y)──────────────────── ''', ) diff --git a/qualtran/cirq_interop/cirq_interop.ipynb b/qualtran/cirq_interop/cirq_interop.ipynb index 5d56f3766..fa68e993e 100644 --- a/qualtran/cirq_interop/cirq_interop.ipynb +++ b/qualtran/cirq_interop/cirq_interop.ipynb @@ -220,6 +220,29 @@ "assert bloq.t_complexity() == cirq_ft.t_complexity(prepare.gate)" ] }, + { + "cell_type": "markdown", + "id": "5065f197-f9f9-4fd2-a3a5-abfd82e3e387", + "metadata": {}, + "source": [ + "Another example as follows is to import the data loading oracle QROM from Cirq-FT into Qualtran by wrapping it into a `CirqGateAsBloq`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba083d2c-c0b2-4fec-ab61-2cae21676169", + "metadata": {}, + "outputs": [], + "source": [ + "cirq_qrom = cirq_ft.QROM.build([10, 20, 30], num_controls=1)\n", + "bloq = CirqGateAsBloq(cirq_qrom)\n", + "cbloq = bloq.decompose_bloq()\n", + "show_bloq(cbloq)\n", + "fig, ax = draw_musical_score(get_musical_score_data(cbloq))\n", + "fig.set_size_inches(16, 5)" + ] + }, { "cell_type": "markdown", "id": "03f03231",