skcuda.misc.cumsum¶
-
skcuda.misc.
cumsum
(x_gpu)[source]¶ Cumulative sum.
Return the cumulative sum of the elements in the specified array.
Parameters: x_gpu (pycuda.gpuarray.GPUArray) – Input array. Returns: c_gpu – Output array containing cumulative sum of x_gpu. Return type: 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