comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Inconsistency: "sort" on UNIX <-> Windows
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Inconsistency: "sort" on UNIX <-> Windows [message #20542] Fri, 07 July 2000 00:00 Go to previous message
Daniel Luebbert is currently offline  Daniel Luebbert
Messages: 6
Registered: May 2000
Junior Member
Hi,

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?

THanks for any hint,

Daniel


--
------------------------------------------------------------ ------------
Dr. Daniel L�bbert
Stanford Synchrotron Radiation Laboratory (SSRL)
Bldg. 137, Mailstop 69, 2575 Sandhill Road, Menlo Park, CA 94025, USA
Phone: (650) 926-4010 FAX: (650) 926-4100
luebbert@slac.stanford.edu
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: User-added Postscript fonts
Next Topic: Strange PRINTER Coordinates

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 20:35:30 PDT 2025

Total time taken to generate the page: 0.87985 seconds