Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  Libraries  >  ASTROLIB  >  BSORT

BSORT

BSORT

Name


      BSORT

Purpose


      Function to sort data into ascending order, like a simple bubble sort.

Explanation


      Original subscript order is maintained when values are equal (stable sort).
      (This differs from the IDL SORT routine alone, which may rearrange
      order for equal values)
      A faster algorithm (radix sort) for numeric data is described at
      http://idldatapoint.com/2012/04/19/an-lsd-radix-sort-algorithm-in-idl/
      and available at
      https://github.com/mgalloy/mglib/blob/master/src/analysis/mg_sort.pro

Calling Sequence


      result = bsort( array, [ asort, /INFO, /REVERSE ] )

Input


      Array - array to be sorted

Output


      result - sort subscripts are returned as function value

Optional Output


      Asort - sorted array

Optional Keyword Inputs


      /REVERSE - if this keyword is set, and non-zero, then data is sorted
                in descending order instead of ascending order.
      /INFO = optional keyword to cause brief message about # equal values.

History


      written by F. Varosi Oct.90:
      uses WHERE to find equal clumps, instead of looping with IF ( EQ ).
      compatible with string arrays, test for degenerate array
      20-MAY-1991 JKF/ACC via T AKE- return indexes if the array to
                      be sorted has all equal values.
      Aug - 91 Added REVERSE keyword W. Landsman
      Always return type LONG W. Landsman August 1994
      Converted to IDL V5.0 W. Landsman September 1997



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us