Vector addition (double-precision real).
Computes the sum of a double-precision real vector scaled by a double-precision real scalar and another double-precision real vector.
Parameters: | handle : int
n : int
alpha : numpy.float64
x : ctypes.c_void_p
incx : int
y : ctypes.c_void_p
incy : int
|
---|
Notes
Both x and y must contain n elements.
Examples
>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import numpy as np
>>> alpha = np.float64(np.random.rand())
>>> x = np.random.rand(5).astype(np.float64)
>>> y = np.random.rand(5).astype(np.float64)
>>> x_gpu = gpuarray.to_gpu(x)
>>> y_gpu = gpuarray.to_gpu(y)
>>> h = cublasCreate()
>>> cublasDaxpy(h, x_gpu.size, alpha, x_gpu.gpudata, 1, y_gpu.gpudata, 1)
>>> cublasDestroy(h)
>>> np.allclose(y_gpu.get(), alpha*x+y)
True