The GA Procedure

ShellSort Call

sorts a numeric array

call ShellSort( x, <, by<, descend> > );

The inputs to the ShellSort subroutine are as follows:

x        is a one or two dimensional array to be sorted.
byis an optional numeric scalar or array that specifies the columns by which the array is to be sorted. If not specified, column 1 is the default.
descendis an optional numeric scalar or array used to specify which columns in the by parameter are to be in descending order. Any columns not specified in a descend parameter will be in ascending order.

The ShellSort subroutine sorts the x array by the columns specified in the by parameter, with the first column having highest precedence, and subsequent columns applied within the preceding by groups. Sorting will be done in ascending order for each column unless that column is also specified in the descend parameter. In general the ShellSort routine does not preserve the original order in case of ties.

For example, the following statements sort an array x into ascending order with respect to the first column, and sort groups with the same first column value by descending order of third column values:

  
    array x[100, 3] /nosym; 
  
    ... 
  
    array by[2] /nosym; 
    by[1] = 1; 
    by[2] = 3; 
    descend = 3; 
    call ShellSort(x, by, descend);
 

Previous Page | Next Page | Top of Page