Support Numpy 2 via supporting Cirq 1.5+ #1761
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes for numpy
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 usingcirq.has_unitaryto 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.cirq.ControlledGateis brittle #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
BloqAsCirqGateit will be done entirely in Qualtran and export a large unitary matrix to the cirq simulator; which can cause performance regressions;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.
Related issues
cirq.unitaryfails for bloq withAndfollowed byAnd^dagger#1488 (technically fixes, as written; but see performance regression issue)cirq.unitarydoes not work for controlledQubitizationWalkOperatoroperator #1495cirq.unitaryfor hamiltonian simulation bloq #1336