From 5333393d3d0041bb2398008cb0bf7da0ef087ba7 Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Thu, 5 May 2022 09:14:03 +0200 Subject: [PATCH] Fix os operator --- SimoxUtility/math/regression/linear3d.cpp | 7 ++++--- SimoxUtility/math/regression/linear3d.h | 4 ++-- SimoxUtility/tests/math/regression/linear3d.cpp | 2 -- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/SimoxUtility/math/regression/linear3d.cpp b/SimoxUtility/math/regression/linear3d.cpp index 6403512c0..538bbc083 100644 --- a/SimoxUtility/math/regression/linear3d.cpp +++ b/SimoxUtility/math/regression/linear3d.cpp @@ -76,9 +76,10 @@ simox::math::operator<<(std::ostream& os, const LinearRegression3D& r) { os << ", "; } - os << r.coefficients(row, 0) - << " + " << r.coefficients(row, 1) << " * x_" << row - << " = y_" << row; + os << "y_" << row + << " = " << r.coefficients(row, 0) + << " + " << r.coefficients(row, 1) << " * x" + ; } os << " ]"; return os; diff --git a/SimoxUtility/math/regression/linear3d.h b/SimoxUtility/math/regression/linear3d.h index 365c33f23..d19fa2a17 100644 --- a/SimoxUtility/math/regression/linear3d.h +++ b/SimoxUtility/math/regression/linear3d.h @@ -7,8 +7,8 @@ namespace simox::math { /** - * @brief A linear regression model of the form a + b * x = y, - * or per dimension, a_i + b_i * x = y_i. + * @brief A linear regression model of the form y = a + b * x, + * or per dimension, y_i = a_i + b_i * x. * * - x is the scalar input variable (e.g. time) * - y is 3D vector output variable (e.g. position) diff --git a/SimoxUtility/tests/math/regression/linear3d.cpp b/SimoxUtility/tests/math/regression/linear3d.cpp index 0ca866f92..a235d0a6d 100644 --- a/SimoxUtility/tests/math/regression/linear3d.cpp +++ b/SimoxUtility/tests/math/regression/linear3d.cpp @@ -86,8 +86,6 @@ BOOST_AUTO_TEST_CASE(test_linear_regression_3d_fit_and_predict_with_input_offset // Coefficients are different now, but prediction should be the same. - // Predict - BOOST_CHECK_LE((regression.predict(xs[0]) - ys[0]).norm(), prec); BOOST_CHECK_LE((regression.predict(xs[1]) - ys[1]).norm(), prec); BOOST_CHECK_LE((regression.predict(xs[2]) - ys[2]).norm(), prec); -- GitLab