Skip to content

Commit f67634f

Browse files
authored
Support Numpy 2 via supporting Cirq 1.5+ (#1761)
## Changes for numpy - data_types.py -- np.uint8 is stricter now - and_bloq.by -- there were np.uint8's sneaking in - There are new mypy complaints that I've generally ignored ## Changes for Cirq We require a more recent version of Cirq to support Numpy 2. ### ControlledGate and `_has_unitary_` I've monkeypatched `cirq.ControlledGate`. It was using `cirq.has_unitary` to determine whether something could be controlled. The rest of Cirq now treats "has unitary" as the ability to create a unitary matrix rather than saying whether the gate is reversible. - Tracked in #1764 . ### Simulation There is something fundamentally incompatible between Qualtran's cirq interop functionality and recent Cirq versions. I've taken the "nuclear option", and now when you request the cirq simulation of a `BloqAsCirqGate` it will be done entirely in Qualtran and export a large unitary matrix to the cirq simulator; which can cause performance regressions; - see #1763. In this PR, I've implemented the quick fixes to speed up Qualtran simulation of narrow, deep circuits from my comment on #1336 Some of the unit tests now cause SIGKILL on my machine. I don't know what's going on here. I've xfailed them. - See #1763. ## Related issues - #237 - #1488 (technically fixes, as written; but see performance regression issue) - #1495 - #1336
1 parent 7b81e72 commit f67634f

41 files changed

Lines changed: 776 additions & 678 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
pip install -r dev_tools/requirements/envs/pytest.env.txt
4444
pip install --no-deps -e .
4545
- run: |
46-
check/pytest
46+
check/pytest --durations=10

dev_tools/requirements/deps/runtime.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
attrs>=23.2.0
33
cachetools>=5.3
44
networkx
5-
numpy~=1.26
5+
numpy>=1.26,<3.0
66
sympy
7-
cirq-core>=1.4.0,<1.5 # https://github.com/quantumlib/Qualtran/issues/1708
7+
cirq-core~=1.4
88
fxpmath
99
galois
1010

0 commit comments

Comments
 (0)