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

*Subject*: Re: Inconsistency: "sort" on UNIX <-> Windows*From*: "Liam E.Gumley" <Liam.Gumley(at)ssec.wisc.edu>*Date*: Fri, 07 Jul 2000 14:50:54 -0500*Newsgroups*: comp.lang.idl-pvwave*Organization*: Space Science and Engineering Center, UW-Madison*References*: <39662166.2C5F691E@stanford.edu>*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:20147

Daniel Luebbert wrote: > I've been using the "sort" routine to sort an 2D-array by increasing > values of its first column. > The "sort" routine seems to behave differently in the UNIX and the > Windows versions of IDL5.3. > > Here is a little test routine I wrote: > > ;************************** > pro test_sort > data = [[1,3], $ > [2,5], $ > [1,4], $ > [4,7], $ > [1,2] $ > ] > > print,"original: " > print,data > print,"sorted: " > print,data[*,sort(data[0,*])] > end > ;************************** > > The result on UNIX (Linux) is what I would expect: > > ;************************** > original: > > 1 3 > > 2 5 > > 1 4 > > 4 7 > > 1 2 > > sorted: > > 1 3 > > 1 4 > > 1 2 > > 2 5 > > 4 7 > > ;************************** > > BUT: The result on Windows is different: > > ;************************** > original: > 1 3 > 2 5 > 1 4 > 4 7 > 1 2 > sorted: > 1 2 > 1 4 > 1 3 > 2 5 > 4 7 > ;************************** > > In other words: The "sort" routine on Windows doesn't preserve the > original order of entries which have the same value (see the 3 > "1"-values in my test data), but apparently rearranges them in a random > way. > > What I'd like to know is: > How can it be that such a basic routine behaves differently in differnet > implementations of IDL? > > And, more importantly: can anybody tell me how to make the > Windows-version of "sort" behave correctly, > without writing my own routine for sorting? Search for 'BSORT' at http://www.astro.washington.edu/deutsch/idl/htmlhelp/index.html Cheers, Liam. http://cimss.ssec.wisc.edu/~gumley

**References**:**Inconsistency: "sort" on UNIX <-> Windows***From:*Daniel Luebbert

- Prev by Date:
**Inconsistency: "sort" on UNIX <-> Windows** - Next by Date:
**Re: Inconsistency: "sort" on UNIX <-> Windows** - Prev by thread:
**Inconsistency: "sort" on UNIX <-> Windows** - Next by thread:
**Re: Inconsistency: "sort" on UNIX <-> Windows** - Index(es):