Re: simplest way to sort a bi-dimensional array? mat(a,b)...



On Jul 26, 4:41 am, ginko <gi...@xxxxxxxxxxx> wrote:
i heard of the bubble sort algorithm, but i found examples for a
mono-dimensional array only.

now i need to sort a BI-dimensional array.


I think you need an additional rule for sorting bi-dimensional arrays,
e.g., if you have a matrix, say A(m, n), will the maximum element be
in the A(m,n) entry, or will there be a maximum value per row (A(:,n))
or per column (A(m,:))?

Others might correct me, but as I see it, you don't need a "special"
bi-dimensional algorithm to approach any of the three possibilities I
just mentioned: In the first case, you just need to pack your "matrix"
as a "vector" before calling the sorting routine (and unpack it on
return); for the remaining cases, just apply a loop.


PS: i use fortran 77


Such task could be a lot easier using a Fortran 90/95 compiler.


John.

.