From ebd2a303bf05d1cb08577bfec2b66e4e6d7ba510 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sat, 30 Apr 2022 22:52:05 -0700 Subject: [PATCH] [wpimath] Remove deprecated MakeMatrix() function (#4202) --- .../main/native/include/frc/StateSpaceUtil.h | 24 ------------ .../test/native/cpp/StateSpaceUtilTest.cpp | 37 ------------------- 2 files changed, 61 deletions(-) diff --git a/wpimath/src/main/native/include/frc/StateSpaceUtil.h b/wpimath/src/main/native/include/frc/StateSpaceUtil.h index da1e57dc3e..0345b46548 100644 --- a/wpimath/src/main/native/include/frc/StateSpaceUtil.h +++ b/wpimath/src/main/native/include/frc/StateSpaceUtil.h @@ -93,30 +93,6 @@ bool IsStabilizableImpl(const Matrixd& A, } // namespace detail -/** - * Creates a matrix from the given list of elements. - * - * The elements of the matrix are filled in in row-major order. - * - * @param elems An array of elements in the matrix. - * @return A matrix containing the given elements. - * @deprecated Use Eigen::Matrix or Eigen::Vector initializer list constructor. - */ -template ...>>> -WPI_DEPRECATED( - "Use Eigen::Matrix or Eigen::Vector initializer list constructor") -Matrixd MakeMatrix(Ts... elems) { - static_assert( - sizeof...(elems) == Rows * Cols, - "Number of provided elements doesn't match matrix dimensionality"); - - Matrixd result; - detail::MatrixImpl(result, elems...); - return result; -} - /** * Creates a cost matrix from the given vector for use with LQR. * diff --git a/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp b/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp index 60efa066dc..105a4346f9 100644 --- a/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp +++ b/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp @@ -10,43 +10,6 @@ #include "frc/StateSpaceUtil.h" #include "frc/system/NumericalIntegration.h" -TEST(StateSpaceUtilTest, MakeMatrix) { - // Column vector - frc::Vectord<2> mat1 = frc::MakeMatrix<2, 1>(1.0, 2.0); - EXPECT_NEAR(mat1(0), 1.0, 1e-3); - EXPECT_NEAR(mat1(1), 2.0, 1e-3); - - // Row vector - Eigen::RowVector mat2 = frc::MakeMatrix<1, 2>(1.0, 2.0); - EXPECT_NEAR(mat2(0), 1.0, 1e-3); - EXPECT_NEAR(mat2(1), 2.0, 1e-3); - - // Square matrix - frc::Matrixd<2, 2> mat3 = frc::MakeMatrix<2, 2>(1.0, 2.0, 3.0, 4.0); - EXPECT_NEAR(mat3(0, 0), 1.0, 1e-3); - EXPECT_NEAR(mat3(0, 1), 2.0, 1e-3); - EXPECT_NEAR(mat3(1, 0), 3.0, 1e-3); - EXPECT_NEAR(mat3(1, 1), 4.0, 1e-3); - - // Nonsquare matrix with more rows than columns - frc::Matrixd<3, 2> mat4 = frc::MakeMatrix<3, 2>(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); - EXPECT_NEAR(mat4(0, 0), 1.0, 1e-3); - EXPECT_NEAR(mat4(0, 1), 2.0, 1e-3); - EXPECT_NEAR(mat4(1, 0), 3.0, 1e-3); - EXPECT_NEAR(mat4(1, 1), 4.0, 1e-3); - EXPECT_NEAR(mat4(2, 0), 5.0, 1e-3); - EXPECT_NEAR(mat4(2, 1), 6.0, 1e-3); - - // Nonsquare matrix with more columns than rows - frc::Matrixd<2, 3> mat5 = frc::MakeMatrix<2, 3>(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); - EXPECT_NEAR(mat5(0, 0), 1.0, 1e-3); - EXPECT_NEAR(mat5(0, 1), 2.0, 1e-3); - EXPECT_NEAR(mat5(0, 2), 3.0, 1e-3); - EXPECT_NEAR(mat5(1, 0), 4.0, 1e-3); - EXPECT_NEAR(mat5(1, 1), 5.0, 1e-3); - EXPECT_NEAR(mat5(1, 2), 6.0, 1e-3); -} - TEST(StateSpaceUtilTest, CostParameterPack) { frc::Matrixd<3, 3> mat = frc::MakeCostMatrix(1.0, 2.0, 3.0); EXPECT_NEAR(mat(0, 0), 1.0, 1e-3);