c++,lapack,blas,absolute-value,argmax

BLAS was designed to provide low-level routines necessary to implement common linear-algebra operations (it is the "Basic Linear Algebra Subprograms", after all). To name just one of many uses, getting the largest-magnitude element of a vector is necessary for pivot selection in LU factorization, which is one of the most...

java,java-8,java-stream,argmax

Use String longestName = names.stream().max(Comparator.comparing(String::length)).get(); to compare elements on some property (can be more complex than that, but doesn't have to). As Brian suggests in the comments, using Optional#get() like this is unsafe if there's a possibility that the Stream is empty. You'd be better suited to use one of...

python,numpy,vectorization,argmax

You could do something like this - # Reshape input array to a 2D array with rows being kept as with original array. # Then, get idnices of max values along the columns. max_idx = A.reshape(A.shape[0],-1).argmax(1) # Get unravel indices corresponding to original shape of A maxpos_vect = np.column_stack(np.unravel_index(max_idx, A[0,:,:].shape))...

numpy,multidimensional-array,indexing,argmax

This here works for me where Mat is the big matrix. # flatten the 3 and 4 dimensions of Mat and obtain the 1d index for the maximum # for each p1 and p2 index1d = np.argmax(Mat.reshape(Mat.shape[0],Mat.shape[1],-1),axis=2) # compute the indices of the 3 and 4 dimensionality for all p1...