22 #define mswap(x, y) swapspace = x; x = y; y=swapspace; 38 int len = end - start;
39 #if ISOSPEC_BUILDING_R 40 int pivot = len/2 + start;
42 int pivot = rand() % len + start;
44 void* pval = array[pivot];
45 double pprob = getLProb(pval);
46 mswap(array[pivot], array[end-1]);
48 for(
int i=start; i<end-1; i++)
50 if(getLProb(array[i]) < pprob)
52 mswap(array[i], array[loweridx]);
56 mswap(array[end-1], array[loweridx]);
void * quickselect(void **array, int n, int start, int end)
Quickly select the n'th positional statistic, including the weights.