Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

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

cepheid
Beginner
479 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
479 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