1 #include "leastsquares.hh"
3 Least_squares::OK() const
5 assert( input
.size() > 1 );
7 for (int i
=1; i
< input
.size(); i
++)
8 dx
+= abs (input
[i
-1].x
- input
[i
].x
);
13 Least_squares::minimise(Real
&coef
, Real
&offset
)
21 for (int i
=0; i
< input
.size();i
++) {
32 coef
= (N
* sxy
- sx
*sy
)/(N
*sqx
- sqr(sx
));
33 offset
= (sy
- coef
* sx
)/N
;