From f75e41be0eaa5db8c61c9362e4f26ca52e52257c Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 23 Mar 2025 17:05:13 -0400 Subject: [PATCH] int -> size_t --- gtsam/basis/Chebyshev2.cpp | 2 +- gtsam/basis/tests/testChebyshev2.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gtsam/basis/Chebyshev2.cpp b/gtsam/basis/Chebyshev2.cpp index 137b3895b..c5dc46640 100644 --- a/gtsam/basis/Chebyshev2.cpp +++ b/gtsam/basis/Chebyshev2.cpp @@ -232,7 +232,7 @@ Matrix Chebyshev2::IntegrationMatrix(size_t N) { Eigen::JacobiSVD svd(D, Eigen::ComputeThinU | Eigen::ComputeThinV); const auto& S = svd.singularValues(); Matrix invS = Matrix::Zero(N, N); - for (int i = 0; i < N - 1; ++i) invS(i, i) = 1.0 / S(i); + for (size_t i = 0; i < N - 1; ++i) invS(i, i) = 1.0 / S(i); Matrix P = svd.matrixV() * invS * svd.matrixU().transpose(); // Return a version of P that makes sure (P*f)(0) = 0. diff --git a/gtsam/basis/tests/testChebyshev2.cpp b/gtsam/basis/tests/testChebyshev2.cpp index 98003d937..dee75297c 100644 --- a/gtsam/basis/tests/testChebyshev2.cpp +++ b/gtsam/basis/tests/testChebyshev2.cpp @@ -32,7 +32,7 @@ using namespace gtsam; //****************************************************************************** TEST(Chebyshev2, Point) { - static const int N = 5; + static const size_t N = 5; auto points = Chebyshev2::Points(N); Vector expected(N); expected << -1., -sqrt(2.) / 2., 0., sqrt(2.) / 2., 1.; @@ -50,7 +50,7 @@ TEST(Chebyshev2, Point) { //****************************************************************************** TEST(Chebyshev2, PointInInterval) { - static const int N = 5; + static const size_t N = 5; auto points = Chebyshev2::Points(N, 0, 20); Vector expected(N); expected << 0., 1. - sqrt(2.) / 2., 1., 1. + sqrt(2.) / 2., 2.; @@ -470,7 +470,7 @@ TEST(Chebyshev2, ComponentDerivativeFunctor) { //****************************************************************************** TEST(Chebyshev2, IntegrationMatrix) { - const int N = 10; // number of intervals => N+1 nodes + const size_t N = 10; // number of intervals => N+1 nodes const double a = 0, b = 10; // Create integration matrix @@ -482,7 +482,7 @@ TEST(Chebyshev2, IntegrationMatrix) { EXPECT_DOUBLES_EQUAL(0, F(0), 1e-9); // check first value is 0 Vector points = Chebyshev2::Points(N, a, b); Vector ramp(N); - for (int i = 0; i < N; ++i) ramp(i) = points(i) - a; + for (size_t i = 0; i < N; ++i) ramp(i) = points(i) - a; EXPECT(assert_equal(ramp, F, 1e-9)); // Get values of the derivative (fprime) at the Chebyshev nodes