diff --git a/c/tests/bench_dsa_select.c b/c/tests/bench_dsa_select.c index 1fd3e6b..a1f2014 100644 --- a/c/tests/bench_dsa_select.c +++ b/c/tests/bench_dsa_select.c @@ -59,6 +59,12 @@ static double bench_ns(void (*fn)(const float*,int,int,int*,int*), return ts[N_REPEAT/2]; } +/* Sort an array of doubles ascending (median-of-medians aggregation below). */ +static void dsort(double *a, int n){ + for(int s=1;s=0 && a[b]>k){ a[b+1]=a[b]; b--; } a[b+1]=k; } +} + /* the NEW algorithm calls the real partial_select_desc + replicates the production * threshold derivation and position scans. */ static void keep_new(const float *isc, int nk, int keep, int *dst, int *nd_out){ @@ -74,6 +80,7 @@ static void keep_new(const float *isc, int nk, int keep, int *dst, int *nd_out){ /* deterministic score fill for three shapes */ static uint32_t brng = 0xA5A5A5A5u; +static void brng_seed(uint32_t s){ brng = s; } static double brand(void){ brng ^= brng << 13; brng ^= brng >> 17; brng ^= brng << 5; return (double)(brng >> 8) * (1.0 / 16777216.0); } static void fill_realistic(float *isc, int nk){ /* few hot, long distinct tail */ @@ -87,11 +94,24 @@ static void fill_plateau(float *isc, int nk){ /* tie blocks -> boundary path for(int i=0;i