I'm searching for a way to find the index corresponding to the maximum of each column. My goal is to avoid loops and find a Matlabic solution using vectorized armadillo functions.
This can easily be done in Matlab with the following command : [~, maxIndices] = max(A);
In armadillo you have the member function : A.max( row_of_max_val, col_of_max_val); that give the location of the maximum in the whole matrix.
And the standalone function vec M = max(A); that outputs the maximum values of each column but not their indices.
But none of them is doing the trick.
Having columns maximum's indices could be used to write numerous algorithms in a more vectorized way. For example, it could be used in a Viterbi Decoding, or in a k-means clustering.
Obviously, this question can be generalized considering minimums instead of maximums and rows instead of columns.
Is someone thinking of an alternative solution ?
Best.