Beispiel #1
0
def sqrt(x):
    if isinstance(x, afnumpy.ndarray):
        s = arrayfire.sqrt(x.d_array)
        return afnumpy.ndarray(x.shape, dtype=pu.typemap(s.dtype()), af_array=s)
    else:
        return numpy.sqrt(x)
Beispiel #2
0
def arctan2(x1, x2):
    if isinstance(x1, afnumpy.ndarray) and isinstance(x2, afnumpy.ndarray):
        s = arrayfire.atan2(x1.d_array, x2.d_array)
        return afnumpy.ndarray(x1.shape, dtype=pu.typemap(s.dtype()), af_array=s)
    else:
        return numpy.arctan(x1, x2)