summaryrefslogtreecommitdiff
path: root/numpy/_array_api
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-01-11 16:43:51 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-01-11 17:03:23 -0700
commite00760ccbfdbefea1625f5407e94397f2c85e848 (patch)
treedc70e101c64ac1a9d278107b2dd6d37efcf3aa7f /numpy/_array_api
parent9934cf3abcd6ba9438c340042e94f8343e3f3d13 (diff)
downloadnumpy-e00760ccbfdbefea1625f5407e94397f2c85e848.tar.gz
Fix array API functions that are named differently or not in the default numpy namespace
Diffstat (limited to 'numpy/_array_api')
-rw-r--r--numpy/_array_api/elementwise_functions.py40
-rw-r--r--numpy/_array_api/linear_algebra_functions.py9
-rw-r--r--numpy/_array_api/manipulation_functions.py5
3 files changed, 33 insertions, 21 deletions
diff --git a/numpy/_array_api/elementwise_functions.py b/numpy/_array_api/elementwise_functions.py
index 3e8349d29..db7ce0a0e 100644
--- a/numpy/_array_api/elementwise_functions.py
+++ b/numpy/_array_api/elementwise_functions.py
@@ -3,36 +3,43 @@ def abs(x, /):
return abs(x)
def acos(x, /):
- from .. import acos
- return acos(x)
+ # Note: the function name is different here
+ from .. import arccos
+ return arccos(x)
def acosh(x, /):
- from .. import acosh
- return acosh(x)
+ # Note: the function name is different here
+ from .. import arccosh
+ return arccosh(x)
def add(x1, x2, /):
from .. import add
return add(x1, x2)
def asin(x, /):
- from .. import asin
- return asin(x)
+ # Note: the function name is different here
+ from .. import arcsin
+ return arcsin(x)
def asinh(x, /):
- from .. import asinh
- return asinh(x)
+ # Note: the function name is different here
+ from .. import arcsinh
+ return arcsinh(x)
def atan(x, /):
- from .. import atan
- return atan(x)
+ # Note: the function name is different here
+ from .. import arctan
+ return arctan(x)
def atan2(x1, x2, /):
- from .. import atan2
- return atan2(x1, x2)
+ # Note: the function name is different here
+ from .. import arctan2
+ return arctan2(x1, x2)
def atanh(x, /):
- from .. import atanh
- return atanh(x)
+ # Note: the function name is different here
+ from .. import arctanh
+ return arctanh(x)
def bitwise_and(x1, x2, /):
from .. import bitwise_and
@@ -171,8 +178,9 @@ def positive(x, /):
return positive(x)
def pow(x1, x2, /):
- from .. import pow
- return pow(x1, x2)
+ # Note: the function name is different here
+ from .. import power
+ return power(x1, x2)
def remainder(x1, x2, /):
from .. import remainder
diff --git a/numpy/_array_api/linear_algebra_functions.py b/numpy/_array_api/linear_algebra_functions.py
index 5da7ac17b..9995e6b98 100644
--- a/numpy/_array_api/linear_algebra_functions.py
+++ b/numpy/_array_api/linear_algebra_functions.py
@@ -7,7 +7,8 @@ def cross(x1, x2, /, *, axis=-1):
return cross(x1, x2, axis=axis)
def det(x, /):
- from .. import det
+ # Note: this function is being imported from a nondefault namespace
+ from ..linalg import det
return det(x)
def diagonal(x, /, *, axis1=0, axis2=1, offset=0):
@@ -31,7 +32,8 @@ def diagonal(x, /, *, axis1=0, axis2=1, offset=0):
# return einsum()
def inv(x):
- from .. import inv
+ # Note: this function is being imported from a nondefault namespace
+ from ..linalg import inv
return inv(x)
# def lstsq():
@@ -51,7 +53,8 @@ def inv(x):
# return matrix_rank()
def norm(x, /, *, axis=None, keepdims=False, ord=None):
- from .. import norm
+ # Note: this function is being imported from a nondefault namespace
+ from ..linalg import norm
return norm(x, axis=axis, keepdims=keepdims, ord=ord)
def outer(x1, x2, /):
diff --git a/numpy/_array_api/manipulation_functions.py b/numpy/_array_api/manipulation_functions.py
index 1934e8e4e..80ca3381e 100644
--- a/numpy/_array_api/manipulation_functions.py
+++ b/numpy/_array_api/manipulation_functions.py
@@ -1,6 +1,7 @@
def concat(arrays, /, *, axis=0):
- from .. import concat
- return concat(arrays, axis=axis)
+ # Note: the function name is different here
+ from .. import concatenate
+ return concatenate(arrays, axis=axis)
def expand_dims(x, axis, /):
from .. import expand_dims