regress: provide function to find median

This commit is contained in:
Miroslav Lichvar 2017-06-21 19:11:10 +02:00
parent 5e1e31ad5f
commit 6207655ab2
2 changed files with 16 additions and 0 deletions

View file

@ -429,6 +429,19 @@ find_median(double *x, int n)
}
}
/* ================================================== */
double
RGR_FindMedian(double *x, int n)
{
double tmp[MAX_POINTS];
assert(n > 0 && n <= MAX_POINTS);
memcpy(tmp, x, n * sizeof (tmp[0]));
return find_median(tmp, n);
}
/* ================================================== */
/* This function evaluates the equation

View file

@ -131,4 +131,7 @@ RGR_MultipleRegress
double *b2 /* estimated second slope */
);
/* Return the median value from an array */
extern double RGR_FindMedian(double *x, int n);
#endif /* GOT_REGRESS_H */