63 sigxxx +=
static_cast<long double>(x) * x * x;
64 sigxxy +=
static_cast<long double>(x) * x * y;
65 sigxxxx +=
static_cast<long double>(x) * x * x * x;
77 tprintf(
"Can't remove an element from an empty QLSQ accumulator!\n");
86 sigxxx -=
static_cast<long double>(x) * x * x;
87 sigxxy -=
static_cast<long double>(x) * x * y;
88 sigxxxx -=
static_cast<long double>(x) * x * x * x;
101 long double x_variance =
static_cast<long double>(sigxx) * n -
102 static_cast<long double>(sigx) * sigx;
108 if (x_variance <
kMinVariance * n * n || degree < 1 || n < 2) {
111 if (n >= 1 && degree >= 0) {
118 long double top96 = 0.0;
119 long double bottom96 = 0.0;
120 long double cubevar = sigxxx * n -
static_cast<long double>(sigxx) * sigx;
121 long double covariance =
static_cast<long double>(sigxy) * n -
122 static_cast<long double>(sigx) * sigy;
124 if (n >= 4 && degree >= 2) {
125 top96 = cubevar * covariance;
126 top96 += x_variance * (
static_cast<long double>(sigxx) * sigy - sigxxy * n);
128 bottom96 = cubevar * cubevar;
129 bottom96 -= x_variance *
130 (sigxxxx * n -
static_cast<long double>(sigxx) * sigxx);
134 a = top96 / bottom96;
135 top96 = covariance - cubevar * a;
136 b = top96 / x_variance;
140 b = covariance / x_variance;
142 c = (sigy - a * sigxx - b * sigx) / n;
void remove(double x, double y)
void add(double x, double y)
const double kMinVariance
DLLSYM void tprintf(const char *format,...)