[comp.lang.apl] WANTED: a way to sort array so each column is in des

cs450a03@uc780.umd.edu (04/14/91)

A Analla writes:

>Could some please suggest a generic function to reorder each column
>of an array in descending order where the array is two dimensional.
>I would prefer the solution not be iterative and not require breaking
>the columns into separate vectors.

Well, in general, if you want to order the columns independently, you
are already treating them as separate vectors.

If you are using J, I'd suggest something like:
   \:"1&.|: array

However, if you are using vs-apl, I'd recommend you write a function
which iterates over the columns:

_
V Y <- F Y ;LP ;N
  ->(LP <- ((minus1 take rho Y)rho LOOP), END)[N <- quadIO]

LOOP:Y[;N] <- Y[gradedown Y;N]
  ->LP[N <- N+1]

END:
_
V

I could go on, but maybe you could say what version of APL you are
working with?

Or maybe I misunderstood your problem?

Raul Rockwell