As I understand that cublasIsamax() can find the first index of max abs value of the element in a matrix A.
The question is if the element is not a float value, but a 3-element array, say, [a1, a2, a3]. Without any prepossessing, how can I use cublasIsamax() to find the index of the element of matrix A with max value of
v=sqrt(a1a1+a2a2+a3a3)? Sure I can build another matrix with the value of each element to be v=sqrt(a1a1+a2a2+a3a3), and use cublasIsamax() to find the index. Also, how to find the index of max value, not abs(value) of element of a matrix?
For the first question, it we can pass a function pointer to cublasIsamax() to define how to calculate the value of the element for comparison, that will accomplish the purpose?
Following this idea, if the element of a matrix A is a pair of hash value and index/address pointer like this
[hashvalue, index] or [hashvalue, addressptr],
And all CUBLAS functions can process the matrix with only regarding to element’s hashvalue (Say implemented in the function and passed pointer to CUBLAS function). Thus, since the returned value/matrix has addressptr with them, we can apply sorting, finding index of max, min, etc., to any array of objects, instead of only float variable as long as we build a matrix with [hash, addressptr] as the matrix element. This will greatly expands the power of CUBLAS.