25#ifndef LINEAR_LEAST_SQUARE_FIT_H_
26#define LINEAR_LEAST_SQUARE_FIT_H_
31template<
typename sample_type>
37 slope( sample_type()),
50template<
typename sample_type,
typename evaluation_type=sample_type>
63 add_value (
const sample_type x,
const sample_type y)
75 sum_x = sum_xx = sum_y = sum_yy = sum_xy = n =
ZERO;
92 a = sum_y * inv_n - b * x_mean;
94 variance_a = Vyx * (inv_n +
SQR( x_mean) * invQx);
95 variance_b = Vyx * invQx;
linear least square fit for y = a + b * x
void evaluate(linear_least_square_result< evaluation_type > &r) const
void add_value(const sample_type x, const sample_type y)
sample_type get_mean_x(void) const
sample_type get_mean_y(void) const
linear_least_square_fit(void)
void evaluate(evaluation_type &a, evaluation_type &b, evaluation_type &variance_a, evaluation_type &variance_b) const
unsigned get_count(void) const
maintains result and precision data from a linear least square fit
sample_type variance_offset
sample_type variance_slope
uint32_t id
channel identifier (for logging)
linear_least_square_result(void)
defines platform-dependent algorithms and constants