Sum of absolute values of double-precision complex vector.
Computes the sum of the absolute values of the elements of a double-precision complex vector.
Note: if the vector is complex, then this computes the sum sum(abs(x.real)) + sum(abs(x.imag))
Parameters: | handle : int
n : int
x : ctypes.c_void_p
incx : int
|
---|---|
Returns: | s : numpy.float64
|
Examples
>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import numpy as np
>>> x = (np.random.rand(5)+1j*np.random.rand(5)).astype(np.complex128)
>>> x_gpu = gpuarray.to_gpu(x)
>>> h = cublasCreate()
>>> s = cublasDzasum(h, x_gpu.size, x_gpu.gpudata, 1)
>>> cublasDestroy(h)
>>> np.allclose(s, abs(x.real).sum() + abs(x.imag).sum())
True