diff --git a/gtsam/linear/NoiseModel.cpp b/gtsam/linear/NoiseModel.cpp index a1f8c7570..5734c6c2e 100644 --- a/gtsam/linear/NoiseModel.cpp +++ b/gtsam/linear/NoiseModel.cpp @@ -490,6 +490,12 @@ void Base::reweight(Matrix &A1, Matrix &A2, Matrix &A3, Vector &error) const { } } +void Null::print(const std::string &s) const +{ cout << s << ": null ()" << endl; } + +Null::shared_ptr Null::Create() +{ return shared_ptr(new Null()); } + Fair::Fair(const double c, const ReweightScheme reweight) : Base(reweight), c_(c) { if ( c_ <= 0 ) { diff --git a/gtsam/linear/NoiseModel.h b/gtsam/linear/NoiseModel.h index f512035a1..14886d64d 100644 --- a/gtsam/linear/NoiseModel.h +++ b/gtsam/linear/NoiseModel.h @@ -514,7 +514,7 @@ namespace gtsam { ReweightScheme reweight_; public: - Base():reweight_(Block) {} + Base(): reweight_(Block) {} Base(const ReweightScheme reweight):reweight_(reweight) {} virtual ~Base() {} virtual double weight(const double &error) const = 0; @@ -526,6 +526,17 @@ namespace gtsam { void reweight(Matrix &A1, Matrix &A2, Matrix &A3, Vector &error) const; }; + class Null : public Base { + public: + typedef boost::shared_ptr shared_ptr; + Null(const ReweightScheme reweight = Block) : Base(reweight) {} + virtual ~Null() {} + virtual double weight(const double &error) const { return 1.0; } + virtual void print(const std::string &s) const ; + virtual bool equals(const Base& expected, const double tol=1e-8) const { return true; } + static shared_ptr Create() ; + }; + class Fair : public Base { public: typedef boost::shared_ptr shared_ptr;