FORCES
FORtran lib for Comp. Env. Sys.
|
Nth smallest value in array. More...
Public Member Functions | |
real(dp) function | n_element_dp (idat, n, mask, before, after, previous, next) |
real(sp) function | n_element_sp (idat, n, mask, before, after, previous, next) |
Nth smallest value in array.
Returns the n-th smallest value in an array.
If an optinal mask is given, values only on those locations that correspond to true values in the mask are used.
Example
See also example in test directory.
Literature
[in] | real(sp/dp) :: vec(:) | 1D-array with input numbers |
[in] | integer(i4), optional :: n | Index of sorted array |
[in] | logical, optional :: mask(:) | 1D-array of logical values with size(vec). If present, only those locations in vec corresponding to the true values in mask are used. |
[out] | real(sp/dp) :: before | (n-1)-th smallest value in input array, e.g. for median/percentile calculations |
[out] | real(sp/dp) :: previous | Same as before |
[out] | real(sp/dp) :: after | (n+1)-th smallest value in input array |
[out] | real(sp/dp) :: next | Same as after |
real(sp/dp) :: out | N-th smallest value in input array |
Definition at line 109 of file mo_percentile.f90.
real(dp) function mo_percentile::n_element::n_element_dp | ( | real(dp), dimension(:), intent(in) | idat, |
integer(i4), intent(in) | n, | ||
logical, dimension(:), intent(in), optional | mask, | ||
real(dp), intent(out), optional | before, | ||
real(dp), intent(out), optional | after, | ||
real(dp), intent(out), optional | previous, | ||
real(dp), intent(out), optional | next | ||
) |
Definition at line 308 of file mo_percentile.f90.
real(sp) function mo_percentile::n_element::n_element_sp | ( | real(sp), dimension(:), intent(in) | idat, |
integer(i4), intent(in) | n, | ||
logical, dimension(:), intent(in), optional | mask, | ||
real(sp), intent(out), optional | before, | ||
real(sp), intent(out), optional | after, | ||
real(sp), intent(out), optional | previous, | ||
real(sp), intent(out), optional | next | ||
) |
Definition at line 383 of file mo_percentile.f90.