Modern IDL by Michael Galloy

API documentation for example code

Directory: performance/

Examples of optimizing IDL code.

Contents

.pro files

mg_convert_type.pro

Given two type codes, return a type code of a variable that can contain the precision of both type codes.

mg_n_smallest.pro

Finds the n smallest elements of a data array.

mg_sample.pro

Get nIndices random indices for an array of size nValues (without repeating an index).

mg_where_vs_histogram.pro

This shows the IDL help is wrong when it says: For example, make the histogram of array A: H = HISTOGRAM(A, REVERSE_INDICES = R) ;Set all elements of A that are in the ith bin of H to 0. IF R[i] NE R[i+1] THEN A[R[R[I] : R[i+1]-1]] = 0 The above is usually more efficient than the following: bini = WHERE(A EQ i, count) IF count NE 0 THEN A[bini] = 0

mgcoabstractiterator__define.pro

Define member variables.

mgcoabstractlist__define.pro

Abstract class to define a list interface.

mgcoarraylist__define.pro

An MGcoArrayList implements the same interface as IDL_Container, but can contain any IDL type.

mgcoarraylistiterator__define.pro

This class provides a nice way to iterate through all the elements of an array list.

performance_chapter.pro

Batch file containing all the code intended to be typed at the command line from the "Performance" chapter.

performance_solutions.pro