1 #include "leastsquares.hh"
4 Least_squares::OK() const
6 assert (input
.size() > 1);
8 for (int i
=1; i
< input
.size(); i
++)
9 dx
+= abs (input
[i
-1].x() - input
[i
].x ());
15 Least_squares::minimise (Real
&coef
, Real
&offset
)
23 for (int i
=0; i
< input
.size();i
++)
26 Real y
= input
[i
].y();
35 coef
= (N
* sxy
- sx
*sy
)/(N
*sqx
- sqr (sx
));
36 offset
= (sy
- coef
* sx
)/N
;