Skip to content

Commit 9399fb7

Browse files
kaushikcfdinducer
authored andcommitted
Add logical_(and|not|or) to (BasePytato|PyOpenCL)ArrayContext
1 parent 66fd9ed commit 9399fb7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

arraycontext/impl/pyopencl/fake_numpy.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ def equal(self, x, y):
259259
def not_equal(self, x, y):
260260
return rec_multimap_array_container(operator.ne, x, y)
261261

262+
def logical_or(self, x, y):
263+
return rec_multimap_array_container(cl_array.logical_or, x, y)
264+
265+
def logical_and(self, x, y):
266+
return rec_multimap_array_container(cl_array.logical_and, x, y)
267+
268+
def logical_not(self, x):
269+
return rec_map_array_container(cl_array.logical_not, x)
270+
262271
# }}}
263272

264273
# {{{ mathematical functions

arraycontext/impl/pytato/fake_numpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ class PytatoFakeNumpyNamespace(LoopyBasedFakeNumpyNamespace):
5454
"sin", "cos", "tan", "arcsin", "arccos", "arctan",
5555
"sinh", "cosh", "tanh", "exp", "log", "log10",
5656
"sqrt", "abs", "isnan", "real", "imag", "conj",
57+
"logical_not",
5758
})
5859

5960
_pt_multi_ary_funcs = frozenset({
6061
"arctan2", "equal", "greater", "greater_equal", "less", "less_equal",
61-
"not_equal", "minimum", "maximum", "where",
62+
"not_equal", "minimum", "maximum", "where", "logical_and", "logical_or",
6263
})
6364

6465
def _get_fake_numpy_linalg_namespace(self):

0 commit comments

Comments
 (0)