API: deprecate size-2 inputs for np.cross [Array API]#24818
API: deprecate size-2 inputs for np.cross [Array API]#24818ngoldbaum merged 1 commit intonumpy:mainfrom
np.cross [Array API]#24818Conversation
f609711 to
8e9af15
Compare
|
Hey Mateusz, good idea to get started on this topic.
Indeed. We want the
Yep, that's a good place to start. The other place to look at is https://numpy.org/devdocs/reference/array_api.html#table-of-differences-between-numpy-array-api-and-numpy; the "compatible" and "breaking" entries there are the things to add/change. |
d5b5cda to
8664533
Compare
np.crossnp.cross [Array API]
8664533 to
f2f9e8c
Compare
numpy/_core/numeric.py
Outdated
| # Deprecated in NumPy 2.0, 2023-09-26 | ||
| warnings.warn( | ||
| "2-dimensional input arrays are deprecated. Use 3-dimensional " | ||
| "instead. (deprecated in NumPy 2.0)", |
There was a problem hiding this comment.
This is a little confusing, since n-dimensional stacks of vectors are fine, the only thing that matters is if the final dimension is 2. Maybe rephrase this to talk about arrays of 2D and 3D vectors instead of just 2D or 3D arrays?
There was a problem hiding this comment.
Sure - I changed warning to:
"Arrays of 2-dimensional vectors are deprecated. Use arrays of "
"3-dimensional vectors instead. (deprecated in NumPy 2.0)"
7f6fc45 to
3f5dee9
Compare
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
3f5dee9 to
ea42abc
Compare
np.cross [Array API]np.cross [Array API]
|
Thanks @mtsokol! |
Hi @rgommers,
As NEP 52 comes closer to the end I decided to start a warmup for the next milestone. IIRC you mentioned I could potentially focus on "Array API support in NumPy" workstream.
From our conversation in July I noted such introductory tasks:
Some questions:
numpy.array_apialready has compatibletraceanddiagonal, but you meant adding these methods tonp.linalgdirectly, right? (so duplicating a bitnp.traceandnp.diagonal)This small PR adds a deprecation to
np.crossfor 2-size input.