Skip to content
Snippets Groups Projects
Unverified Commit f8f10260 authored by Andreas Klöckner's avatar Andreas Klöckner Committed by GitHub
Browse files

Merge pull request #15 from illinois-ceesd/three-arg-where

Add test and implementation for three-argument-where
parents ef93c5a3 7fb865e3
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,11 @@ class _PyOpenCLFakeNumpyNamespace(_BaseFakeNumpyNamespace):
return super().__getattr__(name)
@obj_array_vectorized_n_args
def where(self, criterion, then, else_):
import pyopencl.array as cl_array
return cl_array.if_positive(criterion != 0, then, else_)
class PyOpenCLArrayContext(ArrayContext):
"""
......
numpy
git+https://gitlab.tiker.net/inducer/pytools.git
git+https://gitlab.tiker.net/inducer/gmsh_interop.git
git+https://gitlab.tiker.net/inducer/modepy.git
git+https://gitlab.tiker.net/inducer/pyopencl.git
git+https://gitlab.tiker.net/inducer/islpy.git
git+https://gitlab.tiker.net/inducer/pytools.git#egg=pytools
git+https://gitlab.tiker.net/inducer/gmsh_interop.git#egg=gmsh_interop
git+https://gitlab.tiker.net/inducer/modepy.git#egg=modepy
git+https://gitlab.tiker.net/inducer/pyopencl.git#egg=pyopencl
git+https://gitlab.tiker.net/inducer/islpy.git#egg=islpy
# required by pytential, which is in turn needed for some tests
git+https://gitlab.tiker.net/inducer/pymbolic.git
git+https://gitlab.tiker.net/inducer/pymbolic.git#egg=pymbolic
# also depends on pymbolic, so should come after it
git+https://gitlab.tiker.net/inducer/loopy.git
git+https://gitlab.tiker.net/inducer/loopy.git#egg=loo.py
# more pytential dependencies
git+https://github.com/inducer/boxtree.git
git+https://github.com/inducer/sumpy.git
git+https://github.com/inducer/pytential.git
git+https://github.com/inducer/boxtree.git#egg=boxtree
git+https://github.com/inducer/sumpy.git#egg=sumpy
git+https://github.com/inducer/pytential.git#pytential
# requires pymetis for tests for partition_mesh
git+https://gitlab.tiker.net/inducer/pymetis.git
git+https://gitlab.tiker.net/inducer/pymetis.git#egg=pymetis
......@@ -1467,6 +1467,7 @@ def test_array_context_np_workalike(ctx_factory):
("arctan2", 2),
("minimum", 2),
("maximum", 2),
("where", 3),
]:
args = [np.random.randn(discr.ndofs) for i in range(n_args)]
ref_result = getattr(np, sym_name)(*args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment