summaryrefslogtreecommitdiff
path: root/numpy/array_api
Commit message (Collapse)AuthorAgeFilesLines
* Note `np.array_api.can_cast()` does not use `np.can_cast()`Matthew Barber2022-02-092-2/+5
|
* BUG: Fix `np.array_api.can_cast()` by not relying on `np.can_cast()`Matthew Barber2022-02-093-4/+58
|
* Regression test for inverse indices in `array_api` set functionsMatthew2022-01-131-0/+19
|
* BUG: Return correctly shaped inverse indices in `array_api`Matthew2022-01-131-5/+15
| | | | Specifically for `xp.unique_all()` and `xp.unique_inverse()`
* Merge pull request #20762 from honno/xp-pow-fixesCharles Harris2022-01-124-12/+10
|\ | | | | BUG: Allow integer inputs for pow-related functions in `array_api`
| * BUG: Allow integer inputs for pow-related functions in `array_api`Matthew2022-01-074-12/+10
| | | | | | | | Updates `xp.power()`, `x.__pow__()`, `x.__ipow()__` and `x.__rpow()__`
* | BUG: `array_api.argsort(descending=True)` respects relative sort order (#20788)Matthew Barber2022-01-122-3/+37
|/ | | | | * BUG: `array_api.argsort(descending=True)` respects relative order * Regression test for stable descending `array_api.argsort()`
* Merge pull request #20720 from rgommers/arrayapi-annotation-fixesMatti Picus2022-01-041-2/+3
|\ | | | | TYP: add a few type annotations to `numpy.array_api.Array`
| * TYP: accept review comment on ignoring NotImplemented in type checkingRalf Gommers2022-01-041-4/+1
| | | | | | Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
| * TYP: add a few type annotations to `numpy.array_api.Array`Ralf Gommers2022-01-031-1/+5
| | | | | | | | | | | | | | | | | | 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]
* | TYP: change type annotation for `__array_namespace__` to ModuleTypeRalf Gommers2022-01-031-1/+2
|/ | | | | | 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
* Merge pull request #20533 from asmeurer/array_api-prod-fixCharles Harris2021-12-071-2/+2
|\ | | | | BUG: Fix handling of the dtype parameter to numpy.array_api.prod()
| * BUG: Fix handling of the dtype parameter to numpy.array_api.prod()Aaron Meurer2021-12-071-2/+2
| |
* | Add type hints to the numpy.array_api.Array.__array__ signatureAaron Meurer2021-12-061-1/+2
| | | | | | | | Thanks @BvB93
* | ENH: Add __array__ to the array_api Array objectAaron Meurer2021-12-062-0/+18
|/ | | | | | | | | | | 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().
* Add tests for T and mT in array_apiAaron Meurer2021-12-011-0/+14
|
* BUG: Fix the .T attribute in the array_api namespaceAaron Meurer2021-12-011-1/+1
| | | | Fixes #20498.
* Merge pull request #19173 from czgdp1807/never_copyMatti Picus2021-11-152-8/+14
|\ | | | | ENH: Add support for copy modes to NumPy
| * Merge branch 'main' into never_copyRalf Gommers2021-11-128-44/+162
| |\
| * \ resolved conflictsGagandeep Singh2021-11-0210-51/+192
| |\ \
| * | | Addressed reviewsczgdp18072021-09-042-4/+4
| | | |
| * | | fixed linting issuesczgdp18072021-09-031-2/+2
| | | |
| * | | fixed linting issuesczgdp18072021-09-031-1/+2
| | | |
| * | | CopyMode added to np.array_apiczgdp18072021-09-032-6/+11
| | | |
* | | | ENH: Add the linalg extension to the array_api submodule (#19980)Aaron Meurer2021-11-145-79/+419
| |_|/ |/| |
* | | MAINT: A few updates to the array_api (#20066)Aaron Meurer2021-11-128-49/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | | Merge pull request #19083 from hameerabbasi/dlpackSebastian Berg2021-11-092-3/+3
|\ \ \ | | | | | | | | ENH: Implement the DLPack Array API protocols for ndarray.
| * | | change from_dlpack to _dlpack, remove unused headermattip2021-11-022-3/+3
| | |/ | |/|
* | | TST: Add a test for device property in `array_api` namespace (#20271)Amit Kumar2021-11-031-0/+11
|/ /
* | Merge pull request #20071 from alessiamarcolini/refactorCharles Harris2021-10-221-15/+0
|\ \ | | | | | | MAINT: Remove unused imports and remove duplicated tests
| * | MAINT: remove unused importsAlessia Marcolini2021-10-081-15/+0
| | |
* | | MAINT: Replace the `__array_namespace__` return type with `Any`Bas van Beek2021-10-181-2/+2
| | | | | | | | | | | | Replace `object` as it cannot be used for expressing the objects in the array namespace.
* | | ENH: Change `SupportsDLPack` into a protocolBas van Beek2021-10-181-1/+3
| | |
* | | ENH: Replace `NestedSequence` with a proper nested sequence protocolBas van Beek2021-10-181-5/+17
|/ /
* | Disallow `k=None` for the `eye` functionBas van Beek2021-09-291-1/+1
| |
* | MAINT: Import `Array` from the `_array_object` namespaceBas van Beek2021-09-291-1/+1
| | | | | | | | Changed as `Array` does not live in the main `np.array_api` namespace
* | MAINT: Remove the `Sequence` encapsulation from variadic argumentsBas van Beek2021-09-272-3/+3
| |
* | MAINT: Add a missing subscription slot to `NestedSequence`Bas van Beek2021-09-271-2/+3
| |
* | MAINT: Fix invalid parameter types used in `Dtype`Bas van Beek2021-09-271-6/+21
| |
* | ENH: Updates to numpy.array_api (#19937)Aaron Meurer2021-09-258-21/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add __index__ to array_api and update __int__, __bool__, and __float__ The spec specifies that they should only work on arrays with corresponding dtypes. __index__ is new in the spec since the initial PR, and works identically to np.array.__index__. * Add the to_device method to the array_api This method is new since #18585. It does nothing in NumPy since NumPy does not support non-CPU devices. * Update transpose methods in the array_api transpose() was renamed to matrix_transpose() and now operates on stacks of matrices. A function to permute dimensions will be added once it is finalized in the spec. The attribute mT was added and the T attribute was updated to only operate on 2-dimensional arrays as per the spec. * Restrict input dtypes in the array API statistical functions * Add the dtype parameter to the array API sum() and prod() * Add the function permute_dims() to the array_api namespace permute_dims() is the replacement for transpose(), which was split into permute_dims() and matrix_transpose(). * Add tril and triu to the array API namespace * Fix the array_api Array.__repr__ to indent the array properly * Make the Device type in the array_api just accept the string "cpu"
* | fix unhashable instance and potential exception identified by LGTMSista Seetaram2021-09-031-1/+1
| |
* | fixed unhashable instance and potential exception as listed in LGTM#19077Sista Seetaram2021-09-031-1/+1
|/
* Remove an unused importAaron Meurer2021-08-231-2/+0
|
* Remove Python 3.7 checks from the array API codeAaron Meurer2021-08-231-5/+0
| | | | | NumPy has dropped Python 3.7, so these are no longer necessary (and they didn't completely work anyway).
* Add smallest_normal to the array API finfoAaron Meurer2021-08-121-6/+2
| | | | This was blocked on #18536, which has been merged.
* Fix the return annotation for numpy.array_api.Array.__setitem__Aaron Meurer2021-08-121-1/+1
|
* Run (selective) black on the array_api submoduleAaron Meurer2021-08-0618-390/+1054
| | | | | | I've omitted a few changes from black that messed up the readability of some complicated if statements that were organized logically line-by-line, and some changes that use unnecessary operator spacing.
* Update the docstring of numpy.array_apiAaron Meurer2021-08-061-38/+41
|
* Fix the array API nonzero() functionAaron Meurer2021-08-061-1/+1
|
* Make the axis argument to squeeze() in the array_api module positional-onlyAaron Meurer2021-08-061-1/+1
| | | | See data-apis/array-api#100.