The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



SortArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function SortArray (Ascending: boolean; var Data: TDoubleArray; var Index: TIntArray): integer;
[2] function SortArray (Ascending: boolean; var Data: TIntArray; var Index: TIntArray): integer;

The method SortArray sorts the values of the array Data in an order which depends on parameter Ascending. The integer array Index returns the new sort order (assuming that the initial values are numbered from 1 to length(Data)) and is automatically resized to match the Data array.

SortArray increments the global variable ProcStat and calls the feedback routine MathFeedBackProc in order to allow feedback to the user during time consuming sorting. The SortArray function can be terminated by setting the global variable AbortMathProc to TRUE.

The function returns the following error codes:

 0 ... everything OK
-1 ... the size of the Data array is less than 2
-2 ... sorting process abborted by the user



Last Update: 2024-Jan-14