Added old code back wrapped in deprecated flag
parent
87c336fce3
commit
f72322c4a4
|
@ -826,6 +826,24 @@ Welsch::shared_ptr Welsch::Create(double c, const ReweightScheme reweight) {
|
||||||
return shared_ptr(new Welsch(c, reweight));
|
return shared_ptr(new Welsch(c, reweight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
|
||||||
|
Welsh::Welsh(double c, const ReweightScheme reweight) : Base(reweight), c_(c), csquared_(c * c) {}
|
||||||
|
|
||||||
|
void Welsh::print(const std::string &s="") const {
|
||||||
|
std::cout << s << ": Welsh (" << c_ << ")" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Welsh::equals(const Base &expected, double tol) const {
|
||||||
|
const Welsh* p = dynamic_cast<const Welsh*>(&expected);
|
||||||
|
if (p == NULL) return false;
|
||||||
|
return std::abs(c_ - p->c_) < tol;
|
||||||
|
}
|
||||||
|
|
||||||
|
Welsh::shared_ptr Welsh::Create(double c, const ReweightScheme reweight) {
|
||||||
|
return shared_ptr(new Welsh(c, reweight));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// GemanMcClure
|
// GemanMcClure
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -878,6 +878,38 @@ namespace gtsam {
|
||||||
ar & BOOST_SERIALIZATION_NVP(c_);
|
ar & BOOST_SERIALIZATION_NVP(c_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
|
||||||
|
/// @name Deprecated
|
||||||
|
/// @{
|
||||||
|
// Welsh implements the "Welsch" robust error model (Zhang97ivc)
|
||||||
|
// This was misspelled in previous versions of gtsam and should be
|
||||||
|
// removed in the future.
|
||||||
|
class GTSAM_EXPORT Welsh : public Base {
|
||||||
|
protected:
|
||||||
|
double c_, csquared_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef boost::shared_ptr<Welsh> shared_ptr;
|
||||||
|
|
||||||
|
Welsh(double c = 2.9846, const ReweightScheme reweight = Block);
|
||||||
|
double weight(double error) const {
|
||||||
|
double xc2 = (error*error)/csquared_;
|
||||||
|
return std::exp(-xc2);
|
||||||
|
}
|
||||||
|
void print(const std::string &s) const;
|
||||||
|
bool equals(const Base& expected, double tol=1e-8) const;
|
||||||
|
static shared_ptr Create(double k, const ReweightScheme reweight = Block) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Serialization function */
|
||||||
|
friend class boost::serialization::access;
|
||||||
|
template<class ARCHIVE>
|
||||||
|
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
|
||||||
|
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
|
||||||
|
ar & BOOST_SERIALIZATION_NVP(c_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/// GemanMcClure implements the "Geman-McClure" robust error model
|
/// GemanMcClure implements the "Geman-McClure" robust error model
|
||||||
/// (Zhang97ivc).
|
/// (Zhang97ivc).
|
||||||
|
|
Loading…
Reference in New Issue