Calculates the median value. This function does not work with quadruple precision numbers because of the ordering subroutine written in C++.
y = median(x)
Where:
x = vector of rank 1 with real numbers.
See this example to use an array of
rank larger than 1.y = real number of the same kind as x with the median of x.The following program calculates the median of a vector:
PROGRAM medianExample
USE FU_Statistics, ONLY: median
IMPLICIT NONE
REAL, DIMENSION(5) :: x = [1., 2., 3., 4., 5.]
WRITE(*,*) median(x)
END PROGRAM medianExample
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=sp), | intent(in), | DIMENSION(:) | :: | x |
Vector of real numbers to calculate the median. It can have any size and it must have one dimension. |
Real number with the median
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | DIMENSION(:) | :: | x |
Vector of real numbers to calculate the median. It can have any size and it must have one dimension. |
Real number with the median