Skip to content

Commit e272020

Browse files
committed
Add some basic aliases, and some basic documentation
1 parent a321654 commit e272020

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

numpy_array_api_compat/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1+
"""
2+
NumPy Array API compatibility library
3+
4+
This is a small wrapper around NumPy that is compatible with the Array API
5+
standard https://data-apis.org/array-api/latest/. See also NEP 47
6+
https://numpy.org/neps/nep-0047-array-api-standard.html.
7+
8+
Unlike numpy.array_api, this is not a strict minimal implementation of the
9+
Array API, but rather just an extension of the main NumPy namespace with
10+
changes needed to be compliant with the Array API. See
11+
https://numpy.org/doc/stable/reference/array_api.html for a full list of
12+
changes. In particular, unlike numpy.array_api, this package does not use a
13+
separate Array object, but rather just uses numpy.ndarray directly.
14+
15+
Library authors using the Array API may wish to test against numpy.array_api
16+
to ensure they are not using functionality outside of the standard, but prefer
17+
this implementation for the default when working with NumPy arrays.
18+
19+
"""
20+
121
from numpy import *
22+
23+
# These imports may overwrite names from the import * above.
24+
from ._aliases import *

numpy_array_api_compat/_aliases.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
These are functions that are just aliases of existing functions in NumPy.
3+
"""
4+
5+
from numpy import (arccos, arccosh, arcsin, arcsinh, arctan, arctan2, arctanh,
6+
left_shift, invert, right_shift, bool_, concatenate, power)
7+
8+
acos = arccos
9+
acosh = arccosh
10+
asin = arcsin
11+
asinh = arcsinh
12+
atan = arctan
13+
atan2 = arctan2
14+
atanh = arctanh
15+
bitwise_left_shift = left_shift
16+
bitwise_invert = invert
17+
bitwise_right_shift = right_shift
18+
bool = bool_
19+
concat = concatenate
20+
pow = power

0 commit comments

Comments
 (0)