23 #include <gtsam/dllexport.h> 25 #include <boost/serialization/nvp.hpp> 26 #include <boost/serialization/extended_type_info.hpp> 27 #include <boost/serialization/singleton.hpp> 28 #include <boost/serialization/shared_ptr.hpp> 29 #include <boost/serialization/optional.hpp> 34 namespace noiseModel {
54 typedef boost::shared_ptr<Base> shared_ptr;
63 Base(
size_t dim = 1):dim_(dim) {}
70 virtual bool isUnit()
const {
return false; }
73 inline size_t dim()
const {
return dim_;}
75 virtual void print(
const std::string& name =
"")
const = 0;
77 virtual bool equals(
const Base& expected,
double tol=1e-9)
const = 0;
80 virtual Vector sigmas()
const;
83 virtual Vector whiten(
const Vector& v)
const = 0;
86 virtual Matrix Whiten(
const Matrix& H)
const = 0;
89 virtual Vector unwhiten(
const Vector& v)
const = 0;
91 virtual double distance(
const Vector& v)
const = 0;
93 virtual void WhitenSystem(std::vector<Matrix>& A, Vector& b)
const = 0;
94 virtual void WhitenSystem(Matrix& A, Vector& b)
const = 0;
95 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Vector& b)
const = 0;
96 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Matrix& A3, Vector& b)
const = 0;
120 friend class boost::serialization::access;
121 template<
class ARCHIVE>
122 void serialize(ARCHIVE & ar,
const unsigned int ) {
123 ar & BOOST_SERIALIZATION_NVP(dim_);
153 const Matrix& thisR()
const {
155 if (!sqrt_information_)
throw std::runtime_error(
"Gaussian: has no R matrix");
156 return *sqrt_information_;
162 Gaussian(
size_t dim = 1,
const boost::optional<Matrix>& sqrt_information = boost::none) :
163 Base(dim), sqrt_information_(sqrt_information) {
168 typedef boost::shared_ptr<Gaussian> shared_ptr;
177 static shared_ptr SqrtInformation(
const Matrix& R,
bool smart =
true);
184 static shared_ptr Information(
const Matrix& M,
bool smart =
true);
191 static shared_ptr Covariance(
const Matrix& covariance,
bool smart =
true);
193 virtual void print(
const std::string& name)
const;
194 virtual bool equals(
const Base& expected,
double tol=1e-9)
const;
195 virtual Vector sigmas()
const;
196 virtual Vector whiten(
const Vector& v)
const;
197 virtual Vector unwhiten(
const Vector& v)
const;
202 virtual double Mahalanobis(
const Vector& v)
const;
204 inline virtual double distance(
const Vector& v)
const {
205 return Mahalanobis(v);
212 virtual Matrix Whiten(
const Matrix& H)
const;
217 virtual void WhitenInPlace(Matrix& H)
const;
222 virtual void WhitenInPlace(Eigen::Block<Matrix> H)
const;
227 virtual void WhitenSystem(std::vector<Matrix>& A, Vector& b)
const;
228 virtual void WhitenSystem(Matrix& A, Vector& b)
const;
229 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Vector& b)
const;
230 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Matrix& A3, Vector& b)
const;
241 virtual boost::shared_ptr<Diagonal> QR(Matrix& Ab)
const;
244 virtual Matrix
R()
const {
return thisR();}
247 virtual Matrix
information()
const {
return R().transpose() * R(); }
250 virtual Matrix
covariance()
const {
return information().inverse(); }
254 friend class boost::serialization::access;
255 template<
class ARCHIVE>
256 void serialize(ARCHIVE & ar,
const unsigned int ) {
257 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
258 ar & BOOST_SERIALIZATION_NVP(sqrt_information_);
289 typedef boost::shared_ptr<Diagonal> shared_ptr;
297 static shared_ptr Sigmas(
const Vector& sigmas,
bool smart =
true);
305 static shared_ptr Variances(
const Vector& variances,
bool smart =
true);
311 static shared_ptr
Precisions(
const Vector& precisions,
bool smart =
true) {
312 return Variances(precisions.array().inverse(), smart);
315 virtual void print(
const std::string& name)
const;
316 virtual Vector
sigmas()
const {
return sigmas_; }
317 virtual Vector whiten(
const Vector& v)
const;
318 virtual Vector unwhiten(
const Vector& v)
const;
319 virtual Matrix Whiten(
const Matrix& H)
const;
320 virtual void WhitenInPlace(Matrix& H)
const;
321 virtual void WhitenInPlace(Eigen::Block<Matrix> H)
const;
326 inline double sigma(
size_t i)
const {
return sigmas_(i); }
331 inline const Vector&
invsigmas()
const {
return invsigmas_; }
332 inline double invsigma(
size_t i)
const {
return invsigmas_(i);}
337 inline const Vector&
precisions()
const {
return precisions_; }
338 inline double precision(
size_t i)
const {
return precisions_(i);}
343 virtual Matrix
R()
const {
344 return invsigmas().asDiagonal();
349 friend class boost::serialization::access;
350 template<
class ARCHIVE>
351 void serialize(ARCHIVE & ar,
const unsigned int ) {
352 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Gaussian);
353 ar & BOOST_SERIALIZATION_NVP(sigmas_);
354 ar & BOOST_SERIALIZATION_NVP(invsigmas_);
391 Constrained(
const Vector& mu,
const Vector& sigmas);
395 typedef boost::shared_ptr<Constrained> shared_ptr;
403 bool constrained(
size_t i)
const;
406 const Vector&
mu()
const {
return mu_; }
412 static shared_ptr MixedSigmas(
const Vector& mu,
const Vector& sigmas);
419 return MixedSigmas(Vector::Constant(sigmas.size(), 1000.0), sigmas);
427 return MixedSigmas(Vector::Constant(sigmas.size(), m), sigmas);
435 return shared_ptr(
new Constrained(mu, variances.cwiseSqrt()));
437 static shared_ptr MixedVariances(
const Vector& variances) {
438 return shared_ptr(
new Constrained(variances.cwiseSqrt()));
446 return MixedVariances(mu, precisions.array().inverse());
448 static shared_ptr MixedPrecisions(
const Vector& precisions) {
449 return MixedVariances(precisions.array().inverse());
457 virtual double distance(
const Vector& v)
const;
460 static shared_ptr
All(
size_t dim) {
461 return shared_ptr(
new Constrained(Vector::Constant(dim, 1000.0), Vector::Constant(dim,0)));
465 static shared_ptr
All(
size_t dim,
const Vector& mu) {
466 return shared_ptr(
new Constrained(mu, Vector::Constant(dim,0)));
470 static shared_ptr
All(
size_t dim,
double mu) {
471 return shared_ptr(
new Constrained(Vector::Constant(dim, mu), Vector::Constant(dim,0)));
474 virtual void print(
const std::string& name)
const;
477 virtual Vector whiten(
const Vector& v)
const;
481 virtual Matrix Whiten(
const Matrix& H)
const;
482 virtual void WhitenInPlace(Matrix& H)
const;
483 virtual void WhitenInPlace(Eigen::Block<Matrix> H)
const;
494 virtual Diagonal::shared_ptr QR(Matrix& Ab)
const;
500 shared_ptr unit()
const;
504 friend class boost::serialization::access;
505 template<
class ARCHIVE>
506 void serialize(ARCHIVE & ar,
const unsigned int ) {
507 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Diagonal);
508 ar & BOOST_SERIALIZATION_NVP(mu_);
521 double sigma_, invsigma_;
525 Diagonal(Vector::Constant(dim, sigma)),sigma_(sigma),invsigma_(1.0/sigma) {}
532 virtual ~Isotropic() {}
534 typedef boost::shared_ptr<Isotropic> shared_ptr;
539 static shared_ptr Sigma(
size_t dim,
double sigma,
bool smart =
true);
547 static shared_ptr Variance(
size_t dim,
double variance,
bool smart =
true);
552 static shared_ptr
Precision(
size_t dim,
double precision,
bool smart =
true) {
553 return Variance(dim, 1.0/precision, smart);
556 virtual void print(
const std::string& name)
const;
557 virtual double Mahalanobis(
const Vector& v)
const;
558 virtual Vector whiten(
const Vector& v)
const;
559 virtual Vector unwhiten(
const Vector& v)
const;
560 virtual Matrix Whiten(
const Matrix& H)
const;
561 virtual void WhitenInPlace(Matrix& H)
const;
562 virtual void whitenInPlace(Vector& v)
const;
563 virtual void WhitenInPlace(Eigen::Block<Matrix> H)
const;
568 inline double sigma()
const {
return sigma_; }
572 friend class boost::serialization::access;
573 template<
class ARCHIVE>
574 void serialize(ARCHIVE & ar,
const unsigned int ) {
575 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Diagonal);
576 ar & BOOST_SERIALIZATION_NVP(sigma_);
577 ar & BOOST_SERIALIZATION_NVP(invsigma_);
594 typedef boost::shared_ptr<Unit> shared_ptr;
602 return shared_ptr(
new Unit(dim));
606 virtual bool isUnit()
const {
return true; }
608 virtual void print(
const std::string& name)
const;
609 virtual double Mahalanobis(
const Vector& v)
const {
return v.dot(v); }
610 virtual Vector
whiten(
const Vector& v)
const {
return v; }
611 virtual Vector
unwhiten(
const Vector& v)
const {
return v; }
612 virtual Matrix
Whiten(
const Matrix& H)
const {
return H; }
622 friend class boost::serialization::access;
623 template<
class ARCHIVE>
624 void serialize(ARCHIVE & ar,
const unsigned int ) {
625 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Isotropic);
647 namespace mEstimator {
653 enum ReweightScheme { Scalar, Block };
654 typedef boost::shared_ptr<Base> shared_ptr;
662 Base(
const ReweightScheme reweight = Block):reweight_(reweight) {}
679 virtual double residual(
double error)
const {
return 0; };
688 virtual double weight(
double error)
const = 0;
690 virtual void print(
const std::string &s)
const = 0;
691 virtual bool equals(
const Base& expected,
double tol=1e-8)
const = 0;
693 double sqrtWeight(
double error)
const {
694 return std::sqrt(weight(error));
699 Vector weight(
const Vector &error)
const;
703 return weight(error).cwiseSqrt();
707 void reweight(Vector &error)
const;
708 void reweight(std::vector<Matrix> &A, Vector &error)
const;
709 void reweight(Matrix &A, Vector &error)
const;
710 void reweight(Matrix &A1, Matrix &A2, Vector &error)
const;
711 void reweight(Matrix &A1, Matrix &A2, Matrix &A3, Vector &error)
const;
715 friend class boost::serialization::access;
716 template<
class ARCHIVE>
717 void serialize(ARCHIVE & ar,
const unsigned int ) {
718 ar & BOOST_SERIALIZATION_NVP(reweight_);
725 typedef boost::shared_ptr<Null> shared_ptr;
727 Null(
const ReweightScheme reweight = Block) :
Base(reweight) {}
729 virtual double weight(
double )
const {
return 1.0; }
730 virtual void print(
const std::string &s)
const;
731 virtual bool equals(
const Base& ,
double )
const {
return true; }
732 static shared_ptr Create() ;
736 friend class boost::serialization::access;
737 template<
class ARCHIVE>
738 void serialize(ARCHIVE & ar,
const unsigned int ) {
739 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
749 typedef boost::shared_ptr<Fair> shared_ptr;
751 Fair(
double c = 1.3998,
const ReweightScheme reweight = Block);
752 double weight(
double error)
const {
753 return 1.0 / (1.0 + fabs(error) / c_);
755 void print(
const std::string &s)
const;
756 bool equals(
const Base& expected,
double tol=1e-8)
const;
757 static shared_ptr Create(
double c,
const ReweightScheme reweight = Block) ;
761 friend class boost::serialization::access;
762 template<
class ARCHIVE>
763 void serialize(ARCHIVE & ar,
const unsigned int ) {
764 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
765 ar & BOOST_SERIALIZATION_NVP(c_);
775 typedef boost::shared_ptr<Huber> shared_ptr;
777 Huber(
double k = 1.345,
const ReweightScheme reweight = Block);
778 double weight(
double error)
const {
779 return (error < k_) ? (1.0) : (k_ / fabs(error));
781 void print(
const std::string &s)
const;
782 bool equals(
const Base& expected,
double tol=1e-8)
const;
783 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
787 friend class boost::serialization::access;
788 template<
class ARCHIVE>
789 void serialize(ARCHIVE & ar,
const unsigned int ) {
790 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
791 ar & BOOST_SERIALIZATION_NVP(k_);
802 double k_, ksquared_;
805 typedef boost::shared_ptr<Cauchy> shared_ptr;
807 Cauchy(
double k = 0.1,
const ReweightScheme reweight = Block);
808 double weight(
double error)
const {
809 return ksquared_ / (ksquared_ + error*error);
811 void print(
const std::string &s)
const;
812 bool equals(
const Base& expected,
double tol=1e-8)
const;
813 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
817 friend class boost::serialization::access;
818 template<
class ARCHIVE>
819 void serialize(ARCHIVE & ar,
const unsigned int ) {
820 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
821 ar & BOOST_SERIALIZATION_NVP(k_);
828 double c_, csquared_;
831 typedef boost::shared_ptr<Tukey> shared_ptr;
833 Tukey(
double c = 4.6851,
const ReweightScheme reweight = Block);
834 double weight(
double error)
const {
835 if (std::fabs(error) <= c_) {
836 double xc2 = error*error/csquared_;
837 return (1.0-xc2)*(1.0-xc2);
841 void print(
const std::string &s)
const;
842 bool equals(
const Base& expected,
double tol=1e-8)
const;
843 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
847 friend class boost::serialization::access;
848 template<
class ARCHIVE>
849 void serialize(ARCHIVE & ar,
const unsigned int ) {
850 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
851 ar & BOOST_SERIALIZATION_NVP(c_);
858 double c_, csquared_;
861 typedef boost::shared_ptr<Welsh> shared_ptr;
863 Welsh(
double c = 2.9846,
const ReweightScheme reweight = Block);
864 double weight(
double error)
const {
865 double xc2 = (error*error)/csquared_;
866 return std::exp(-xc2);
868 void print(
const std::string &s)
const;
869 bool equals(
const Base& expected,
double tol=1e-8)
const;
870 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
874 friend class boost::serialization::access;
875 template<
class ARCHIVE>
876 void serialize(ARCHIVE & ar,
const unsigned int ) {
877 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
878 ar & BOOST_SERIALIZATION_NVP(c_);
890 typedef boost::shared_ptr<GemanMcClure> shared_ptr;
892 GemanMcClure(
double c = 1.0,
const ReweightScheme reweight = Block);
894 virtual double weight(
double error)
const;
895 virtual void print(
const std::string &s)
const;
896 virtual bool equals(
const Base& expected,
double tol=1e-8)
const;
897 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
904 friend class boost::serialization::access;
905 template<
class ARCHIVE>
906 void serialize(ARCHIVE & ar,
const unsigned int ) {
907 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
908 ar & BOOST_SERIALIZATION_NVP(c_);
919 typedef boost::shared_ptr<DCS> shared_ptr;
921 DCS(
double c = 1.0,
const ReweightScheme reweight = Block);
923 virtual double weight(
double error)
const;
924 virtual void print(
const std::string &s)
const;
925 virtual bool equals(
const Base& expected,
double tol=1e-8)
const;
926 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block) ;
933 friend class boost::serialization::access;
934 template<
class ARCHIVE>
935 void serialize(ARCHIVE & ar,
const unsigned int ) {
936 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
937 ar & BOOST_SERIALIZATION_NVP(c_);
951 typedef boost::shared_ptr<L2WithDeadZone> shared_ptr;
954 double residual(
double error)
const {
955 const double abs_error = fabs(error);
956 return (abs_error < k_) ? 0.0 : 0.5*(k_-abs_error)*(k_-abs_error);
958 double weight(
double error)
const {
962 if (fabs(error) <= k_)
return 0.0;
963 else if (error > k_)
return (-k_+error)/error;
964 else return (k_+error)/error;
966 void print(
const std::string &s)
const;
967 bool equals(
const Base& expected,
double tol=1e-8)
const;
968 static shared_ptr Create(
double k,
const ReweightScheme reweight = Block);
972 friend class boost::serialization::access;
973 template<
class ARCHIVE>
974 void serialize(ARCHIVE & ar,
const unsigned int ) {
975 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
976 ar & BOOST_SERIALIZATION_NVP(k_);
1001 typedef boost::shared_ptr<Robust> shared_ptr;
1016 Robust(
const RobustModel::shared_ptr robust,
const NoiseModel::shared_ptr noise)
1017 :
Base(noise->dim()), robust_(robust), noise_(noise) {}
1022 virtual void print(
const std::string& name)
const;
1023 virtual bool equals(
const Base& expected,
double tol=1e-9)
const;
1026 const RobustModel::shared_ptr&
robust()
const {
return robust_; }
1029 const NoiseModel::shared_ptr&
noise()
const {
return noise_; }
1032 inline virtual Vector
whiten(
const Vector& v)
const 1033 { Vector r = v; this->WhitenSystem(r);
return r; }
1034 inline virtual Matrix
Whiten(
const Matrix& A)
const 1035 { Vector b; Matrix B=A; this->WhitenSystem(B,b);
return B; }
1037 {
throw std::invalid_argument(
"unwhiten is not currently supported for robust noise models."); }
1038 inline virtual double distance(
const Vector& v)
const 1039 {
return this->whiten(v).squaredNorm(); }
1041 inline virtual double distance_non_whitened(
const Vector& v)
const 1042 {
return robust_->residual(v.norm()); }
1044 virtual void WhitenSystem(Vector& b)
const;
1045 virtual void WhitenSystem(std::vector<Matrix>& A, Vector& b)
const;
1046 virtual void WhitenSystem(Matrix& A, Vector& b)
const;
1047 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Vector& b)
const;
1048 virtual void WhitenSystem(Matrix& A1, Matrix& A2, Matrix& A3, Vector& b)
const;
1050 static shared_ptr Create(
1051 const RobustModel::shared_ptr &robust,
const NoiseModel::shared_ptr noise);
1055 friend class boost::serialization::access;
1056 template<
class ARCHIVE>
1057 void serialize(ARCHIVE & ar,
const unsigned int ) {
1058 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
1059 ar & boost::serialization::make_nvp(
"robust_", const_cast<RobustModel::shared_ptr&>(robust_));
1060 ar & boost::serialization::make_nvp(
"noise_", const_cast<NoiseModel::shared_ptr&>(noise_));
1065 GTSAM_EXPORT boost::optional<Vector> checkIfDiagonal(
const Matrix M);
1073 typedef noiseModel::Gaussian::shared_ptr SharedGaussian;
1074 typedef noiseModel::Diagonal::shared_ptr SharedDiagonal;
1075 typedef noiseModel::Constrained::shared_ptr SharedConstrained;
1076 typedef noiseModel::Isotropic::shared_ptr SharedIsotropic;
1079 template<>
struct traits<noiseModel::Gaussian> :
public Testable<noiseModel::Gaussian> {};
1080 template<>
struct traits<noiseModel::Diagonal> :
public Testable<noiseModel::Diagonal> {};
1081 template<>
struct traits<noiseModel::Constrained> :
public Testable<noiseModel::Constrained> {};
1082 template<>
struct traits<noiseModel::Isotropic> :
public Testable<noiseModel::Isotropic> {};
const NoiseModel::shared_ptr noise_
noise model used
Definition: NoiseModel.h:1008
virtual void whitenInPlace(Vector &) const
in-place whiten, override if can be done more efficiently
Definition: NoiseModel.h:615
static shared_ptr MixedVariances(const Vector &mu, const Vector &variances)
A diagonal noise model created by specifying a Vector of standard devations, some of which might be z...
Definition: NoiseModel.h:434
noiseModel::Base is the abstract base class for all noise models.
Definition: NoiseModel.h:51
virtual void unwhitenInPlace(Eigen::Block< Vector > &v) const
in-place unwhiten, override if can be done more efficiently
Definition: NoiseModel.h:114
GemanMcClure implements the "Geman-McClure" robust error model (Zhang97ivc).
Definition: NoiseModel.h:888
static shared_ptr MixedSigmas(double m, const Vector &sigmas)
A diagonal noise model created by specifying a Vector of standard devations, some of which might be z...
Definition: NoiseModel.h:426
virtual Matrix Whiten(const Matrix &H) const
Multiply a derivative with R (derivative of whiten) Equivalent to whitening each column of the input ...
Definition: NoiseModel.h:612
const Vector & invsigmas() const
Return sqrt precisions.
Definition: NoiseModel.h:331
double sigma() const
Return standard deviation.
Definition: NoiseModel.h:568
virtual Matrix Whiten(const Matrix &A) const
Whiten a matrix.
Definition: NoiseModel.h:1034
virtual void whitenInPlace(Eigen::Block< Vector > &) const
in-place whiten, override if can be done more efficiently
Definition: NoiseModel.h:617
static shared_ptr Precision(size_t dim, double precision, bool smart=true)
An isotropic noise model created by specifying a precision.
Definition: NoiseModel.h:552
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
Unit: i.i.d.
Definition: NoiseModel.h:587
static shared_ptr All(size_t dim)
Fully constrained variations.
Definition: NoiseModel.h:460
A diagonal noise model implements a diagonal covariance matrix, with the elements of the diagonal spe...
Definition: NoiseModel.h:270
virtual Vector unwhiten(const Vector &) const
Unwhiten an error vector.
Definition: NoiseModel.h:1036
virtual Matrix R() const
Return R itself, but note that Whiten(H) is cheaper than R*H.
Definition: NoiseModel.h:244
virtual void whitenInPlace(Vector &v) const
in-place whiten, override if can be done more efficiently
Definition: NoiseModel.h:99
Template to create a binary predicate.
Definition: Testable.h:110
Cauchy implements the "Cauchy" robust error model (Lee2013IROS).
Definition: NoiseModel.h:800
Base(size_t dim=1)
primary constructor
Definition: NoiseModel.h:63
Null class is not robust so is a Gaussian ?
Definition: NoiseModel.h:723
An isotropic noise model corresponds to a scaled diagonal covariance To construct,...
Definition: NoiseModel.h:519
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
static shared_ptr All(size_t dim, const Vector &mu)
Fully constrained variations.
Definition: NoiseModel.h:465
Gaussian implements the mathematical model |R*x|^2 = |y|^2 with R'*R=inv(Sigma) where y = whiten(x) =...
Definition: NoiseModel.h:141
virtual bool isUnit() const
true if a unit noise model, saves slow/clumsy dynamic casting
Definition: NoiseModel.h:606
L2WithDeadZone implements a standard L2 penalty, but with a dead zone of width 2*k,...
Definition: NoiseModel.h:946
static shared_ptr MixedPrecisions(const Vector &mu, const Vector &precisions)
A diagonal noise model created by specifying a Vector of precisions, some of which might be inf.
Definition: NoiseModel.h:445
ReweightScheme reweight_
the rows can be weighted independently according to the error or uniformly with the norm of the right...
Definition: NoiseModel.h:659
Welsh implements the "Welsh" robust error model (Zhang97ivc)
Definition: NoiseModel.h:856
virtual Vector unwhiten(const Vector &v) const
Unwhiten an error vector.
Definition: NoiseModel.h:611
Huber implements the "Huber" robust error model (Zhang97ivc)
Definition: NoiseModel.h:770
Definition: NoiseModel.h:651
virtual bool isConstrained() const
true if a constrained noise model, saves slow/clumsy dynamic casting
Definition: NoiseModel.h:67
virtual bool isConstrained() const
true if a constrained noise mode, saves slow/clumsy dynamic casting
Definition: NoiseModel.h:400
static shared_ptr Create(size_t dim)
Create a unit covariance noise model.
Definition: NoiseModel.h:601
const RobustModel::shared_ptr robust_
robust error function used
Definition: NoiseModel.h:1007
virtual Matrix information() const
Compute information matrix.
Definition: NoiseModel.h:247
DCS implements the Dynamic Covariance Scaling robust error model from the paper Robust Map Optimizati...
Definition: NoiseModel.h:917
virtual void whitenInPlace(Eigen::Block< Vector > &v) const
in-place whiten, override if can be done more efficiently
Definition: NoiseModel.h:109
virtual Matrix covariance() const
Compute covariance matrix.
Definition: NoiseModel.h:250
virtual void unwhitenInPlace(Vector &v) const
in-place unwhiten, override if can be done more efficiently
Definition: NoiseModel.h:104
Tukey implements the "Tukey" robust error model (Zhang97ivc)
Definition: NoiseModel.h:826
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
virtual void WhitenInPlace(Eigen::Block< Matrix >) const
In-place version.
Definition: NoiseModel.h:614
static shared_ptr All(size_t dim, double mu)
Fully constrained variations with a mu parameter.
Definition: NoiseModel.h:470
Gaussian(size_t dim=1, const boost::optional< Matrix > &sqrt_information=boost::none)
protected constructor takes square root information matrix
Definition: NoiseModel.h:162
double sigma(size_t i) const
Return standard deviations (sqrt of diagonal)
Definition: NoiseModel.h:326
virtual Vector whiten(const Vector &v) const
Whiten an error vector.
Definition: NoiseModel.h:1032
static shared_ptr Precisions(const Vector &precisions, bool smart=true)
A diagonal noise model created by specifying a Vector of precisions, i.e.
Definition: NoiseModel.h:311
Base class for robust error models The robust M-estimators above simply tell us how to re-weight the ...
Definition: NoiseModel.h:999
Vector sigmas_
Standard deviations (sigmas), their inverse and inverse square (weights/precisions) These are all com...
Definition: NoiseModel.h:278
const NoiseModel::shared_ptr & noise() const
Return the contained noise model.
Definition: NoiseModel.h:1029
Vector sqrtWeight(const Vector &error) const
square root version of the weight function
Definition: NoiseModel.h:702
virtual ~Robust()
Destructor.
Definition: NoiseModel.h:1020
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Concept check for values that can be used in unit tests.
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:1072
Robust(const RobustModel::shared_ptr robust, const NoiseModel::shared_ptr noise)
Constructor.
Definition: NoiseModel.h:1016
virtual void WhitenInPlace(Matrix &) const
In-place version.
Definition: NoiseModel.h:613
typedef and functions to augment Eigen's MatrixXd
const Vector & mu() const
Access mu as a vector.
Definition: NoiseModel.h:406
virtual Matrix R() const
Return R itself, but note that Whiten(H) is cheaper than R*H.
Definition: NoiseModel.h:343
const Vector & precisions() const
Return precisions.
Definition: NoiseModel.h:337
Vector mu_
Penalty function weight - needs to be large enough to dominate soft constraints.
Definition: NoiseModel.h:376
virtual void unwhitenInPlace(Eigen::Block< Vector > &) const
in-place unwhiten, override if can be done more efficiently
Definition: NoiseModel.h:618
Robust()
Default Constructor for serialization.
Definition: NoiseModel.h:1013
virtual double Mahalanobis(const Vector &v) const
Mahalanobis distance v'*R'*R*v = <R*v,R*v>
Definition: NoiseModel.h:609
virtual Vector whiten(const Vector &v) const
Whiten an error vector.
Definition: NoiseModel.h:610
A Constrained constrained model is a specialization of Diagonal which allows some or all of the sigma...
Definition: NoiseModel.h:372
virtual bool isUnit() const
true if a unit noise model, saves slow/clumsy dynamic casting
Definition: NoiseModel.h:70
virtual void unwhitenInPlace(Vector &) const
in-place unwhiten, override if can be done more efficiently
Definition: NoiseModel.h:616
virtual Vector sigmas() const
Calculate standard deviations.
Definition: NoiseModel.h:316
size_t dim() const
Dimensionality.
Definition: NoiseModel.h:73
boost::optional< Matrix > sqrt_information_
Matrix square root of information matrix (R)
Definition: NoiseModel.h:146
Fair implements the "Fair" robust error model (Zhang97ivc)
Definition: NoiseModel.h:744
const RobustModel::shared_ptr & robust() const
Return the contained robust error function.
Definition: NoiseModel.h:1026
Isotropic(size_t dim, double sigma)
protected constructor takes sigma
Definition: NoiseModel.h:524
static shared_ptr MixedSigmas(const Vector &sigmas)
A diagonal noise model created by specifying a Vector of standard devations, some of which might be z...
Definition: NoiseModel.h:418