int -> size_t

release/4.3a0
Frank Dellaert 2025-03-23 17:05:13 -04:00
parent 5ef8c0ae1a
commit f75e41be0e
2 changed files with 5 additions and 5 deletions

View File

@ -232,7 +232,7 @@ Matrix Chebyshev2::IntegrationMatrix(size_t N) {
Eigen::JacobiSVD<Matrix> svd(D, Eigen::ComputeThinU | Eigen::ComputeThinV); Eigen::JacobiSVD<Matrix> svd(D, Eigen::ComputeThinU | Eigen::ComputeThinV);
const auto& S = svd.singularValues(); const auto& S = svd.singularValues();
Matrix invS = Matrix::Zero(N, N); 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(); Matrix P = svd.matrixV() * invS * svd.matrixU().transpose();
// Return a version of P that makes sure (P*f)(0) = 0. // Return a version of P that makes sure (P*f)(0) = 0.

View File

@ -32,7 +32,7 @@ using namespace gtsam;
//****************************************************************************** //******************************************************************************
TEST(Chebyshev2, Point) { TEST(Chebyshev2, Point) {
static const int N = 5; static const size_t N = 5;
auto points = Chebyshev2::Points(N); auto points = Chebyshev2::Points(N);
Vector expected(N); Vector expected(N);
expected << -1., -sqrt(2.) / 2., 0., sqrt(2.) / 2., 1.; expected << -1., -sqrt(2.) / 2., 0., sqrt(2.) / 2., 1.;
@ -50,7 +50,7 @@ TEST(Chebyshev2, Point) {
//****************************************************************************** //******************************************************************************
TEST(Chebyshev2, PointInInterval) { TEST(Chebyshev2, PointInInterval) {
static const int N = 5; static const size_t N = 5;
auto points = Chebyshev2::Points(N, 0, 20); auto points = Chebyshev2::Points(N, 0, 20);
Vector expected(N); Vector expected(N);
expected << 0., 1. - sqrt(2.) / 2., 1., 1. + sqrt(2.) / 2., 2.; expected << 0., 1. - sqrt(2.) / 2., 1., 1. + sqrt(2.) / 2., 2.;
@ -470,7 +470,7 @@ TEST(Chebyshev2, ComponentDerivativeFunctor) {
//****************************************************************************** //******************************************************************************
TEST(Chebyshev2, IntegrationMatrix) { 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; const double a = 0, b = 10;
// Create integration matrix // Create integration matrix
@ -482,7 +482,7 @@ TEST(Chebyshev2, IntegrationMatrix) {
EXPECT_DOUBLES_EQUAL(0, F(0), 1e-9); // check first value is 0 EXPECT_DOUBLES_EQUAL(0, F(0), 1e-9); // check first value is 0
Vector points = Chebyshev2::Points(N, a, b); Vector points = Chebyshev2::Points(N, a, b);
Vector ramp(N); 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)); EXPECT(assert_equal(ramp, F, 1e-9));
// Get values of the derivative (fprime) at the Chebyshev nodes // Get values of the derivative (fprime) at the Chebyshev nodes