diff --git a/arraycontext/fake_numpy.py b/arraycontext/fake_numpy.py index 251a5a27f5e9875455feb2c669404b2d71348b10..c75295c1b582527c57655b7ec278ce1a2110fbce 100644 --- a/arraycontext/fake_numpy.py +++ b/arraycontext/fake_numpy.py @@ -170,7 +170,8 @@ class BaseFakeNumpyNamespace: c_name = self._numpy_to_c_arc_functions.get(name, name) # limit which functions we try to hand off to loopy - if name in self._numpy_math_functions: + if (name in self._numpy_math_functions + or name in self._c_to_numpy_arc_functions): return multimapped_over_array_containers(loopy_implemented_elwise_func) else: raise AttributeError(name) diff --git a/test/test_arraycontext.py b/test/test_arraycontext.py index 39e49b22a42402788959273793a4a2c322fc9496..75a91cb5d235bacdeaae7042edc7639c59997f86 100644 --- a/test/test_arraycontext.py +++ b/test/test_arraycontext.py @@ -308,8 +308,24 @@ def test_array_context_np_workalike(actx_factory, sym_name, n_args, dtype): ndofs = 512 args = [randn(ndofs, dtype) for i in range(n_args)] - assert_close_to_numpy_in_containers( - actx, lambda _np, *_args: getattr(_np, sym_name)(*_args), args) + c_to_numpy_arc_functions = { + "atan": "arctan", + "atan2": "arctan2", + } + + def evaluate(_np, *_args): + func = getattr(_np, sym_name, + getattr(_np, c_to_numpy_arc_functions.get(sym_name, sym_name))) + + return func(*_args) + + assert_close_to_numpy_in_containers(actx, evaluate, args) + + if sym_name in ["where", "min", "max", "any", "all", "conj", "vdot", "sum"]: + pytest.skip(f"'{sym_name}' not supported on scalars") + + args = [randn(0, dtype)[()] for i in range(n_args)] + assert_close_to_numpy(actx, evaluate, args) @pytest.mark.parametrize(("sym_name", "n_args", "dtype"), [