Cumulative sum.
Return the cumulative sum of the elements in the specified array.
Parameters: | x_gpu : pycuda.gpuarray.GPUArray
|
---|---|
Returns: | c_gpu : pycuda.gpuarray.GPUArray
|
Notes
Higher dimensional arrays are implicitly flattened row-wise by this function.
Examples
>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import misc
>>> x_gpu = gpuarray.to_gpu(np.random.rand(5).astype(np.float32))
>>> c_gpu = misc.cumsum(x_gpu)
>>> np.allclose(c_gpu.get(), np.cumsum(x_gpu.get()))
True