commit
6ef7b48d68
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -752,8 +752,8 @@ namespace gtsam {
|
||||||
Fair(double c = 1.3998, const ReweightScheme reweight = Block);
|
Fair(double c = 1.3998, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double c, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double c, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -777,8 +777,8 @@ namespace gtsam {
|
||||||
Huber(double k = 1.345, const ReweightScheme reweight = Block);
|
Huber(double k = 1.345, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -806,8 +806,8 @@ namespace gtsam {
|
||||||
Cauchy(double k = 0.1, const ReweightScheme reweight = Block);
|
Cauchy(double k = 0.1, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -831,8 +831,8 @@ namespace gtsam {
|
||||||
Tukey(double c = 4.6851, const ReweightScheme reweight = Block);
|
Tukey(double c = 4.6851, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -856,8 +856,8 @@ namespace gtsam {
|
||||||
Welsch(double c = 2.9846, const ReweightScheme reweight = Block);
|
Welsch(double c = 2.9846, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -892,8 +892,8 @@ namespace gtsam {
|
||||||
~GemanMcClure() {}
|
~GemanMcClure() {}
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol=1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -922,8 +922,8 @@ namespace gtsam {
|
||||||
~DCS() {}
|
~DCS() {}
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -954,8 +954,8 @@ namespace gtsam {
|
||||||
L2WithDeadZone(double k = 1.0, const ReweightScheme reweight = Block);
|
L2WithDeadZone(double k = 1.0, const ReweightScheme reweight = Block);
|
||||||
double weight(double error) const override;
|
double weight(double error) const override;
|
||||||
double residual(double error) const override;
|
double residual(double error) const override;
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const override;
|
||||||
bool equals(const Base& expected, double tol=1e-8) const;
|
bool equals(const Base& expected, double tol = 1e-8) const override;
|
||||||
static shared_ptr Create(double k, const ReweightScheme reweight = Block);
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue