Modern IDL by Michael Galloy

API documentation for example code

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

performance/

mg_n_smallest.pro


Routines

top source mg_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 Sep 22 15:26:35 2009
Lines: 30
Docformat: rst rst