From 84b42ed3920a02feb6dd0e424a0aa02df8a50edb Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 22:54:23 -0400 Subject: [PATCH 01/19] use the string argument in DiscreteKeys::print --- gtsam/discrete/DiscreteKey.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gtsam/discrete/DiscreteKey.cpp b/gtsam/discrete/DiscreteKey.cpp index 79d11d8a7..17f233695 100644 --- a/gtsam/discrete/DiscreteKey.cpp +++ b/gtsam/discrete/DiscreteKey.cpp @@ -49,6 +49,7 @@ namespace gtsam { void DiscreteKeys::print(const std::string& s, const KeyFormatter& keyFormatter) const { + std::cout << (s.empty() ? "" : s + " ") << std::endl; for (auto&& dkey : *this) { std::cout << DefaultKeyFormatter(dkey.first) << " " << dkey.second << std::endl; From bef76b50f9634aec1f9ce0a92ed809ab90ea1807 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 22:54:45 -0400 Subject: [PATCH 02/19] change TODO to note since calling .eval() in Eigen is valid --- gtsam/geometry/CameraSet.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtsam/geometry/CameraSet.h b/gtsam/geometry/CameraSet.h index 950747102..cf4beb883 100644 --- a/gtsam/geometry/CameraSet.h +++ b/gtsam/geometry/CameraSet.h @@ -438,8 +438,7 @@ class CameraSet : public std::vector> { // (DxD) += (DxZDim) * ( (ZDimxD) - (ZDimx3) * (3xZDim) * (ZDimxD) ) // add contribution of current factor - // TODO(gareth): Eigen doesn't let us pass the expression. Call eval() for - // now... + // Eigen doesn't let us pass the expression so we call eval() augmentedHessian.updateDiagonalBlock( aug_i, ((FiT * From 299e5fd42e0ce93d36c14e7e97c9d66c1d664905 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 22:55:34 -0400 Subject: [PATCH 03/19] remove unnecessary push_back --- gtsam/hybrid/HybridNonlinearFactorGraph.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/gtsam/hybrid/HybridNonlinearFactorGraph.cpp b/gtsam/hybrid/HybridNonlinearFactorGraph.cpp index 2459e4ec9..e51adb9cd 100644 --- a/gtsam/hybrid/HybridNonlinearFactorGraph.cpp +++ b/gtsam/hybrid/HybridNonlinearFactorGraph.cpp @@ -56,8 +56,6 @@ HybridGaussianFactorGraph::shared_ptr HybridNonlinearFactorGraph::linearize( for (auto& f : factors_) { // First check if it is a valid factor if (!f) { - // TODO(dellaert): why? - linearFG->push_back(GaussianFactor::shared_ptr()); continue; } // Check if it is a nonlinear mixture factor From 8255ad596cecda7e9c9a6ee050d68d13df25c83c Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 22:57:24 -0400 Subject: [PATCH 04/19] add Testable traits to DiscreteBayesTree and HybridBayesTree --- gtsam/discrete/DiscreteBayesTree.h | 8 ++++++++ gtsam/hybrid/HybridBayesTree.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/gtsam/discrete/DiscreteBayesTree.h b/gtsam/discrete/DiscreteBayesTree.h index 34f8f5d4a..89baf49a9 100644 --- a/gtsam/discrete/DiscreteBayesTree.h +++ b/gtsam/discrete/DiscreteBayesTree.h @@ -110,4 +110,12 @@ class GTSAM_EXPORT DiscreteBayesTree /// @} }; +/// traits +template <> +struct traits + : public Testable {}; + +template <> +struct traits : public Testable {}; + } // namespace gtsam diff --git a/gtsam/hybrid/HybridBayesTree.h b/gtsam/hybrid/HybridBayesTree.h index bc2a0f852..f91e16cbf 100644 --- a/gtsam/hybrid/HybridBayesTree.h +++ b/gtsam/hybrid/HybridBayesTree.h @@ -123,6 +123,10 @@ class GTSAM_EXPORT HybridBayesTree : public BayesTree { }; /// traits +template <> +struct traits : public Testable { +}; + template <> struct traits : public Testable {}; From 3779f5280d14f2700227e403d87f8189d018b5ad Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 22:57:59 -0400 Subject: [PATCH 05/19] use STL to make DecisionTreeFactor::combine more efficient --- gtsam/discrete/DecisionTreeFactor.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gtsam/discrete/DecisionTreeFactor.cpp b/gtsam/discrete/DecisionTreeFactor.cpp index 17731453a..7202e6853 100644 --- a/gtsam/discrete/DecisionTreeFactor.cpp +++ b/gtsam/discrete/DecisionTreeFactor.cpp @@ -164,15 +164,23 @@ namespace gtsam { } // create new factor, note we collect keys that are not in frontalKeys - // TODO(frank): why do we need this??? result should contain correct keys!!! + /* + Due to branch merging, the labels in `result` may be missing some keys + E.g. After branch merging, we may get a ADT like: + Leaf [2] 1.0204082 + + This is missing the key values used for branching. + */ + KeyVector difference, frontalKeys_(frontalKeys), keys_(keys()); + // Get the difference of the frontalKeys and the factor keys using set_difference + std::sort(keys_.begin(), keys_.end()); + std::sort(frontalKeys_.begin(), frontalKeys_.end()); + std::set_difference(keys_.begin(), keys_.end(), frontalKeys_.begin(), + frontalKeys_.end(), back_inserter(difference)); + DiscreteKeys dkeys; - for (i = 0; i < keys().size(); i++) { - Key j = keys()[i]; - // TODO(frank): inefficient! - if (std::find(frontalKeys.begin(), frontalKeys.end(), j) != - frontalKeys.end()) - continue; - dkeys.push_back(DiscreteKey(j, cardinality(j))); + for (Key key : difference) { + dkeys.push_back(DiscreteKey(key, cardinality(key))); } return std::make_shared(dkeys, result); } From 3a34b79a554b24ef7eecd00cbd6ab9e93d55ec8c Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 23:02:36 -0400 Subject: [PATCH 06/19] improve docstring for HybridGaussianISAM --- gtsam/hybrid/HybridGaussianISAM.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtsam/hybrid/HybridGaussianISAM.h b/gtsam/hybrid/HybridGaussianISAM.h index 8578f3dc5..ba2de52d2 100644 --- a/gtsam/hybrid/HybridGaussianISAM.h +++ b/gtsam/hybrid/HybridGaussianISAM.h @@ -29,7 +29,8 @@ namespace gtsam { /** - * @brief + * @brief Incremental Smoothing and Mapping (ISAM) algorithm + * for hybrid factor graphs. * * @ingroup hybrid */ From 15c5a94e96fa3fb7f2d445d2c5e2fd19781b18fd Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 23:03:07 -0400 Subject: [PATCH 07/19] remove unused CMake variable --- gtsam/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 555e077b8..cb87a6bcd 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -145,10 +145,6 @@ if (GTSAM_USE_EIGEN_MKL) target_include_directories(gtsam PUBLIC ${MKL_INCLUDE_DIR}) endif() -if(GTSAM_USE_TBB) - target_include_directories(gtsam PUBLIC ${TBB_INCLUDE_DIRS}) -endif() - # Add includes for source directories 'BEFORE' boost and any system include # paths so that the compiler uses GTSAM headers in our source directory instead # of any previously installed GTSAM headers. From 066f53775a468a1bbd4b5aefa3f1ebba38022a1f Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 23:04:33 -0400 Subject: [PATCH 08/19] resolve test in testDiscreteMarginals --- gtsam/discrete/tests/testDiscreteMarginals.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/discrete/tests/testDiscreteMarginals.cpp b/gtsam/discrete/tests/testDiscreteMarginals.cpp index ad9b1b191..76bed2fd6 100644 --- a/gtsam/discrete/tests/testDiscreteMarginals.cpp +++ b/gtsam/discrete/tests/testDiscreteMarginals.cpp @@ -121,7 +121,7 @@ TEST_UNSAFE( DiscreteMarginals, truss ) { Clique expected0(std::make_shared((key[0] | key[2], key[4]) = "2/1 2/1 2/1 2/1")); Clique::shared_ptr actual0 = (*bayesTree)[0]; -// EXPECT(assert_equal(expected0, *actual0)); // TODO, correct but fails + EXPECT(assert_equal(expected0, *actual0)); Clique expected1(std::make_shared((key[1] | key[3], key[4]) = "1/2 1/2 1/2 1/2")); Clique::shared_ptr actual1 = (*bayesTree)[1]; From 2a386f8631e38de120d67138e6f2bfeb56d0f644 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 23:04:53 -0400 Subject: [PATCH 09/19] imrpove bounds checks in Chebyshev2 --- gtsam/basis/Chebyshev2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/basis/Chebyshev2.cpp b/gtsam/basis/Chebyshev2.cpp index 44876b6e9..63fca64cc 100644 --- a/gtsam/basis/Chebyshev2.cpp +++ b/gtsam/basis/Chebyshev2.cpp @@ -32,7 +32,7 @@ Weights Chebyshev2::CalculateWeights(size_t N, double x, double a, double b) { const double dj = x - Point(N, j, a, b); // only thing that depends on [a,b] - if (std::abs(dj) < 1e-10) { + if (std::abs(dj) < 1e-12) { // exceptional case: x coincides with a Chebyshev point weights.setZero(); weights(j) = 1; @@ -73,7 +73,7 @@ Weights Chebyshev2::DerivativeWeights(size_t N, double x, double a, double b) { for (size_t j = 0; j < N; j++) { const double dj = x - Point(N, j, a, b); // only thing that depends on [a,b] - if (std::abs(dj) < 1e-10) { + if (std::abs(dj) < 1e-12) { // exceptional case: x coincides with a Chebyshev point weightDerivatives.setZero(); // compute the jth row of the differentiation matrix for this point From b2efd64d2bfd8ab378dc8dd16faff971d82391b4 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 18 Sep 2023 23:05:25 -0400 Subject: [PATCH 10/19] overload the Chebyshev2::Point method to reduce duplication --- gtsam/basis/Chebyshev2.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/gtsam/basis/Chebyshev2.h b/gtsam/basis/Chebyshev2.h index 4c3542d56..55bb39488 100644 --- a/gtsam/basis/Chebyshev2.h +++ b/gtsam/basis/Chebyshev2.h @@ -51,27 +51,30 @@ class GTSAM_EXPORT Chebyshev2 : public Basis { using Parameters = Eigen::Matrix; using DiffMatrix = Eigen::Matrix; - /// Specific Chebyshev point - static double Point(size_t N, int j) { + /** + * @brief Specific Chebyshev point, within [a,b] interval. + * Default interval is [-1, 1] + * + * @param N The degree of the polynomial + * @param j The index of the Chebyshev point + * @param a Lower bound of interval (default: -1) + * @param b Upper bound of interval (default: 1) + * @return double + */ + static double Point(size_t N, int j, double a = -1, double b = 1) { assert(j >= 0 && size_t(j) < N); const double dtheta = M_PI / (N > 1 ? (N - 1) : 1); // We add -PI so that we get values ordered from -1 to +1 - // sin(- M_PI_2 + dtheta*j); also works - return cos(-M_PI + dtheta * j); - } - - /// Specific Chebyshev point, within [a,b] interval - static double Point(size_t N, int j, double a, double b) { - assert(j >= 0 && size_t(j) < N); - const double dtheta = M_PI / (N - 1); - // We add -PI so that we get values ordered from -1 to +1 + // sin(-M_PI_2 + dtheta*j); also works return a + (b - a) * (1. + cos(-M_PI + dtheta * j)) / 2; } /// All Chebyshev points static Vector Points(size_t N) { Vector points(N); - for (size_t j = 0; j < N; j++) points(j) = Point(N, j); + for (size_t j = 0; j < N; j++) { + points(j) = Point(N, j); + } return points; } From c25f8a60b7d4de1cae2fd193a23b71ea7a79631f Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 21 Sep 2023 13:56:20 -0400 Subject: [PATCH 11/19] fix warnings --- gtsam_unstable/partition/FindSeparator-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam_unstable/partition/FindSeparator-inl.h b/gtsam_unstable/partition/FindSeparator-inl.h index e991c5af2..f4718f7a9 100644 --- a/gtsam_unstable/partition/FindSeparator-inl.h +++ b/gtsam_unstable/partition/FindSeparator-inl.h @@ -39,7 +39,7 @@ namespace gtsam { namespace partition { * whether node j is in the left part of the graph, the right part, or the * separator, respectively */ - std::pair separatorMetis(idx_t n, const sharedInts& xadj, + std::pair separatorMetis(idx_t n, const sharedInts& xadj, const sharedInts& adjncy, const sharedInts& adjwgt, bool verbose) { // control parameters @@ -277,7 +277,7 @@ namespace gtsam { namespace partition { //throw runtime_error("separatorPartitionByMetis:stop for debug"); } - if(result.C.size() != sepsize) { + if(result.C.size() != size_t(sepsize)) { std::cout << "total key: " << keys.size() << " result(A,B,C) = " << result.A.size() << ", " << result.B.size() << ", " << result.C.size() << "; sepsize from Metis = " << sepsize << std::endl; From 331ae137af844fee6b7604dbddc0a71764fb2880 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 21 Sep 2023 15:55:58 -0400 Subject: [PATCH 12/19] re-enable debug CI for linux --- .github/workflows/build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 5de09c63f..4502dbe0e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -31,7 +31,7 @@ jobs: ubuntu-22.04-clang-14, ] - build_type: [Release] + build_type: [Debug, Release] build_unstable: [ON] include: - name: ubuntu-20.04-gcc-9 From aebff10f05dcad3e9b03d1a828fc1c86ac7c95f3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 26 Sep 2023 17:24:40 -0400 Subject: [PATCH 13/19] wrap print for Sim2 and Sim3 --- gtsam/geometry/geometry.i | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtsam/geometry/geometry.i b/gtsam/geometry/geometry.i index 35c470eca..615e0eced 100644 --- a/gtsam/geometry/geometry.i +++ b/gtsam/geometry/geometry.i @@ -1082,6 +1082,7 @@ class Similarity2 { // Standard Interface bool equals(const gtsam::Similarity2& sim, double tol) const; + void print(const std::string& s) const; Matrix matrix() const; gtsam::Rot2& rotation(); gtsam::Point2& translation(); @@ -1105,6 +1106,7 @@ class Similarity3 { // Standard Interface bool equals(const gtsam::Similarity3& sim, double tol) const; + void print(const std::string& s) const; Matrix matrix() const; gtsam::Rot3& rotation(); gtsam::Point3& translation(); From e096af463d18f9ca7516a26fa9d9fd5171d268a5 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 26 Sep 2023 17:51:52 -0400 Subject: [PATCH 14/19] default value for string arg in print --- gtsam/geometry/Similarity2.h | 2 +- gtsam/geometry/Similarity3.h | 2 +- gtsam/geometry/geometry.i | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/geometry/Similarity2.h b/gtsam/geometry/Similarity2.h index 3e04aa3a1..6bec716ea 100644 --- a/gtsam/geometry/Similarity2.h +++ b/gtsam/geometry/Similarity2.h @@ -74,7 +74,7 @@ class GTSAM_EXPORT Similarity2 : public LieGroup { bool operator==(const Similarity2& other) const; /// Print with optional string - void print(const std::string& s) const; + void print(const std::string& s = "") const; GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os, const Similarity2& p); diff --git a/gtsam/geometry/Similarity3.h b/gtsam/geometry/Similarity3.h index 69b401620..89b2e3e34 100644 --- a/gtsam/geometry/Similarity3.h +++ b/gtsam/geometry/Similarity3.h @@ -75,7 +75,7 @@ class GTSAM_EXPORT Similarity3 : public LieGroup { bool operator==(const Similarity3& other) const; /// Print with optional string - void print(const std::string& s) const; + void print(const std::string& s = "") const; GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os, const Similarity3& p); diff --git a/gtsam/geometry/geometry.i b/gtsam/geometry/geometry.i index 615e0eced..01161817b 100644 --- a/gtsam/geometry/geometry.i +++ b/gtsam/geometry/geometry.i @@ -1082,7 +1082,7 @@ class Similarity2 { // Standard Interface bool equals(const gtsam::Similarity2& sim, double tol) const; - void print(const std::string& s) const; + void print(const std::string& s = "") const; Matrix matrix() const; gtsam::Rot2& rotation(); gtsam::Point2& translation(); @@ -1106,7 +1106,7 @@ class Similarity3 { // Standard Interface bool equals(const gtsam::Similarity3& sim, double tol) const; - void print(const std::string& s) const; + void print(const std::string& s = "") const; Matrix matrix() const; gtsam::Rot3& rotation(); gtsam::Point3& translation(); From 4de8f149f82bb5a2b8d3ffa9b97cb11f0f94a076 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 28 Sep 2023 07:18:11 -0400 Subject: [PATCH 15/19] fix docstring --- python/gtsam/tests/test_backwards_compatibility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/gtsam/tests/test_backwards_compatibility.py b/python/gtsam/tests/test_backwards_compatibility.py index 414b65e8c..ca96cdf57 100644 --- a/python/gtsam/tests/test_backwards_compatibility.py +++ b/python/gtsam/tests/test_backwards_compatibility.py @@ -29,7 +29,7 @@ UPRIGHT = Rot3.Ypr(-np.pi / 2, 0.0, -np.pi / 2) class TestBackwardsCompatibility(GtsamTestCase): - """Tests for the backwards compatibility for the Python wrapper.""" + """Tests for backwards compatibility of the Python wrapper.""" def setUp(self): """Setup test fixtures""" From 79983285835c6b2f21ee5f7bd62026aba76825e7 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 5 Oct 2023 09:59:04 -0400 Subject: [PATCH 16/19] use Pose3Pairs for Similarity3::Align --- gtsam/geometry/Similarity3.cpp | 2 +- gtsam/geometry/Similarity3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/geometry/Similarity3.cpp b/gtsam/geometry/Similarity3.cpp index a9a369e44..cf2360b08 100644 --- a/gtsam/geometry/Similarity3.cpp +++ b/gtsam/geometry/Similarity3.cpp @@ -171,7 +171,7 @@ Similarity3 Similarity3::Align(const Point3Pairs &abPointPairs) { return internal::align(d_abPointPairs, aRb, centroids); } -Similarity3 Similarity3::Align(const vector &abPosePairs) { +Similarity3 Similarity3::Align(const Pose3Pairs &abPosePairs) { const size_t n = abPosePairs.size(); if (n < 2) throw std::runtime_error("input should have at least 2 pairs of poses"); diff --git a/gtsam/geometry/Similarity3.h b/gtsam/geometry/Similarity3.h index 89b2e3e34..cd4af89bc 100644 --- a/gtsam/geometry/Similarity3.h +++ b/gtsam/geometry/Similarity3.h @@ -133,7 +133,7 @@ class GTSAM_EXPORT Similarity3 : public LieGroup { * computed using the algorithm described here: * http://www5.informatik.uni-erlangen.de/Forschung/Publikationen/2005/Zinsser05-PSR.pdf */ - static Similarity3 Align(const std::vector& abPosePairs); + static Similarity3 Align(const Pose3Pairs& abPosePairs); /// @} /// @name Lie Group From 7e1a683e34c853593f9bdacd1f10d799938f458d Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 13 Oct 2023 15:36:45 -0400 Subject: [PATCH 17/19] Revert "imrpove bounds checks in Chebyshev2" This reverts commit 2a386f8631e38de120d67138e6f2bfeb56d0f644. --- gtsam/basis/Chebyshev2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/basis/Chebyshev2.cpp b/gtsam/basis/Chebyshev2.cpp index 63fca64cc..44876b6e9 100644 --- a/gtsam/basis/Chebyshev2.cpp +++ b/gtsam/basis/Chebyshev2.cpp @@ -32,7 +32,7 @@ Weights Chebyshev2::CalculateWeights(size_t N, double x, double a, double b) { const double dj = x - Point(N, j, a, b); // only thing that depends on [a,b] - if (std::abs(dj) < 1e-12) { + if (std::abs(dj) < 1e-10) { // exceptional case: x coincides with a Chebyshev point weights.setZero(); weights(j) = 1; @@ -73,7 +73,7 @@ Weights Chebyshev2::DerivativeWeights(size_t N, double x, double a, double b) { for (size_t j = 0; j < N; j++) { const double dj = x - Point(N, j, a, b); // only thing that depends on [a,b] - if (std::abs(dj) < 1e-12) { + if (std::abs(dj) < 1e-10) { // exceptional case: x coincides with a Chebyshev point weightDerivatives.setZero(); // compute the jth row of the differentiation matrix for this point From 1b909d2eea35f985ce3d127a18d2175ff5791b21 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 13 Oct 2023 15:36:55 -0400 Subject: [PATCH 18/19] Revert "overload the Chebyshev2::Point method to reduce duplication" This reverts commit b2efd64d2bfd8ab378dc8dd16faff971d82391b4. --- gtsam/basis/Chebyshev2.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/gtsam/basis/Chebyshev2.h b/gtsam/basis/Chebyshev2.h index 55bb39488..4c3542d56 100644 --- a/gtsam/basis/Chebyshev2.h +++ b/gtsam/basis/Chebyshev2.h @@ -51,30 +51,27 @@ class GTSAM_EXPORT Chebyshev2 : public Basis { using Parameters = Eigen::Matrix; using DiffMatrix = Eigen::Matrix; - /** - * @brief Specific Chebyshev point, within [a,b] interval. - * Default interval is [-1, 1] - * - * @param N The degree of the polynomial - * @param j The index of the Chebyshev point - * @param a Lower bound of interval (default: -1) - * @param b Upper bound of interval (default: 1) - * @return double - */ - static double Point(size_t N, int j, double a = -1, double b = 1) { + /// Specific Chebyshev point + static double Point(size_t N, int j) { assert(j >= 0 && size_t(j) < N); const double dtheta = M_PI / (N > 1 ? (N - 1) : 1); // We add -PI so that we get values ordered from -1 to +1 - // sin(-M_PI_2 + dtheta*j); also works + // sin(- M_PI_2 + dtheta*j); also works + return cos(-M_PI + dtheta * j); + } + + /// Specific Chebyshev point, within [a,b] interval + static double Point(size_t N, int j, double a, double b) { + assert(j >= 0 && size_t(j) < N); + const double dtheta = M_PI / (N - 1); + // We add -PI so that we get values ordered from -1 to +1 return a + (b - a) * (1. + cos(-M_PI + dtheta * j)) / 2; } /// All Chebyshev points static Vector Points(size_t N) { Vector points(N); - for (size_t j = 0; j < N; j++) { - points(j) = Point(N, j); - } + for (size_t j = 0; j < N; j++) points(j) = Point(N, j); return points; } From 320ac1bc6afb2006e7ca4b911ad8f13586e165bd Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 17 Oct 2023 15:32:56 -0400 Subject: [PATCH 19/19] Revert "re-enable debug CI for linux" This reverts commit 331ae137af844fee6b7604dbddc0a71764fb2880. --- .github/workflows/build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 4502dbe0e..5de09c63f 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -31,7 +31,7 @@ jobs: ubuntu-22.04-clang-14, ] - build_type: [Debug, Release] + build_type: [Release] build_unstable: [ON] include: - name: ubuntu-20.04-gcc-9