Commit 528c5c69 authored by berenger-bramas's avatar berenger-bramas
Browse files

A better quick sort:

pivot choice has been changed
previous was [0], now [last]+[0] / 2
and average is done progressively.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@209 2616d619-271b-44dc-8df4-d4a8f33a7222
parent f9d99bf6
......@@ -130,9 +130,9 @@ class FQuickSort {
// We do an average of the first element of each proc array
PivotType sum = 0;
for(int idxProc = 0 ; idxProc < nbProcs ;++idxProc){
sum += result[idxProc];
sum += result[idxProc] / nbProcs;
}
return sum / nbProcs;
return sum ;
}
/** change the group and communicator */
......@@ -367,7 +367,7 @@ public:
/////////////////////////////////////////////////
// sort QsLocal part of the outputArray
const PivotType pivot = MpiGetPivot<PivotType>(outputArray[0], currentComm, currentNbProcs);
const PivotType pivot = MpiGetPivot<PivotType>(outputArray[size/2], currentComm, currentNbProcs);
Fix myFix;
QsLocal(outputArray, pivot, 0, size - 1, myFix.pre, myFix.suf);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment