skcuda.cublas.cublasIsamin¶
-
skcuda.cublas.
cublasIsamin
(handle, n, x, incx)[source]¶ Index of minimum magnitude element (single precision real).
Finds the smallest index of the minimum magnitude element of a single precision real vector.
Note: for complex arguments x, the “magnitude” is defined as abs(x.real) + abs(x.imag), not as abs(x).
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vector.
- x (ctypes.c_void_p) – Pointer to single precision real input vector.
- incx (int) – Storage spacing between elements of x.
Returns: idx – Index of minimum magnitude element.
Return type: Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> x = np.random.rand(5).astype(np.float32) >>> x_gpu = gpuarray.to_gpu(x) >>> h = cublasCreate() >>> m = cublasIsamin(h, x_gpu.size, x_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(m, np.argmin(abs(x.real) + abs(x.imag))) True
Notes
This function returns a 0-based index.
References