| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
* Add reshape differences to the array API compat document
* Add an item to the array API compat document about reverse broadcasting
* Make some wording easier to read
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As noted at #21995 (comment), the new test from #21995 was placed in a directory intended for the Array API, and unrelated to the change.
* Consolidate test_dtype_identity into an existing test file.
Remove `test_asarray.py`. Create a new `TestAsArray` suite in
`test_array_coercion.py`
* Linting.
Wrap some comments that got too long after function became
a method (with additional indentation).
|
|\
| |
| | |
BUG: Distinguish exact vs. equivalent dtype for C type aliases.
|
| | |
|
| |
| |
| |
| | |
Shorten some lines.
|
| |
| |
| |
| |
| |
| |
| | |
* Improve comments/docs.
* Improve descriptiveness of variable names.
* Add additional test expressions that would not pass without
this patch.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
* Fix the implementation of numpy.array_api.vecdot
See https://data-apis.org/array-api/latest/API_specification/generated/signatures.linear_algebra_functions.vecdot.html
* Use moveaxis + matmul instead of einsum in vecdot
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix computation of numpy.array_api.linalg.vector_norm
Various pieces were incorrect due to a lack of complete coverage of this
function in the array API test suite.
* Fix the output dtype nonstandard vector norm()
Previously it would always give float64 because an internal calculation
involved a NumPy scalar and a Python float. The fix is to use a 0-D array
instead of a NumPy scalar so that it type promotes with the float correctly.
Fixes #21083
I don't have a test for this yet because I'm unclear how exactly to test it.
* Clean up the numpy.array_api.linalg.vector_norm code a little bit
|
|
|
|
|
| |
The spec requires this, but it is only now possible to implement with the new
equal_nan flag in np.unique().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* TST: Add test checking if newaxis indexing works for `array_api`
Also removes previous check against newaxis indexing, which is now outdated
* TST, BUG: Allow `None` in `array_api` indexing
Introduces test for validating flat indexing when `None` is present
* MAINT,DOC,TST: Rework of `_validate_index()` in `numpy.array_api`
_validate_index() is now called as self._validate_index(shape), and does not
return a key. This rework removes the recursive pattern used. Tests are
introduced to cover some edge cases. Additionally, its internal docstring
reflects new behaviour, and extends the flat indexing note.
* MAINT: `advance` -> `advanced` (integer indexing)
Co-authored-by: Aaron Meurer <asmeurer@gmail.com>
* BUG: array_api arrays use internal arrays from array_api array keys
When an array_api array is passed as the key for get/setitem, we access the
key's internal np.ndarray array to be used as the key for the internal
get/setitem operation. This behaviour was initially removed when
`_validate_index()` was reworked.
* MAINT: Better flat indexing error message for `array_api` arrays
Also better semantics for its prior ellipsis count condition
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* MAINT: `array_api` arrays don't special case multi-ellipsis errors
This gets handled by NumPy-proper.
Co-authored-by: Aaron Meurer <asmeurer@gmail.com>
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Specifically for `xp.unique_all()` and `xp.unique_inverse()`
|
|\
| |
| | |
BUG: Allow integer inputs for pow-related functions in `array_api`
|
| |
| |
| |
| | |
Updates `xp.power()`, `x.__pow__()`, `x.__ipow()__` and `x.__rpow()__`
|
|/
|
|
|
| |
* BUG: `array_api.argsort(descending=True)` respects relative order
* Regression test for stable descending `array_api.argsort()`
|
|\
| |
| | |
TYP: add a few type annotations to `numpy.array_api.Array`
|
| |
| |
| | |
Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fixes the majority of the complaints for `$ mypy numpy/array_api`.
The comment indicating that one fix is blocked by lack of support in
Mypy for `NotImplemented` is responsible for another several dozen
errors.
[skip ci]
|
|/
|
|
|
|
| |
This is more precise, we are returning a module here. Type checkers
will be able to use this info in the future - see
https://github.com/data-apis/array-api/issues/267
|
|\
| |
| | |
BUG: Fix handling of the dtype parameter to numpy.array_api.prod()
|
| | |
|
| |
| |
| |
| | |
Thanks @BvB93
|
|/
|
|
|
|
|
|
|
|
|
| |
This is *NOT* part of the array API spec (so it should not be relied on for
portable code). However, without this, np.asarray(np.array_api.Array) produces
an object array instead of doing the conversion to a NumPy array as expected.
This would work once np.asarray() implements dlpack support, but until then,
it seems reasonable to make the conversion work.
Note that the reverse, calling np.array_api.asarray(np.array), already works
because np.array_api.asarray() is just a wrapper for np.asarray().
|
| |
|
|
|
|
| |
Fixes #20498.
|
|\
| |
| | |
ENH: Add support for copy modes to NumPy
|
| |\ |
|
| |\ \ |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| |_|/
|/| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Allow casting in the array API asarray()
* Restrict multidimensional indexing in the array API namespace
The spec has recently been updated to only require multiaxis (i.e., tuple)
indices in the case where every axis is indexed, meaning there are either as
many indices as axes or the index has an ellipsis.
* Fix type promotion for numpy.array_api.where
where does value-based promotion for 0-dimensional arrays, so we use the same
trick as in the Array operators to avoid this.
* Print empty array_api arrays using empty()
Printing behavior isn't required by the spec. This is just to make things
easier to understand, especially with the array API test suite.
* Fix an incorrect slice bounds guard in the array API
* Disallow multiple different dtypes in the input to np.array_api.meshgrid
* Remove DLPack support from numpy.array_api.asarray()
from_dlpack() should be used to create arrays using DLPack.
* Remove __len__ from the array API array object
* Add astype() to numpy.array_api
* Update the unique_* functions in numpy.array_api
unique() in the array API was replaced with three separate functions,
unique_all(), unique_inverse(), and unique_values(), in order to avoid
polymorphic return types.
Additionally, it should be noted that these functions to not currently conform
to the spec with respect to NaN behavior. The spec requires multiple NaNs to
be returned, but np.unique() returns a single NaN. Since this is currently an
open issue in NumPy to possibly revert, I have not yet worked around this. See
https://github.com/numpy/numpy/issues/20326.
* Add the stream argument to the array API to_device method
This does nothing in NumPy, and is just present so that the signature is valid
according to the spec.
* Use the NamedTuple classes for the type signatures
* Add unique_counts to the array API namespace
* Remove some unused imports
* Update the array_api indexing restrictions
The "multiaxis indexing must index every axis explicitly or use an ellipsis"
was supposed to include any type of index, not just tuple indices.
* Use a simpler type annotation for the array API to_device method
* Fix a test failure in the array_api submodule
The array_api cannot use the NumPy testing functions because array_api arrays
do not mix with NumPy arrays, and also NumPy testing functions may use APIs
that aren't supported in the array API.
* Add dlpack support to the array_api submodule
|