Use new Vector4 class

This commit is contained in:
Matthias Grob
2023-03-21 15:01:26 +01:00
parent 08d6465ce5
commit b0189d95af
12 changed files with 32 additions and 56 deletions
+6 -21
View File
@@ -50,19 +50,12 @@ TEST(MatrixLeastSquaresTest, 4x3)
-1.f, -1.1f, -1.2f
};
Matrix<float, 4, 3> A(data);
float b_data[4] = {2.0f, 3.0f, 4.0f, 5.0f};
Vector<float, 4> b(b_data);
float x_check_data[3] = {-0.69168233f,
-0.26227593f,
-1.03767522f
};
Vector<float, 3> x_check(x_check_data);
Vector4f b(2.0f, 3.0f, 4.0f, 5.0f);
Vector3f x_check(-0.69168233f, -0.26227593f, -1.03767522f);
LeastSquaresSolver<float, 4, 3> qrd = LeastSquaresSolver<float, 4, 3>(A);
Vector<float, 3> x = qrd.solve(b);
Vector3f x = qrd.solve(b);
EXPECT_EQ(x, x_check);
}
@@ -75,20 +68,12 @@ TEST(MatrixLeastSquaresTest, 4x4)
-1.f, -1.1f, -1.2f, -1.3f
};
Matrix<float, 4, 4> A(data);
float b_data[4] = {2.0f, 3.0f, 4.0f, 5.0f};
Vector<float, 4> b(b_data);
float x_check_data[4] = { 0.97893433f,
-2.80798701f,
-0.03175765f,
-2.19387649f
};
Vector<float, 4> x_check(x_check_data);
Vector4f b(2.0f, 3.0f, 4.0f, 5.0f);
Vector4f x_check(0.97893433f, -2.80798701f, -0.03175765f, -2.19387649f);
LeastSquaresSolver<float, 4, 4> qrd = LeastSquaresSolver<float, 4, 4>(A);
Vector<float, 4> x = qrd.solve(b);
Vector4f x = qrd.solve(b);
EXPECT_EQ(x, x_check);
}