mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 23:53:33 +08:00
Use new Vector4 class
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user