Skip to content

Locations of N largest values in a 1D array #378

Open
@Beliavsky

Description

@Beliavsky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: algorithmssearching and sorting, merging, ...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions