25 #include <gtsam/dllexport.h>
27 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
28 #include <boost/serialization/extended_type_info.hpp>
29 #include <boost/serialization/nvp.hpp>
30 #include <boost/serialization/version.hpp>
31 #include <boost/serialization/optional.hpp>
32 #include <boost/serialization/shared_ptr.hpp>
33 #include <boost/serialization/singleton.hpp>
37 namespace noiseModel {
58 namespace mEstimator {
109 virtual double weight(
double distance)
const = 0;
111 virtual void print(
const std::string &
s)
const = 0;
126 void reweight(std::vector<Matrix> &
A,
Vector &
error)
const;
132 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
134 friend class boost::serialization::access;
135 template <
class ARCHIVE>
136 void serialize(ARCHIVE &ar,
const unsigned int ) {
137 ar &BOOST_SERIALIZATION_NVP(reweight_);
157 double weight(
double )
const override {
return 1.0; }
159 void print(
const std::string &
s)
const override;
160 bool equals(
const Base & ,
double )
const override {
return true; }
161 static shared_ptr Create();
164 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
166 friend class boost::serialization::access;
167 template <
class ARCHIVE>
168 void serialize(ARCHIVE &ar,
const unsigned int ) {
169 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
190 double weight(
double distance)
const override;
191 double loss(
double distance)
const override;
192 void print(
const std::string &
s)
const override;
198 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
200 friend class boost::serialization::access;
201 template <
class ARCHIVE>
202 void serialize(ARCHIVE &ar,
const unsigned int ) {
203 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
204 ar &BOOST_SERIALIZATION_NVP(c_);
225 double weight(
double distance)
const override;
226 double loss(
double distance)
const override;
227 void print(
const std::string &
s)
const override;
233 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
235 friend class boost::serialization::access;
236 template <
class ARCHIVE>
237 void serialize(ARCHIVE &ar,
const unsigned int ) {
238 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
239 ar &BOOST_SERIALIZATION_NVP(k_);
265 double weight(
double distance)
const override;
266 double loss(
double distance)
const override;
267 void print(
const std::string &
s)
const override;
273 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
275 friend class boost::serialization::access;
276 template <
class ARCHIVE>
277 void serialize(ARCHIVE &ar,
const unsigned int ) {
278 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
279 ar &BOOST_SERIALIZATION_NVP(k_);
280 ar &BOOST_SERIALIZATION_NVP(ksquared_);
301 double weight(
double distance)
const override;
302 double loss(
double distance)
const override;
303 void print(
const std::string &
s)
const override;
309 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
311 friend class boost::serialization::access;
312 template <
class ARCHIVE>
313 void serialize(ARCHIVE &ar,
const unsigned int ) {
314 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
315 ar &BOOST_SERIALIZATION_NVP(c_);
336 double weight(
double distance)
const override;
337 double loss(
double distance)
const override;
338 void print(
const std::string &
s)
const override;
344 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
346 friend class boost::serialization::access;
347 template <
class ARCHIVE>
348 void serialize(ARCHIVE &ar,
const unsigned int ) {
349 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
350 ar &BOOST_SERIALIZATION_NVP(c_);
351 ar &BOOST_SERIALIZATION_NVP(csquared_);
372 double weight(
double distance)
const override;
373 double loss(
double distance)
const override;
374 void print(
const std::string &
s)
const override;
376 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
383 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
385 friend class boost::serialization::access;
386 template <
class ARCHIVE>
387 void serialize(ARCHIVE &ar,
const unsigned int ) {
388 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
389 ar &BOOST_SERIALIZATION_NVP(c_);
412 double weight(
double distance)
const override;
413 double loss(
double distance)
const override;
414 void print(
const std::string &
s)
const override;
416 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
423 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
425 friend class boost::serialization::access;
426 template <
class ARCHIVE>
427 void serialize(ARCHIVE &ar,
const unsigned int ) {
428 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
429 ar &BOOST_SERIALIZATION_NVP(c_);
455 double weight(
double distance)
const override;
456 double loss(
double distance)
const override;
457 void print(
const std::string &
s)
const override;
463 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
465 friend class boost::serialization::access;
466 template <
class ARCHIVE>
467 void serialize(ARCHIVE &ar,
const unsigned int ) {
468 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
469 ar &BOOST_SERIALIZATION_NVP(k_);
491 double weight(
double distance)
const override;
492 double loss(
double distance)
const override;
493 void print(
const std::string &
s)
const override;
499 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
501 friend class boost::serialization::access;
502 template <
class ARCHIVE>
503 void serialize(ARCHIVE &ar,
const unsigned int ) {
504 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
505 ar &BOOST_SERIALIZATION_NVP(c_);
527 double weight(
double distance)
const override;
528 double loss(
double distance)
const override;
529 void print(
const std::string &
s)
const override;
535 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
537 friend class boost::serialization::access;
538 template <
class ARCHIVE>
539 void serialize(ARCHIVE &ar,
const unsigned int ) {
540 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
541 ar &BOOST_SERIALIZATION_NVP(k_);
542 ar &BOOST_SERIALIZATION_NVP(ksquared_);
565 double weight(
double distance)
const override;
566 double loss(
double distance)
const override;
567 void print(
const std::string &
s)
const override;
569 static shared_ptr Create(std::function<
double(
double)> weight, std::function<
double(
double)> loss,
571 inline std::string&
name() {
return name_; }
577 inline Custom() =
default;
580 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
582 friend class boost::serialization::access;
583 template <
class ARCHIVE>
584 void serialize(ARCHIVE &ar,
const unsigned int ) {
585 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
586 ar &BOOST_SERIALIZATION_NVP(name_);