[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistency: "sort" on UNIX <-> Windows



here is another sort method from our library too.

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_html/dbase/download/n_sort.tar.gz

; NAME:
;   n_sort
;
; PURPOSE:
;   sort an array according to n columns 
;
; CATEGORY:
;   MATH
;
; CALLING SEQUENCE:
;   result=n_sort(matrix)
;
; INPUTS:
;   matrix : the input matrix, which shoul be sorted
;
; KEYWORD PARAMETERS:
;   INDEX:  a vector of column numbers (default: indgen(number of
columns))
;           it defines the order of the columns, how the matrix will be
sorted
;
;   DECREASING_ORDER: the matrix will be sorted decreasingly
;
; OUTPUTS:
;   j_index: the vector of sorted line numbers
;
; EXAMPLE:
;     matrix = [[ 2, 3, 4 ], $
;               [ 1, 4, 6 ], $
;               [ 1, 4, 5 ]]
;     j_index=n_sort(matrix)
;     j_index=[2,1,0]
;
;     matrix = [[ 1, 4, 5 ], $
;               [ 1, 4, 6 ], $
;               [ 2, 3, 4 ]]
;     j_index=n_sort(matrix,index=[1,0,2])
;     j_index=[2,0,1]

Reimar Bauer