#include <quadlsq.h>
List of all members.
Detailed Description
Definition at line 25 of file quadlsq.h.
Constructor & Destructor Documentation
Member Function Documentation
void QLSQ::add |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 58 of file quadlsq.cpp.
{
n++;
sigx += x;
sigy += y;
sigxx += x * x;
sigxy += x * y;
sigyy += y * y;
sigxxx += (long double) x *x * x;
sigxxy += (long double) x *x * y;
sigxxxx += (long double) x *x * x * x;
}
Definition at line 36 of file quadlsq.cpp.
{
a = 0;
b = 0;
c = 0;
n = 0;
sigx = 0;
sigy = 0;
sigxx = 0;
sigxy = 0;
sigyy = 0;
sigxxx = 0;
sigxxy = 0;
sigxxxx = 0;
}
inT32 QLSQ::count |
( |
| ) |
[inline] |
void QLSQ::fit |
( |
int |
degree | ) |
|
Definition at line 105 of file quadlsq.cpp.
{
long double cubetemp;
long double squaretemp;
long double top96, bottom96;
if (n >= 4 && degree >= 2) {
cubetemp = sigxxx * n - (long double) sigxx *sigx;
top96 =
cubetemp * ((long double) sigxy * n - (long double) sigx * sigy);
squaretemp = (long double) sigxx *n - (long double) sigx *sigx;
top96 += squaretemp * ((long double) sigxx * sigy - sigxxy * n);
bottom96 = cubetemp * cubetemp;
bottom96 -= squaretemp * (sigxxxx * n - (long double) sigxx * sigxx);
a = top96 / bottom96;
top96 = ((long double) sigxx * sigx - sigxxx * n) * a
+ (long double) sigxy *n - (long double) sigx *sigy;
bottom96 = (long double) sigxx *n - (long double) sigx *sigx;
b = top96 / bottom96;
c = (sigy - a * sigxx - b * sigx) / n;
}
else if (n == 0 || degree < 0) {
a = b = c = 0;
}
else {
a = 0;
if (n > 1 && degree > 0) {
b = (sigxy * n - sigx * sigy) / (sigxx * n - sigx * sigx);
}
else
b = 0;
c = (sigy - b * sigx) / n;
}
}
double QLSQ::get_a |
( |
| ) |
[inline] |
double QLSQ::get_b |
( |
| ) |
[inline] |
double QLSQ::get_c |
( |
| ) |
[inline] |
void QLSQ::remove |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 80 of file quadlsq.cpp.
{
if (n <= 0)
EMPTY_QLSQ.error ("QLSQ::remove", ABORT, NULL);
n--;
sigx -= x;
sigy -= y;
sigxx -= x * x;
sigxy -= x * y;
sigyy -= y * y;
sigxxx -= (long double) x *x * x;
sigxxy -= (long double) x *x * y;
sigxxxx -= (long double) x *x * x * x;
}
The documentation for this class was generated from the following files: