MG Library

Library of Michael Galloy

single page | use frames     summary     class     fields     routine details     file attributes

sorting/

mg_n_smallest.pro

topmg_n_smallest

result = mg_n_smallest(data, n [, /largest])

Finds the n smallest elements of a data array. This algorithm works fastest on uniformly distributed data. The worst case for it is a single smallest data element and all other elements with another value. This will be nearly equivalent to just sorting all the elements and choosing the first n elements.

Return value

index array

Parameters

data in required type=numeric array

data array of any numeric type (except complex/dcomplex)

n in required type=integer

number of smallest elements to find

Keywords

largest in optional type=boolean

set to find n largest elements

File attributes

Modification date: Tue Nov 20 11:24:27 2007
Lines: 55