skcuda.cublas.cublasIcamax¶
-
skcuda.cublas.
cublasIcamax
(handle, n, x, incx)[source]¶ Index of maximum magnitude element.
Finds the smallest index of the maximum magnitude element of a single precision complex 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 complex input vector.
- incx (int) – Storage spacing between elements of x.
Returns: idx – Index of maximum magnitude element.
Return type: 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.complex64) >>> x_gpu = gpuarray.to_gpu(x) >>> h = cublasCreate() >>> m = cublasIcamax(h, x_gpu.size, x_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(m, np.argmax(abs(x.real) + abs(x.imag))) True
Notes
This function returns a 0-based index.
References