|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....|
|Home MathPack Matrix Classes TIntMatrix, TMatrix and TMat3D Methods SortRows|
|See also: SortCols, OnSortExchange, TSortExchgEvent|
The method SortRows provides a means to sort the rows of a matrix, or part of it, according to the values in a single column. This column is indexed by the parameter SortColIx. The matrix is sorted row by row within the range [LowCol,LowRow] to [HighCol,HighRow]. The values outside this range are not affected (except for the column addressed by SortColIx ). The sorting order is determined by the column SortColIdx which is also sorted within the range [LowRow, HighRow ]. The parameter Ascending specifies whether the valus are to be sorted in ascending (TRUE) or descending (FALSE) order.
The event OnSortExchange is generated whenever two rows have to be exchanged during the sorting process. The sorting is performed by a modified bubble sort (CombSort), which has been reported to be comparable in speed to QuickSort (see also R.Box, S. Lacey, BYTE magazine, April 1991).