Replace deprecated `ptr_fun` with lambda expression

release/4.3a0
Frank Dellaert 2019-10-12 14:14:10 -04:00
parent f44ba996e0
commit 4a1491876d
2 changed files with 8 additions and 8 deletions

View File

@ -187,16 +187,16 @@ namespace gtsam {
} }
/* ************************************************************************* */ /* ************************************************************************* */
double GaussianBayesNet::logDeterminant() const double GaussianBayesNet::logDeterminant() const {
{
double logDet = 0.0; double logDet = 0.0;
for(const sharedConditional& cg: *this) { for (const sharedConditional& cg : *this) {
if(cg->get_model()) { if (cg->get_model()) {
Vector diag = cg->R().diagonal(); Vector diag = cg->R().diagonal();
cg->get_model()->whitenInPlace(diag); cg->get_model()->whitenInPlace(diag);
logDet += diag.unaryExpr(ptr_fun<double,double>(log)).sum(); logDet += diag.unaryExpr([](double x) { return log(x); }).sum();
} else { } 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; return logDet;

View File

@ -40,11 +40,11 @@ namespace gtsam {
parentSum += clique->conditional() parentSum += clique->conditional()
->R() ->R()
.diagonal() .diagonal()
.unaryExpr(std::ptr_fun<double, double>(log)) .unaryExpr([](double x) { return log(x); })
.sum(); .sum();
return 0; return 0;
} }
} } // namespace internal
/* ************************************************************************* */ /* ************************************************************************* */
bool GaussianBayesTree::equals(const This& other, double tol) const bool GaussianBayesTree::equals(const This& other, double tol) const