diff --git a/dev_tools/requirements/deps/runtime.txt b/dev_tools/requirements/deps/runtime.txt index 53d1a689e..88e5892f3 100644 --- a/dev_tools/requirements/deps/runtime.txt +++ b/dev_tools/requirements/deps/runtime.txt @@ -2,9 +2,9 @@ attrs>=23.2.0 cachetools>=5.3 networkx -numpy +numpy~=1.26 sympy -cirq-core==1.4 +cirq-core>=1.4.0,<1.6 fxpmath galois diff --git a/dev_tools/requirements/envs/dev.env.txt b/dev_tools/requirements/envs/dev.env.txt index 832df2303..9f759d4fd 100644 --- a/dev_tools/requirements/envs/dev.env.txt +++ b/dev_tools/requirements/envs/dev.env.txt @@ -94,7 +94,7 @@ cffi==1.17.1 # cryptography charset-normalizer==3.4.3 # via requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -r deps/runtime.txt # openfermion diff --git a/dev_tools/requirements/envs/docs.env.txt b/dev_tools/requirements/envs/docs.env.txt index 9c54fae7d..fc883eaed 100644 --- a/dev_tools/requirements/envs/docs.env.txt +++ b/dev_tools/requirements/envs/docs.env.txt @@ -123,7 +123,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/dev_tools/requirements/envs/format.env.txt b/dev_tools/requirements/envs/format.env.txt index 7a1f265ca..36b1898b5 100644 --- a/dev_tools/requirements/envs/format.env.txt +++ b/dev_tools/requirements/envs/format.env.txt @@ -109,7 +109,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/dev_tools/requirements/envs/mypy.env.txt b/dev_tools/requirements/envs/mypy.env.txt index a73204217..fc563b1f3 100644 --- a/dev_tools/requirements/envs/mypy.env.txt +++ b/dev_tools/requirements/envs/mypy.env.txt @@ -101,7 +101,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/dev_tools/requirements/envs/pylint.env.txt b/dev_tools/requirements/envs/pylint.env.txt index 47c171c0b..f60f73ec0 100644 --- a/dev_tools/requirements/envs/pylint.env.txt +++ b/dev_tools/requirements/envs/pylint.env.txt @@ -122,7 +122,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/dev_tools/requirements/envs/pytest.env.txt b/dev_tools/requirements/envs/pytest.env.txt index 0f27f63cc..9b379ccbf 100644 --- a/dev_tools/requirements/envs/pytest.env.txt +++ b/dev_tools/requirements/envs/pytest.env.txt @@ -109,7 +109,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/dev_tools/requirements/envs/runtime.env.txt b/dev_tools/requirements/envs/runtime.env.txt index e9154812e..45b4197af 100644 --- a/dev_tools/requirements/envs/runtime.env.txt +++ b/dev_tools/requirements/envs/runtime.env.txt @@ -101,7 +101,7 @@ charset-normalizer==3.4.3 # via # -c envs/dev.env.txt # requests -cirq-core==1.4.0 +cirq-core==1.5.0 # via # -c envs/dev.env.txt # -r deps/runtime.txt diff --git a/qualtran/bloqs/bookkeeping/split_test.py b/qualtran/bloqs/bookkeeping/split_test.py index 685d7664a..4ad2d5012 100644 --- a/qualtran/bloqs/bookkeeping/split_test.py +++ b/qualtran/bloqs/bookkeeping/split_test.py @@ -70,10 +70,15 @@ def test_classical_sim_dtypes(): assert isinstance(xx, np.ndarray) assert xx.tolist() == [1, 1, 1, 1, 1, 1, 1, 1] - # Warning: numpy will wrap too-large values - (xx,) = s.call_classically(reg=np.uint8(256)) - assert isinstance(xx, np.ndarray) - assert xx.tolist() == [0, 0, 0, 0, 0, 0, 0, 0] + numpy_major_version = int(np.__version__.split('.')[0]) + if numpy_major_version < 2: + # Warning: numpy 1 will wrap too-large values + (xx,) = s.call_classically(reg=np.uint8(256)) + assert isinstance(xx, np.ndarray) + assert xx.tolist() == [0, 0, 0, 0, 0, 0, 0, 0] + else: + with pytest.raises(OverflowError): + (xx,) = s.call_classically(reg=np.uint8(256)) with pytest.raises(ValueError): _ = s.call_classically(reg=np.uint16(256)) diff --git a/qualtran/bloqs/swap_network/cswap_approx.py b/qualtran/bloqs/swap_network/cswap_approx.py index 362798e24..eb2eea04b 100644 --- a/qualtran/bloqs/swap_network/cswap_approx.py +++ b/qualtran/bloqs/swap_network/cswap_approx.py @@ -72,6 +72,7 @@ def decompose_from_registers( ) -> Iterator[cirq.OP_TREE]: ctrl, target_x, target_y = quregs['ctrl'], quregs['x'], quregs['y'] + def g(q: cirq.Qid, adjoint=False) -> Iterator[cirq.OP_TREE]: yield [cirq.S(q), cirq.H(q)] yield cirq.T(q) ** (1 - 2 * adjoint)