示例#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)
示例#2
0
文件: scimath.py 项目: daurer/afnumpy
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)