Open
Description
Often when I sort data, what I really want are the N largest values. I think a function
function maxloc_n(x,n) result(imax)
real, intent(in) :: x(:)
integer, intent(in) :: n
integer :: imax(n) ! positions of n largest values of x(:)
end function maxloc_n
would be widely used if implemented.