regress: provide function to find median
This commit is contained in:
parent
5e1e31ad5f
commit
6207655ab2
2 changed files with 16 additions and 0 deletions
13
regress.c
13
regress.c
|
@ -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
|
/* This function evaluates the equation
|
||||||
|
|
||||||
|
|
|
@ -131,4 +131,7 @@ RGR_MultipleRegress
|
||||||
double *b2 /* estimated second slope */
|
double *b2 /* estimated second slope */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Return the median value from an array */
|
||||||
|
extern double RGR_FindMedian(double *x, int n);
|
||||||
|
|
||||||
#endif /* GOT_REGRESS_H */
|
#endif /* GOT_REGRESS_H */
|
||||||
|
|
Loading…
Reference in a new issue