Sorting multi-dimensionnal arrays

Open discussion regarding features, bugs, issues, vendors, etc.

Sorting multi-dimensionnal arrays

Postby stevenmarguet » Thu May 05, 2011 9:29 am

Hello to everyone.

I face a problem to sort a bi-dimensional array with fortran 95.

More precisely, I wonder if such a function already exists to avoid
to have to recode it since I am quite sure my skills are unsufficient
to perform it efficiently !

I have seen there was the slasrt and dlasrt subroutines in Lapack.
My problem is that this subroutines can "only" sort one dimensionnal array...

I would like to obtain something like this
a = [[ 0, 0, 0 ],
[ 0, 1, 0 ],
[ 0, 1, 1 ],
[ 0, 2, 0 ],
[ 0, 2, 1 ],
[ 1, 0, 1 ],
[ 1, 0, 2 ],
[ 1, 1, 0 ],
[ 4, 1, 2 ]]

from
b = [[ 1, 0, 1 ],
[ 4, 1, 2 ],
[ 0, 2, 0 ],
[ 0, 1, 1 ],
[ 1, 0, 2 ],
[ 0, 0, 0 ],
[ 0, 2, 1 ],
[ 1, 1, 0 ],
[ 0, 1, 0 ]]

for example. In fact I want to sort my b matrix without changing
its lines, by ascending numbers of first row index and then of second row index...

Do someone know if such a function is available somewhere ?
Thank you for your help :).

Steven
stevenmarguet
 
Posts: 1
Joined: Thu May 05, 2011 7:50 am

Return to User Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron