Commit f67634f
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
- #13361 parent 7b81e72 commit f67634f
41 files changed
Lines changed: 776 additions & 678 deletions
File tree
- .github/workflows
- dev_tools/requirements
- deps
- envs
- qualtran
- _infra
- bloqs
- arithmetic
- block_encoding
- chemistry/hubbard_model/qubitization
- data_loading
- for_testing
- hamiltonian_simulation
- mcmt
- multiplexers
- phase_estimation
- qsp
- qubitization
- reflections
- rotations
- cirq_interop
- linalg/polynomial
- rotation_synthesis
- lattice
- protocols
- simulation/tensor
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments