Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

How to use the function maxloc to find all the max locations

cepheid
Beginner
477 Views

For example we have the matrix

! A is the array  |  4  9  8 -8|
! | 2 1 -1 5|
! | 9 4 -1 9|
! | -7 5 7 -3|

when we use maxloc(A), we get 3,1
but there has the other places that the value is 9

so how could we find the all the max value locations?
0 Kudos
1 Reply
TimP
Honored Contributor III
477 Views
Repeat maxloc on the section of the array past the first result. If another equal value found and not last element, repeat.
0 Kudos
Reply