diff --git a/miscmaths.cc b/miscmaths.cc index d33f58673807abd79887585c37cc1d3175a265ee..a95d991a7cb9a2f4f25c1ea64e24892c10231b7b 100644 --- a/miscmaths.cc +++ b/miscmaths.cc @@ -624,6 +624,7 @@ namespace MISCMATHS { return matnew; } + bool strict_less_than(pair<double, int> x, pair<double, int> y) { return x.first < y.first; } vector<int> get_sortindex(const Matrix& vals, const string& mode, int col) { @@ -634,7 +635,7 @@ namespace MISCMATHS { for (int n=0; n<length; n++) { sortlist[n] = pair<double, int>((double) vals(n+1,col),n+1); } - sort(sortlist.begin(),sortlist.end()); // O(N.log(N)) + sort(sortlist.begin(),sortlist.end(),strict_less_than); // O(N.log(N)) vector<int> idx(length); for (int n=0; n<length; n++) { if (mode=="old2new") {