0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_percentile::median Interface Reference

Median. More...

Public Member Functions

real(sp) function median_sp (arrin, mask)
 
real(dp) function median_dp (arrin, mask)
 

Detailed Description

Median.

Returns the median of the values in an array. If size is even, then the mean of the size/2 and size/2+1 element is the median.

If an optinal mask is given, values only on those locations that correspond to true values in the mask are used.

Example

vec = (/ 1.,2.,3.,4.,5.,6.,7.,8.,9.,10. /)
! Returns 5.5
out = median(vec)

See also example in test directory.

Parameters
[in]real(sp/dp) :: vec(:)1D-array with input numbers
[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.
Return values
real(sp/dp) :: outMedian of values in input array
Author
Matthias Cuntz
Date
Mar 2011
Author
Juliane Mai
Date
Jul 2012
  • uses previous of ksmallest to half execution time

Definition at line 64 of file mo_percentile.f90.

Member Function/Subroutine Documentation

◆ median_dp()

real(dp) function mo_percentile::median::median_dp ( real(dp), dimension(:), intent(in)  arrin,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 223 of file mo_percentile.f90.

◆ median_sp()

real(sp) function mo_percentile::median::median_sp ( real(sp), dimension(:), intent(in)  arrin,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 265 of file mo_percentile.f90.


The documentation for this interface was generated from the following file: