#ifndef SORTER_HPP #define SORTER_HPP 1 namespace Sorter { template T pivotselect(const vector &arr, int lbound, int ubound); template void partition(vector &arr, int lbound, int ubound, T pivotval, int &pivotlt, int &pivoteq); template T median(vector &array, int lbound, int ubound, int idx = -1); class kvpair { public: double key; double value; kvpair(double ikey = 0, double ival = 0): key(ikey), value(ival) { } bool operator< (const kvpair & rhs) const { return (key < rhs.key); } bool operator== (const kvpair & rhs) const { return (key == rhs.key); } operator double() const { return key; }; }; class parsorter { public: MPI_Comm c, nestedcomm; int nproc, myrank, mygrank; vector * tmparray; vector asizes; int ASIZE; parsorter * nested; parsorter(int isize, MPI_Comm incomm); ~parsorter(); void sortkvpairs(vector * inarray, vector * tarray = 0); }; #include "Sorter_impl.cc" }; // Outside the namespace void sortarray(blitz::Array const &keys, blitz::Array const &values, blitz::Array & sortkeys, blitz::Array & sortvals, MPI_Comm c = MPI_COMM_WORLD); #endif