16 void fit(
const std::vector<float>&
x,
17 const std::vector<float>&
y,
19 const std::vector<float>& sigy,
30 T const* __restrict__
y,
32 T const* __restrict__ sigy2,
39 T s11 = 0, s12 = 0, s22 = 0;
40 for (
int i = 0;
i != ndat;
i++) {
41 T sy2 =
T(1) / sigy2[
i];
43 g2 += x[
i] * y[
i] * sy2;
46 s22 += x[
i] * x[
i] * sy2;
49 T d =
T(1) / (s11 * s22 - s12 * s12);
50 intercept = (g1 * s22 -
g2 * s12) * d;
51 slope = (
g2 * s11 - g1 * s12) * d;
void fit(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigy, float &slope, float &intercept, float &covss, float &covii, float &covsi) const
static const double slope[3]
uint16_t const *__restrict__ x
void linearFit(T const *__restrict__ x, T const *__restrict__ y, int ndat, T const *__restrict__ sigy2, T &slope, T &intercept, T &covss, T &covii, T &covsi)