next up previous 278
Next: CCG_MD1x - Combines data lines using a weighted median
Up: Routine Descriptions
Previous: CCG_IWD3x - Combines data lines using the dispersion of the intensity-weighted co-ordinate


CCG_KTHx - Returns the Kth smallest value in an array

Description:
This routine returns the value of the Kth smallest element in the given array. It is an implementation of an algorithm of Niklaus Wirth from the book "Algorithms $+$ data structures = programs".

Invocation:
CALL CCG_KTHx( EL, K, ARRAY, ANCDAT, VALUE, STATUS )

Arguments:

EL = INTEGER (Given)
The number of elements in the input array.
K = INTEGER (Given and Returned)
On entry the ordered value to be returned, on exit index of ARRAY that contain the Kth smallest value.
ARRAY( EL ) = ? (Given and Returned)
The array of values to be processed. Note this is modified on exit.
ANCDAT( EL ) = INTEGER (Given and Returned)
Array of data whose association with ARRAY is to be preserved (such as a list of pointers to the original positions within ARRAY).
VALUE = ? (Returned)
The Kth smallest value in the input array.
STATUS = INTEGER (Given)
The global status.



next up previous 278
Next: CCG_MD1x - Combines data lines using a weighted median
Up: Routine Descriptions
Previous: CCG_IWD3x - Combines data lines using the dispersion of the intensity-weighted co-ordinate

KAPLIBS -- Internal subroutines used within the KAPPA package.
Starlink User Note 238
D.S. Berry
Malcolm J. Currie
2011 April 12
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council