From 4a1491876d5a96ea791c0e17204ace05f6eb206a Mon Sep 17 00:00:00 2001 From: Frank Dellaert 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 bc96452b9..e9938ceb6 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(log)).sum(); + logDet += diag.unaryExpr([](double x) { return log(x); }).sum(); } else { - logDet += cg->R().diagonal().unaryExpr(ptr_fun(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 8d0fafb61..13c19bce6 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(log)) + .unaryExpr([](double x) { return log(x); }) .sum(); return 0; } - } + } // namespace internal /* ************************************************************************* */ bool GaussianBayesTree::equals(const This& other, double tol) const