Ejemplo n.º 1
0
 def _conj(result, arg):
     from pyopencl.elementwise import complex_dtype_to_name
     fname = "%s_conj" % complex_dtype_to_name(arg.dtype)
     return elementwise.get_unary_func_kernel(arg.context,
                                              fname,
                                              arg.dtype,
                                              out_dtype=result.dtype)
Ejemplo n.º 2
0
    def f(array, queue=None):
        result = array._new_like_me()

        knl = elementwise.get_unary_func_kernel(array.context, name, array.dtype)
        knl(queue or array.queue, array._global_size, array._local_size,
                array.data, result.data, array.mem_size)

        return result
Ejemplo n.º 3
0
    def knl_runner(result, arg):
        if arg.dtype.kind == "c":
            from pyopencl.elementwise import complex_dtype_to_name
            fname = "%s_%s" % (complex_dtype_to_name(arg.dtype), name)
        else:
            fname = name

        return elementwise.get_unary_func_kernel(
                result.context, fname, arg.dtype)
Ejemplo n.º 4
0
    def knl_runner(result, arg):
        if arg.dtype.kind == "c":
            from pyopencl.elementwise import complex_dtype_to_name
            fname = "%s_%s" % (complex_dtype_to_name(arg.dtype), name)
        else:
            fname = name

        return elementwise.get_unary_func_kernel(result.context, fname,
                                                 arg.dtype)
Ejemplo n.º 5
0
    def f(array, queue=None):
        result = array._new_like_me()

        knl = elementwise.get_unary_func_kernel(array.context, name,
                                                array.dtype)
        knl(queue or array.queue, array._global_size, array._local_size,
            array.data, result.data, array.mem_size)

        return result
Ejemplo n.º 6
0
    def _abs(result, arg):
        if arg.dtype.kind == "f":
            fname = "fabs"
        elif arg.dtype.kind in ["u", "i"]:
            fname = "abs"
        else:
            raise TypeError("unsupported dtype in _abs()")

        return elementwise.get_unary_func_kernel(
                arg.context, fname, arg.dtype)
Ejemplo n.º 7
0
    def _abs(result, arg):
        if arg.dtype.kind == "f":
            fname = "fabs"
        elif arg.dtype.kind in ["u", "i"]:
            fname = "abs"
        else:
            raise TypeError("unsupported dtype in _abs()")

        return elementwise.get_unary_func_kernel(
                arg.context, fname, arg.dtype)
Ejemplo n.º 8
0
    def _abs(result, arg):
        if arg.dtype.kind == "c":
            from pyopencl.elementwise import complex_dtype_to_name

            fname = "%s_abs" % complex_dtype_to_name(arg.dtype)
        elif arg.dtype.kind == "f":
            fname = "fabs"
        elif arg.dtype.kind in ["u", "i"]:
            fname = "abs"
        else:
            raise TypeError("unsupported dtype in _abs()")

        return elementwise.get_unary_func_kernel(arg.context, fname, arg.dtype, out_dtype=result.dtype)
Ejemplo n.º 9
0
    def _abs(result, arg):
        if arg.dtype.kind == "c":
            from pyopencl.elementwise import complex_dtype_to_name
            fname = "%s_abs" % complex_dtype_to_name(arg.dtype)
        elif arg.dtype.kind == "f":
            fname = "fabs"
        elif arg.dtype.kind in ["u", "i"]:
            fname = "abs"
        else:
            raise TypeError("unsupported dtype in _abs()")

        return elementwise.get_unary_func_kernel(
                arg.context, fname, arg.dtype, out_dtype=result.dtype)
Ejemplo n.º 10
0
 def _abs(result, arg):
     return elementwise.get_unary_func_kernel(
             arg.context, fname, arg.dtype)
Ejemplo n.º 11
0
 def knl_runner(result, arg):
     return elementwise.get_unary_func_kernel(result.context, name,
                                              arg.dtype)
Ejemplo n.º 12
0
    def _conj(result, arg):
        from pyopencl.elementwise import complex_dtype_to_name

        fname = "%s_conj" % complex_dtype_to_name(arg.dtype)
        return elementwise.get_unary_func_kernel(arg.context, fname, arg.dtype, out_dtype=result.dtype)
Ejemplo n.º 13
0
 def _abs(result, arg):
     return elementwise.get_unary_func_kernel(arg.context, fname, arg.dtype)
Ejemplo n.º 14
0
 def knl_runner(result, arg):
     return elementwise.get_unary_func_kernel(
             result.context, name, arg.dtype)