From 4935713c7fad540e1c461297e9e9de60194533c4 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Sat, 6 Nov 2021 20:02:19 -0500 Subject: [PATCH] fix scalars case in loopy_implemented_elwise_func --- arraycontext/fake_numpy.py | 6 ++++-- test/test_arraycontext.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arraycontext/fake_numpy.py b/arraycontext/fake_numpy.py index 916d79d..251a5a2 100644 --- a/arraycontext/fake_numpy.py +++ b/arraycontext/fake_numpy.py @@ -148,7 +148,9 @@ class BaseFakeNumpyNamespace: def __getattr__(self, name): def loopy_implemented_elwise_func(*args): if all(np.isscalar(ary) for ary in args): - return getattr(np, name)(*args) + return getattr( + np, self._c_to_numpy_arc_functions.get(name, name) + )(*args) actx = self._array_context prg = _get_scalar_func_loopy_program(actx, @@ -160,7 +162,7 @@ class BaseFakeNumpyNamespace: if name in self._c_to_numpy_arc_functions: from warnings import warn warn(f"'{name}' in ArrayContext.np is deprecated. " - "Use '{c_to_numpy_arc_functions[name]}' as in numpy. " + f"Use '{self._c_to_numpy_arc_functions[name]}' as in numpy. " "The old name will stop working in 2021.", DeprecationWarning, stacklevel=3) diff --git a/test/test_arraycontext.py b/test/test_arraycontext.py index d97f00f..39e49b2 100644 --- a/test/test_arraycontext.py +++ b/test/test_arraycontext.py @@ -283,6 +283,8 @@ def assert_close_to_numpy_in_containers(actx, op, args): ("max", 1, np.float64), ("any", 1, np.float64), ("all", 1, np.float64), + ("arctan", 1, np.float64), + ("atan", 1, np.float64), # float + complex ("sin", 1, np.float64), -- GitLab