24 #include <gtsam/dllexport.h> 26 #include <boost/serialization/extended_type_info.hpp> 27 #include <boost/serialization/nvp.hpp> 28 #include <boost/serialization/version.hpp> 29 #include <boost/serialization/optional.hpp> 30 #include <boost/serialization/shared_ptr.hpp> 31 #include <boost/serialization/singleton.hpp> 34 namespace noiseModel {
55 namespace mEstimator {
84 virtual double loss(
double distance)
const {
return 0; };
94 virtual double weight(
double distance)
const = 0;
96 virtual void print(
const std::string &
s)
const = 0;
107 return weight(error).cwiseSqrt();
112 void reweight(
Vector &error)
const;
113 void reweight(std::vector<Matrix> &
A,
Vector &error)
const;
120 friend class boost::serialization::access;
121 template <
class ARCHIVE>
123 ar &BOOST_SERIALIZATION_NVP(reweight_);
134 double weight(
double )
const override {
return 1.0; }
135 double loss(
double distance)
const override {
return 0.5 * distance * distance; }
136 void print(
const std::string &
s)
const override;
137 bool equals(
const Base & ,
double )
const override {
return true; }
138 static shared_ptr Create();
142 friend class boost::serialization::access;
143 template <
class ARCHIVE>
145 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
158 double weight(
double distance)
const override;
159 double loss(
double distance)
const override;
160 void print(
const std::string &
s)
const override;
162 static shared_ptr Create(
double c,
const ReweightScheme reweight = Block);
166 friend class boost::serialization::access;
167 template <
class ARCHIVE>
169 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
170 ar &BOOST_SERIALIZATION_NVP(c_);
183 double weight(
double distance)
const override;
184 double loss(
double distance)
const override;
185 void print(
const std::string &
s)
const override;
187 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
191 friend class boost::serialization::access;
192 template <
class ARCHIVE>
194 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
195 ar &BOOST_SERIALIZATION_NVP(k_);
213 double weight(
double distance)
const override;
214 double loss(
double distance)
const override;
215 void print(
const std::string &
s)
const override;
217 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
221 friend class boost::serialization::access;
222 template <
class ARCHIVE>
224 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
225 ar &BOOST_SERIALIZATION_NVP(k_);
238 double weight(
double distance)
const override;
239 double loss(
double distance)
const override;
240 void print(
const std::string &
s)
const override;
242 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
246 friend class boost::serialization::access;
247 template <
class ARCHIVE>
249 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
250 ar &BOOST_SERIALIZATION_NVP(c_);
263 double weight(
double distance)
const override;
264 double loss(
double distance)
const override;
265 void print(
const std::string &
s)
const override;
267 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
271 friend class boost::serialization::access;
272 template <
class ARCHIVE>
274 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
275 ar &BOOST_SERIALIZATION_NVP(c_);
291 double weight(
double distance)
const override;
292 double loss(
double distance)
const override;
293 void print(
const std::string &
s)
const override;
295 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
302 friend class boost::serialization::access;
303 template <
class ARCHIVE>
305 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
306 ar &BOOST_SERIALIZATION_NVP(c_);
321 double weight(
double distance)
const override;
322 double loss(
double distance)
const override;
323 void print(
const std::string &
s)
const override;
325 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
332 friend class boost::serialization::access;
333 template <
class ARCHIVE>
335 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
336 ar &BOOST_SERIALIZATION_NVP(c_);
354 double weight(
double distance)
const override;
355 double loss(
double distance)
const override;
356 void print(
const std::string &
s)
const override;
358 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
362 friend class boost::serialization::access;
363 template <
class ARCHIVE>
365 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
366 ar &BOOST_SERIALIZATION_NVP(k_);
void print(const Matrix &A, const string &s, ostream &stream)
boost::shared_ptr< Huber > shared_ptr
void serialize(ARCHIVE &ar, const unsigned int)
void serialize(ARCHIVE &ar, const unsigned int)
void serialize(ARCHIVE &ar, const unsigned int)
void serialize(ARCHIVE &ar, const unsigned int)
Concept check for values that can be used in unit tests.
void serialize(ARCHIVE &ar, const unsigned int)
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Tukey implements the "Tukey" robust error model (Zhang97ivc)
Huber implements the "Huber" robust error model (Zhang97ivc)
void serialize(ARCHIVE &ar, const unsigned int)
bool equals(const Base &, double) const override
boost::shared_ptr< L2WithDeadZone > shared_ptr
Fair implements the "Fair" robust error model (Zhang97ivc)
Null class should behave as Gaussian.
Vector sqrtWeight(const Vector &error) const
Base(const ReweightScheme reweight=Block)
boost::shared_ptr< Null > shared_ptr
boost::shared_ptr< GemanMcClure > shared_ptr
void serialize(ARCHIVE &ar, const unsigned int)
virtual double loss(double distance) const
double sqrtWeight(double distance) const
void serialize(ARCHIVE &ar, const unsigned int)
boost::shared_ptr< Tukey > shared_ptr
Array< double, 1, 3 > e(1./3., 0.5, 2.)
boost::shared_ptr< Base > shared_ptr
boost::shared_ptr< Cauchy > shared_ptr
double weight(double) const override
boost::shared_ptr< DCS > shared_ptr
double loss(double distance) const override
void serialize(ARCHIVE &ar, const unsigned int)
boost::shared_ptr< Fair > shared_ptr
boost::shared_ptr< Welsch > shared_ptr
Welsch implements the "Welsch" robust error model (Zhang97ivc)
Null(const ReweightScheme reweight=Block)
void serialize(ARCHIVE &ar, const unsigned int)