[Matrix-SIG] "Sorting" a large array?!

Konrad Hinsen hinsen@cnrs-orleans.fr
Wed, 25 Aug 1999 19:16:28 +0200


> Any other help is still appreciated.

It all depends on how large you can afford to make self.mem.
Suppose you can make it significantly larger than self.n, then
the following strategy might be better:

Whenever arrdata is "full", locate the self.n lowest values at each
array position, pack them into the first self.n slots, and discard
everything else, making space for adding new frames.

For locating the lowest values, try the following:
1) Calculate the minima with minimum.reduce.
2) Create a mask that discards all values equal to the minimum from
   a subsequent search (this requires some restriction on the data
   range in your arrays), and use minimum.reduce again to find
   the second-lowest values.
3) Continue up to self.n lowest values.

Good luck,
  Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------