提交 53f53e89 编写于 作者: P phh

7016998: gcutil class LinearLeastSquareFit doesn't initialize some of its fields

Summary: Initialize _sum_x_squared, _intercept and _slope in constructor.
Reviewed-by: bobv, coleenp
上级 a2031db9
...@@ -106,8 +106,8 @@ void AdaptivePaddedNoZeroDevAverage::sample(float new_sample) { ...@@ -106,8 +106,8 @@ void AdaptivePaddedNoZeroDevAverage::sample(float new_sample) {
} }
LinearLeastSquareFit::LinearLeastSquareFit(unsigned weight) : LinearLeastSquareFit::LinearLeastSquareFit(unsigned weight) :
_sum_x(0), _sum_y(0), _sum_xy(0), _sum_x(0), _sum_x_squared(0), _sum_y(0), _sum_xy(0),
_mean_x(weight), _mean_y(weight) {} _intercept(0), _slope(0), _mean_x(weight), _mean_y(weight) {}
void LinearLeastSquareFit::update(double x, double y) { void LinearLeastSquareFit::update(double x, double y) {
_sum_x = _sum_x + x; _sum_x = _sum_x + x;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册