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

is there anything faster than maxloc for a sort vector

rodrigo_acj
Beginner
1,013 Views
I have to find the greater number in a sorted vector (descending) with a condition (e.g. .LT. ), is there anything faster than maxloc to do it? Equivalently, i'd like to find the first element in a vector thatcomply acondition, e.g. x.EQ.5
0 Kudos
2 Replies
JVanB
Valued Contributor II
1,013 Views
Given that the vector is already sorted, a binary search ought to converge to the appropriate index rapidly.
0 Kudos
rodrigo_acj
Beginner
1,013 Views
thnx, i'll prove it
0 Kudos
Reply