- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑
Description:
This routine derives the
unweighte ‘fast’ median of an array. The method used is based on Wirth’ s algorithm for selecting the
th
value, which is very fast compared with a full sort. If there is an even number of elements, the median
is computed from the mean of the two elements that straddle the median.
Invocation
CALL
KPG1_FMEDx( BAD, EL, ARRAY, POINT, MEDIAN, NGOOD, STATUS )
Arguments
BAD = LOGICAL
(Given)
If BAD is .TRUE. there may be bad pixels present in the vector and so should be tested. If
BAD is .FALSE. there is no testing for bad values.
EL = INTEGER (Given)
The number of elements
within the array to sort.
ARRAY( EL ) = ? (Given and Returned)
The array whose median is to be
found. On exit the array is partially sorted.
POINT( EL ) = INTEGER (Returned)
Workspace to
hold pointers to the original positions of the data before extraction and conversion into
the ARRAY array.
MEDIAN = ? (Returned)
The fast median of the array.
NGOOD
= INTEGER (Returned)
The number of elements actually used after bad values have
been excluded.
STATUS = INTEGER (Given and Returned)
The global status.
Notes:
-
There is a routine for each numeric data type: replace "
x"
in the routine name by D, R, I, W, UW, B or
UB as appropriate. The array and MEDIAN arguments supplied to the routine must have the data
type specified.
- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑