-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gtsam: backport a patch for C++17 compatibility
- Loading branch information
Martin Valgur
committed
Jun 15, 2023
1 parent
b0d6a4a
commit 3cdaad6
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
55 changes: 55 additions & 0 deletions
55
recipes/gtsam/all/patches/4.0.2-0005-replace-ptr_fun.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
From 4a1491876d5a96ea791c0e17204ace05f6eb206a Mon Sep 17 00:00:00 2001 | ||
From: Frank Dellaert <dellaert@gmail.com> | ||
Date: Sat, 12 Oct 2019 14:14:10 -0400 | ||
Subject: [PATCH] Replace deprecated `ptr_fun` with lambda expression | ||
|
||
--- | ||
gtsam/linear/GaussianBayesNet.cpp | 12 ++++++------ | ||
gtsam/linear/GaussianBayesTree.cpp | 4 ++-- | ||
2 files changed, 8 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/gtsam/linear/GaussianBayesNet.cpp b/gtsam/linear/GaussianBayesNet.cpp | ||
index bc96452b92..e9938ceb65 100644 | ||
--- a/gtsam/linear/GaussianBayesNet.cpp | ||
+++ b/gtsam/linear/GaussianBayesNet.cpp | ||
@@ -187,16 +187,16 @@ namespace gtsam { | ||
} | ||
|
||
/* ************************************************************************* */ | ||
- double GaussianBayesNet::logDeterminant() const | ||
- { | ||
+ double GaussianBayesNet::logDeterminant() const { | ||
double logDet = 0.0; | ||
- for(const sharedConditional& cg: *this) { | ||
- if(cg->get_model()) { | ||
+ for (const sharedConditional& cg : *this) { | ||
+ if (cg->get_model()) { | ||
Vector diag = cg->R().diagonal(); | ||
cg->get_model()->whitenInPlace(diag); | ||
- logDet += diag.unaryExpr(ptr_fun<double,double>(log)).sum(); | ||
+ logDet += diag.unaryExpr([](double x) { return log(x); }).sum(); | ||
} else { | ||
- logDet += cg->R().diagonal().unaryExpr(ptr_fun<double,double>(log)).sum(); | ||
+ logDet += | ||
+ cg->R().diagonal().unaryExpr([](double x) { return log(x); }).sum(); | ||
} | ||
} | ||
return logDet; | ||
diff --git a/gtsam/linear/GaussianBayesTree.cpp b/gtsam/linear/GaussianBayesTree.cpp | ||
index 8d0fafb618..13c19bce65 100644 | ||
--- a/gtsam/linear/GaussianBayesTree.cpp | ||
+++ b/gtsam/linear/GaussianBayesTree.cpp | ||
@@ -40,11 +40,11 @@ namespace gtsam { | ||
parentSum += clique->conditional() | ||
->R() | ||
.diagonal() | ||
- .unaryExpr(std::ptr_fun<double, double>(log)) | ||
+ .unaryExpr([](double x) { return log(x); }) | ||
.sum(); | ||
return 0; | ||
} | ||
- } | ||
+ } // namespace internal | ||
|
||
/* ************************************************************************* */ | ||
bool GaussianBayesTree::equals(const This& other, double tol) const |