Address new copy semantics & broadcasting in np.solve
in NumPy 2
#7341
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.
Description
With NumPy 2.0.0,
copy=False
now raises a ValueError if the copy cannot be made innumpy.asarray
andnumpy.array
, see the release notes for details. I'm using an approach by astropy to address this.Additionally, broadcasting in
np.linalg.solve
is now handled differently in a backwards-incompatible way, see release notes on the recommended fix.Checklist
./doc/examples
for new featuresRelease note
We use changelist to
compile each pull request into an item of the release notes. Please refer to
the instructions
and past release notes
for guidance and examples.