Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/clang warnings #146

Merged
merged 2 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions gtsam/linear/GaussianBayesNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lambdas! 👍

} 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;
Expand Down
4 changes: 2 additions & 2 deletions gtsam/linear/GaussianBayesTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions gtsam/linear/NoiseModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ namespace gtsam {
Fair(double c = 1.3998, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double c, const ReweightScheme reweight = Block) ;

private:
Expand All @@ -777,8 +777,8 @@ namespace gtsam {
Huber(double k = 1.345, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

private:
Expand Down Expand Up @@ -806,8 +806,8 @@ namespace gtsam {
Cauchy(double k = 0.1, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

private:
Expand All @@ -831,8 +831,8 @@ namespace gtsam {
Tukey(double c = 4.6851, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

private:
Expand All @@ -856,8 +856,8 @@ namespace gtsam {
Welsch(double c = 2.9846, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

private:
Expand Down Expand Up @@ -892,8 +892,8 @@ namespace gtsam {
~GemanMcClure() {}
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol=1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

protected:
Expand Down Expand Up @@ -922,8 +922,8 @@ namespace gtsam {
~DCS() {}
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;

protected:
Expand Down Expand Up @@ -954,8 +954,8 @@ namespace gtsam {
L2WithDeadZone(double k = 1.0, const ReweightScheme reweight = Block);
double weight(double error) const override;
double residual(double error) const override;
void print(const std::string &s) const;
bool equals(const Base& expected, double tol=1e-8) const;
void print(const std::string &s) const override;
bool equals(const Base& expected, double tol = 1e-8) const override;
static shared_ptr Create(double k, const ReweightScheme reweight = Block);

private:
Expand Down