#include <quadlsq.h>
Definition at line 24 of file quadlsq.h.
◆ QLSQ()
◆ add()
void QLSQ::add |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 53 of file quadlsq.cpp.
62 sigxxx += static_cast<long double>(x) * x * x;
63 sigxxy += static_cast<long double>(x) * x * y;
◆ clear()
◆ count()
◆ fit()
void QLSQ::fit |
( |
int |
degree | ) |
|
Definition at line 95 of file quadlsq.cpp.
100 long double x_variance = static_cast<long double>(sigxx) * n -
101 static_cast<long double>(sigx) * sigx;
107 if (x_variance <
kMinVariance * n * n || degree < 1 || n < 2) {
110 if (n >= 1 && degree >= 0) {
117 long double top96 = 0.0;
118 long double bottom96 = 0.0;
119 long double cubevar = sigxxx * n - static_cast<long double>(sigxx) * sigx;
120 long double covariance = static_cast<long double>(sigxy) * n -
121 static_cast<long double>(sigx) * sigy;
123 if (n >= 4 && degree >= 2) {
124 top96 = cubevar * covariance;
125 top96 += x_variance * (static_cast<long double>(sigxx) * sigy - sigxxy * n);
127 bottom96 = cubevar * cubevar;
128 bottom96 -= x_variance *
129 (sigxxxx * n - static_cast<long double>(sigxx) * sigxx);
133 a = top96 / bottom96;
134 top96 = covariance - cubevar * a;
135 b = top96 / x_variance;
◆ get_a()
◆ get_b()
◆ get_c()
◆ remove()
void QLSQ::remove |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 71 of file quadlsq.cpp.
76 tprintf(
"Can't remove an element from an empty QLSQ accumulator!\n");
85 sigxxx -= static_cast<long double>(x) * x * x;
The documentation for this class was generated from the following files: