- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I need to sort the lines of a nx4 array, using the values of a column as the sorting parameter. The subs I found
in documentation are for one dimension arrays.
Can anyone help, indicating were can I find a subroutine that sorts a n x m array?
Thanks
Geraldo
I need to sort the lines of a nx4 array, using the values of a column as the sorting parameter. The subs I found
in documentation are for one dimension arrays.
Can anyone help, indicating were can I find a subroutine that sorts a n x m array?
Thanks
Geraldo
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You didn't specify if the subsequent values in the first dimension are to be sorted subordinately to the prior ones. There are straightforward algorithims (see, e.g. Numerical Receipes, Press, et al.) in which one sorts an array whose sequential values contain the sequence number of the entry in the object array, were it sorted. This has the advantage that the entries in the array don't have to be moved.
Keith
You didn't specify if the subsequent values in the first dimension are to be sorted subordinately to the prior ones. There are straightforward algorithims (see, e.g. Numerical Receipes, Press, et al.) in which one sorts an array whose sequential values contain the sequence number of the entry in the object array, were it sorted. This has the advantage that the entries in the array don't have to be moved.
Keith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use Michel Olagnon's sorting routines -- particularly, see MRGRNK, which doesn't sort but returns a rank array instead; you can use that to renumerate all items. You could possibly also try some qsort (QSORT or SORTQQ), basically treating the matrix as array of 4-byte structures.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Keith and Yugoslav.
I downloaded Orderpack, and will access Numerical Recipes ( I had it in my bookmarks but have never accessed it).
Will take some time to digest it all.
Geraldo
I downloaded Orderpack, and will access Numerical Recipes ( I had it in my bookmarks but have never accessed it).
Will take some time to digest it all.
Geraldo

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page