LossFunctions.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
20 
21 #include <iostream>
22 #include <utility>
23 #include <vector>
24 
25 using namespace std;
26 
27 namespace gtsam {
28 namespace noiseModel {
29 
30 /* ************************************************************************* */
31 // M-Estimator
32 /* ************************************************************************* */
33 
34 namespace mEstimator {
35 
36 Vector Base::weight(const Vector& error) const {
37  const size_t n = error.rows();
38  Vector w(n);
39  for (size_t i = 0; i < n; ++i)
40  w(i) = weight(error(i));
41  return w;
42 }
43 
44 Vector Base::sqrtWeight(const Vector &error) const {
45  return weight(error).cwiseSqrt();
46 }
47 
48 // The following three functions re-weight block matrices and a vector
49 // according to their weight implementation
50 
51 void Base::reweight(Vector& error) const {
52  if (reweight_ == Block) {
53  const double w = sqrtWeight(error.norm());
54  error *= w;
55  } else {
56  error.array() *= weight(error).cwiseSqrt().array();
57  }
58 }
59 
60 // Reweight n block matrices with one error vector
61 void Base::reweight(vector<Matrix> &A, Vector &error) const {
62  if ( reweight_ == Block ) {
63  const double w = sqrtWeight(error.norm());
64  for(Matrix& Aj: A) {
65  Aj *= w;
66  }
67  error *= w;
68  }
69  else {
70  const Vector W = sqrtWeight(error);
71  for(Matrix& Aj: A) {
73  }
74  error = W.cwiseProduct(error);
75  }
76 }
77 
78 // Reweight one block matrix with one error vector
79 void Base::reweight(Matrix &A, Vector &error) const {
80  if ( reweight_ == Block ) {
81  const double w = sqrtWeight(error.norm());
82  A *= w;
83  error *= w;
84  }
85  else {
86  const Vector W = sqrtWeight(error);
88  error = W.cwiseProduct(error);
89  }
90 }
91 
92 // Reweight two block matrix with one error vector
93 void Base::reweight(Matrix &A1, Matrix &A2, Vector &error) const {
94  if ( reweight_ == Block ) {
95  const double w = sqrtWeight(error.norm());
96  A1 *= w;
97  A2 *= w;
98  error *= w;
99  }
100  else {
101  const Vector W = sqrtWeight(error);
104  error = W.cwiseProduct(error);
105  }
106 }
107 
108 // Reweight three block matrix with one error vector
109 void Base::reweight(Matrix &A1, Matrix &A2, Matrix &A3, Vector &error) const {
110  if ( reweight_ == Block ) {
111  const double w = sqrtWeight(error.norm());
112  A1 *= w;
113  A2 *= w;
114  A3 *= w;
115  error *= w;
116  }
117  else {
118  const Vector W = sqrtWeight(error);
122  error = W.cwiseProduct(error);
123  }
124 }
125 
126 /* ************************************************************************* */
127 // Null model
128 /* ************************************************************************* */
129 
130 void Null::print(const std::string &s="") const
131 { cout << s << "null ()" << endl; }
132 
133 Null::shared_ptr Null::Create()
134 { return shared_ptr(new Null()); }
135 
136 /* ************************************************************************* */
137 // Fair
138 /* ************************************************************************* */
139 
140 Fair::Fair(double c, const ReweightScheme reweight) : Base(reweight), c_(c) {
141  if (c_ <= 0) {
142  throw runtime_error("mEstimator Fair takes only positive double in constructor.");
143  }
144 }
145 
146 double Fair::weight(double distance) const {
147  return 1.0 / (1.0 + std::abs(distance) / c_);
148 }
149 
150 double Fair::loss(double distance) const {
151  const double absError = std::abs(distance);
152  const double normalizedError = absError / c_;
153  const double c_2 = c_ * c_;
154  return c_2 * (normalizedError - std::log1p(normalizedError));
155 }
156 
157 void Fair::print(const std::string &s="") const
158 { cout << s << "fair (" << c_ << ")" << endl; }
159 
160 bool Fair::equals(const Base &expected, double tol) const {
161  const Fair* p = dynamic_cast<const Fair*> (&expected);
162  if (p == nullptr) return false;
163  return std::abs(c_ - p->c_ ) < tol;
164 }
165 
167 { return shared_ptr(new Fair(c, reweight)); }
168 
169 /* ************************************************************************* */
170 // Huber
171 /* ************************************************************************* */
172 
173 Huber::Huber(double k, const ReweightScheme reweight) : Base(reweight), k_(k) {
174  if (k_ <= 0) {
175  throw runtime_error("mEstimator Huber takes only positive double in constructor.");
176  }
177 }
178 
179 double Huber::weight(double distance) const {
180  const double absError = std::abs(distance);
181  return (absError <= k_) ? (1.0) : (k_ / absError);
182 }
183 
184 double Huber::loss(double distance) const {
185  const double absError = std::abs(distance);
186  if (absError <= k_) { // |x| <= k
187  return distance*distance / 2;
188  } else { // |x| > k
189  return k_ * (absError - (k_/2));
190  }
191 }
192 
193 void Huber::print(const std::string &s="") const {
194  cout << s << "huber (" << k_ << ")" << endl;
195 }
196 
197 bool Huber::equals(const Base &expected, double tol) const {
198  const Huber* p = dynamic_cast<const Huber*>(&expected);
199  if (p == nullptr) return false;
200  return std::abs(k_ - p->k_) < tol;
201 }
202 
204  return shared_ptr(new Huber(c, reweight));
205 }
206 
207 /* ************************************************************************* */
208 // Cauchy
209 /* ************************************************************************* */
210 
211 Cauchy::Cauchy(double k, const ReweightScheme reweight) : Base(reweight), k_(k), ksquared_(k * k) {
212  if (k <= 0) {
213  throw runtime_error("mEstimator Cauchy takes only positive double in constructor.");
214  }
215 }
216 
217 double Cauchy::weight(double distance) const {
218  return ksquared_ / (ksquared_ + distance*distance);
219 }
220 
221 double Cauchy::loss(double distance) const {
222  const double val = std::log1p(distance * distance / ksquared_);
223  return ksquared_ * val * 0.5;
224 }
225 
226 void Cauchy::print(const std::string &s="") const {
227  cout << s << "cauchy (" << k_ << ")" << endl;
228 }
229 
230 bool Cauchy::equals(const Base &expected, double tol) const {
231  const Cauchy* p = dynamic_cast<const Cauchy*>(&expected);
232  if (p == nullptr) return false;
233  return std::abs(ksquared_ - p->ksquared_) < tol;
234 }
235 
237  return shared_ptr(new Cauchy(c, reweight));
238 }
239 
240 /* ************************************************************************* */
241 // Tukey
242 /* ************************************************************************* */
243 
244 Tukey::Tukey(double c, const ReweightScheme reweight) : Base(reweight), c_(c), csquared_(c * c) {
245  if (c <= 0) {
246  throw runtime_error("mEstimator Tukey takes only positive double in constructor.");
247  }
248 }
249 
250 double Tukey::weight(double distance) const {
251  if (std::abs(distance) <= c_) {
252  const double one_minus_xc2 = 1.0 - distance*distance/csquared_;
253  return one_minus_xc2 * one_minus_xc2;
254  }
255  return 0.0;
256 }
257 
258 double Tukey::loss(double distance) const {
259  double absError = std::abs(distance);
260  if (absError <= c_) {
261  const double one_minus_xc2 = 1.0 - distance*distance/csquared_;
262  const double t = one_minus_xc2*one_minus_xc2*one_minus_xc2;
263  return csquared_ * (1 - t) / 6.0;
264  } else {
265  return csquared_ / 6.0;
266  }
267 }
268 
269 void Tukey::print(const std::string &s="") const {
270  std::cout << s << ": Tukey (" << c_ << ")" << std::endl;
271 }
272 
273 bool Tukey::equals(const Base &expected, double tol) const {
274  const Tukey* p = dynamic_cast<const Tukey*>(&expected);
275  if (p == nullptr) return false;
276  return std::abs(c_ - p->c_) < tol;
277 }
278 
280  return shared_ptr(new Tukey(c, reweight));
281 }
282 
283 /* ************************************************************************* */
284 // Welsch
285 /* ************************************************************************* */
286 
287 Welsch::Welsch(double c, const ReweightScheme reweight) : Base(reweight), c_(c), csquared_(c * c) {}
288 
289 double Welsch::weight(double distance) const {
290  const double xc2 = (distance*distance)/csquared_;
291  return std::exp(-xc2);
292 }
293 
294 double Welsch::loss(double distance) const {
295  const double xc2 = (distance*distance)/csquared_;
296  return csquared_ * 0.5 * -std::expm1(-xc2);
297 }
298 
299 void Welsch::print(const std::string &s="") const {
300  std::cout << s << ": Welsch (" << c_ << ")" << std::endl;
301 }
302 
303 bool Welsch::equals(const Base &expected, double tol) const {
304  const Welsch* p = dynamic_cast<const Welsch*>(&expected);
305  if (p == nullptr) return false;
306  return std::abs(c_ - p->c_) < tol;
307 }
308 
310  return shared_ptr(new Welsch(c, reweight));
311 }
312 
313 /* ************************************************************************* */
314 // GemanMcClure
315 /* ************************************************************************* */
317  : Base(reweight), c_(c) {
318 }
319 
320 double GemanMcClure::weight(double distance) const {
321  const double c2 = c_*c_;
322  const double c4 = c2*c2;
323  const double c2error = c2 + distance*distance;
324  return c4/(c2error*c2error);
325 }
326 
327 double GemanMcClure::loss(double distance) const {
328  const double c2 = c_*c_;
329  const double error2 = distance*distance;
330  return 0.5 * (c2 * error2) / (c2 + error2);
331 }
332 
333 void GemanMcClure::print(const std::string &s="") const {
334  std::cout << s << ": Geman-McClure (" << c_ << ")" << std::endl;
335 }
336 
337 bool GemanMcClure::equals(const Base &expected, double tol) const {
338  const GemanMcClure* p = dynamic_cast<const GemanMcClure*>(&expected);
339  if (p == nullptr) return false;
340  return std::abs(c_ - p->c_) < tol;
341 }
342 
344  return shared_ptr(new GemanMcClure(c, reweight));
345 }
346 
347 /* ************************************************************************* */
348 // DCS
349 /* ************************************************************************* */
350 DCS::DCS(double c, const ReweightScheme reweight)
351  : Base(reweight), c_(c) {
352 }
353 
354 double DCS::weight(double distance) const {
355  const double e2 = distance*distance;
356  if (e2 > c_)
357  {
358  const double w = 2.0*c_/(c_ + e2);
359  return w*w;
360  }
361 
362  return 1.0;
363 }
364 
365 double DCS::loss(double distance) const {
366  // This is the simplified version of Eq 9 from (Agarwal13icra)
367  // after you simplify and cancel terms.
368  const double e2 = distance*distance;
369  const double e4 = e2*e2;
370  const double c2 = c_*c_;
371 
372  return (c2*e2 + c_*e4) / ((e2 + c_)*(e2 + c_));
373 }
374 
375 void DCS::print(const std::string &s="") const {
376  std::cout << s << ": DCS (" << c_ << ")" << std::endl;
377 }
378 
379 bool DCS::equals(const Base &expected, double tol) const {
380  const DCS* p = dynamic_cast<const DCS*>(&expected);
381  if (p == nullptr) return false;
382  return std::abs(c_ - p->c_) < tol;
383 }
384 
385 DCS::shared_ptr DCS::Create(double c, const ReweightScheme reweight) {
386  return shared_ptr(new DCS(c, reweight));
387 }
388 
389 /* ************************************************************************* */
390 // L2WithDeadZone
391 /* ************************************************************************* */
392 
394  : Base(reweight), k_(k) {
395  if (k_ <= 0) {
396  throw runtime_error("mEstimator L2WithDeadZone takes only positive double in constructor.");
397  }
398 }
399 
400 double L2WithDeadZone::weight(double distance) const {
401  // note that this code is slightly uglier than residual, because there are three distinct
402  // cases to handle (left of deadzone, deadzone, right of deadzone) instead of the two
403  // cases (deadzone, non-deadzone) in residual.
404  if (std::abs(distance) <= k_) return 0.0;
405  else if (distance > k_) return (-k_+distance)/distance;
406  else return (k_+distance)/distance;
407 }
408 
409 double L2WithDeadZone::loss(double distance) const {
410  const double abs_error = std::abs(distance);
411  return (abs_error < k_) ? 0.0 : 0.5*(k_-abs_error)*(k_-abs_error);
412 }
413 
414 void L2WithDeadZone::print(const std::string &s="") const {
415  std::cout << s << ": L2WithDeadZone (" << k_ << ")" << std::endl;
416 }
417 
418 bool L2WithDeadZone::equals(const Base &expected, double tol) const {
419  const L2WithDeadZone* p = dynamic_cast<const L2WithDeadZone*>(&expected);
420  if (p == nullptr) return false;
421  return std::abs(k_ - p->k_) < tol;
422 }
423 
425  return shared_ptr(new L2WithDeadZone(k, reweight));
426 }
427 
428 
429 /* ************************************************************************* */
430 // AsymmetricTukey
431 /* ************************************************************************* */
432 
433 AsymmetricTukey::AsymmetricTukey(double c, const ReweightScheme reweight) : Base(reweight), c_(c), csquared_(c * c) {
434  if (c <= 0) {
435  throw runtime_error("mEstimator AsymmetricTukey takes only positive double in constructor.");
436  }
437 }
438 
439 double AsymmetricTukey::weight(double distance) const {
440  distance = -distance;
441  if (distance >= 0.0) {
442  return 1.0;
443  } else if (distance > -c_) {
444  const double one_minus_xc2 = 1.0 - distance * distance / csquared_;
445  return one_minus_xc2 * one_minus_xc2;
446  }
447  return 0.0;
448 }
449 
450 double AsymmetricTukey::loss(double distance) const {
451  distance = -distance;
452  if (distance >= 0.0) {
453  return distance * distance / 2.0;
454  } else if (distance >= -c_) {
455  const double one_minus_xc2 = 1.0 - distance * distance / csquared_;
456  const double t = one_minus_xc2 * one_minus_xc2 * one_minus_xc2;
457  return csquared_ * (1 - t) / 6.0;
458  }
459  return csquared_ / 6.0;
460 }
461 
462 void AsymmetricTukey::print(const std::string &s="") const {
463  std::cout << s << ": AsymmetricTukey (" << c_ << ")" << std::endl;
464 }
465 
466 bool AsymmetricTukey::equals(const Base &expected, double tol) const {
467  const AsymmetricTukey* p = dynamic_cast<const AsymmetricTukey*>(&expected);
468  if (p == nullptr) return false;
469  return std::abs(c_ - p->c_) < tol;
470 }
471 
473  return shared_ptr(new AsymmetricTukey(c, reweight));
474 }
475 
476 
477 /* ************************************************************************* */
478 // AsymmetricCauchy
479 /* ************************************************************************* */
480 
481 AsymmetricCauchy::AsymmetricCauchy(double k, const ReweightScheme reweight) : Base(reweight), k_(k), ksquared_(k * k) {
482  if (k <= 0) {
483  throw runtime_error("mEstimator AsymmetricCauchy takes only positive double in constructor.");
484  }
485 }
486 
487 double AsymmetricCauchy::weight(double distance) const {
488  distance = -distance;
489  if (distance >= 0.0) {
490  return 1.0;
491  }
492 
493  return ksquared_ / (ksquared_ + distance*distance);
494 
495 }
496 
497 double AsymmetricCauchy::loss(double distance) const {
498  distance = -distance;
499  if (distance >= 0.0) {
500  return distance * distance / 2.0;
501  }
502  const double val = std::log1p(distance * distance / ksquared_);
503  return ksquared_ * val * 0.5;
504 }
505 
506 void AsymmetricCauchy::print(const std::string &s="") const {
507  std::cout << s << ": AsymmetricCauchy (" << k_ << ")" << std::endl;
508 }
509 
510 bool AsymmetricCauchy::equals(const Base &expected, double tol) const {
511  const AsymmetricCauchy* p = dynamic_cast<const AsymmetricCauchy*>(&expected);
512  if (p == nullptr) return false;
513  return std::abs(k_ - p->k_) < tol;
514 }
515 
517  return shared_ptr(new AsymmetricCauchy(k, reweight));
518 }
519 
520 
521 /* ************************************************************************* */
522 // Custom
523 /* ************************************************************************* */
524 
525 Custom::Custom(std::function<double(double)> weight, std::function<double(double)> loss, const ReweightScheme reweight,
526  std::string name)
527  : Base(reweight), weight_(std::move(weight)), loss_(loss), name_(std::move(name)) {}
528 
529 double Custom::weight(double distance) const {
530  return weight_(distance);
531 }
532 
533 double Custom::loss(double distance) const {
534  return loss_(distance);
535 }
536 
537 void Custom::print(const std::string &s = "") const {
538  std::cout << s << ": Custom (" << name_ << ")" << std::endl;
539 }
540 
541 bool Custom::equals(const Base &expected, double tol) const {
542  const auto *p = dynamic_cast<const Custom *>(&expected);
543  if (p == nullptr)
544  return false;
545  return name_ == p->name_ && weight_.target<double(double)>() == p->weight_.target<double(double)>() &&
546  loss_.target<double(double)>() == p->loss_.target<double(double)>() && reweight_ == p->reweight_;
547 }
548 
549 Custom::shared_ptr Custom::Create(std::function<double(double)> weight, std::function<double(double)> loss,
550  const ReweightScheme reweight, const std::string &name) {
551  return std::make_shared<Custom>(std::move(weight), std::move(loss), reweight, name);
552 }
553 
554 } // namespace mEstimator
555 } // namespace noiseModel
556 } // gtsam
w
RowVector3d w
Definition: Matrix_resize_int.cpp:3
gtsam::noiseModel::mEstimator::Cauchy::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:230
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
gtsam::noiseModel::mEstimator::Fair::c_
double c_
Definition: LossFunctions.h:184
name
Annotation for function names.
Definition: attr.h:51
gtsam::noiseModel::mEstimator::Welsch::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:289
gtsam::noiseModel::mEstimator::Fair::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:160
gtsam::noiseModel::mEstimator::AsymmetricCauchy::AsymmetricCauchy
AsymmetricCauchy(double k=0.1, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:481
gtsam::noiseModel::mEstimator::Huber::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:203
gtsam::noiseModel::mEstimator::Fair::shared_ptr
std::shared_ptr< Fair > shared_ptr
Definition: LossFunctions.h:187
gtsam::noiseModel::mEstimator::GemanMcClure::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:333
gtsam::noiseModel::mEstimator::Welsch::Welsch
Welsch(double c=2.9846, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:287
A3
static const double A3[]
Definition: expn.h:8
gtsam::noiseModel::mEstimator::Cauchy::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:236
gtsam::noiseModel::mEstimator::Welsch::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:299
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::noiseModel::mEstimator::Tukey
Definition: LossFunctions.h:293
gtsam::noiseModel::mEstimator::L2WithDeadZone::L2WithDeadZone
L2WithDeadZone(double k=1.0, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:393
gtsam::noiseModel::mEstimator::AsymmetricTukey::AsymmetricTukey
AsymmetricTukey(double c=4.6851, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:433
gtsam::noiseModel::mEstimator::Custom::loss_
std::function< double(double)> loss_
Definition: LossFunctions.h:557
gtsam::noiseModel::mEstimator::GemanMcClure::shared_ptr
std::shared_ptr< GemanMcClure > shared_ptr
Definition: LossFunctions.h:368
gtsam::noiseModel::mEstimator::Huber::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:197
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
gtsam::noiseModel::mEstimator::AsymmetricCauchy::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:506
gtsam::noiseModel::mEstimator::Fair::Fair
Fair(double c=1.3998, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:140
gtsam::noiseModel::mEstimator::Custom::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:537
gtsam::noiseModel::mEstimator::DCS::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:375
gtsam::noiseModel::mEstimator::L2WithDeadZone::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:418
gtsam::noiseModel::mEstimator::Cauchy::ksquared_
double ksquared_
Definition: LossFunctions.h:259
gtsam::noiseModel::mEstimator::Welsch::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:309
gtsam::noiseModel::mEstimator::GemanMcClure::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:337
gtsam::noiseModel::mEstimator::Fair::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:157
gtsam::noiseModel::mEstimator::Fair
Definition: LossFunctions.h:182
gtsam::Matrix
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
gtsam::noiseModel::mEstimator::AsymmetricCauchy::ksquared_
double ksquared_
Definition: LossFunctions.h:521
gtsam::noiseModel::mEstimator::Huber::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:184
gtsam::noiseModel::mEstimator::L2WithDeadZone::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:400
exp
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
Definition: ArrayCwiseUnaryOps.h:97
gtsam::noiseModel::mEstimator::Welsch::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:303
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:39
gtsam::noiseModel::mEstimator::Huber::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:193
gtsam::noiseModel::mEstimator::L2WithDeadZone::shared_ptr
std::shared_ptr< L2WithDeadZone > shared_ptr
Definition: LossFunctions.h:452
gtsam::noiseModel::mEstimator::Huber
Definition: LossFunctions.h:217
gtsam::noiseModel::mEstimator::Cauchy::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:221
gtsam::noiseModel::mEstimator::L2WithDeadZone::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:409
gtsam::noiseModel::mEstimator::Base::reweight_
ReweightScheme reweight_
Strategy for reweighting.
Definition: LossFunctions.h:75
gtsam::noiseModel::mEstimator::AsymmetricTukey::shared_ptr
std::shared_ptr< AsymmetricTukey > shared_ptr
Definition: LossFunctions.h:488
gtsam::noiseModel::mEstimator::Tukey::csquared_
double csquared_
Definition: LossFunctions.h:295
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
gtsam::noiseModel::mEstimator::Welsch::shared_ptr
std::shared_ptr< Welsch > shared_ptr
Definition: LossFunctions.h:333
gtsam::noiseModel::mEstimator::Tukey::c_
double c_
Definition: LossFunctions.h:295
gtsam::noiseModel::mEstimator::GemanMcClure::c_
double c_
Definition: LossFunctions.h:380
n
int n
Definition: BiCGSTAB_simple.cpp:1
gtsam::noiseModel::mEstimator::Tukey::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:269
gtsam::noiseModel::mEstimator::Null
Definition: LossFunctions.h:151
gtsam::noiseModel::mEstimator::Custom::Custom
Custom()=default
gtsam::noiseModel::mEstimator::Cauchy::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:217
gtsam::noiseModel::mEstimator::Base::shared_ptr
std::shared_ptr< Base > shared_ptr
Definition: LossFunctions.h:71
gtsam::noiseModel::mEstimator::Welsch::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:294
expm1
double expm1(double x)
Definition: unity.c:106
gtsam::noiseModel::mEstimator::Custom::weight_
std::function< double(double)> weight_
Definition: LossFunctions.h:557
gtsam::noiseModel::mEstimator::AsymmetricCauchy::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:497
gtsam::noiseModel::mEstimator::Custom
Definition: LossFunctions.h:555
gtsam::noiseModel::mEstimator::Fair::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:146
gtsam::vector_scale_inplace
void vector_scale_inplace(const Vector &v, Matrix &A, bool inf_mask)
Definition: Matrix.cpp:481
gtsam::noiseModel::mEstimator::Huber::shared_ptr
std::shared_ptr< Huber > shared_ptr
Definition: LossFunctions.h:222
gtsam::noiseModel::mEstimator::DCS::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:379
gtsam::noiseModel::mEstimator::Null::shared_ptr
std::shared_ptr< Null > shared_ptr
Definition: LossFunctions.h:153
gtsam::noiseModel::mEstimator::AsymmetricTukey::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:466
gtsam::noiseModel::mEstimator::AsymmetricTukey::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:450
gtsam::noiseModel::mEstimator::DCS::DCS
DCS(double c=1.0, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:350
gtsam::noiseModel::mEstimator::Base::ReweightScheme
ReweightScheme
Definition: LossFunctions.h:70
gtsam::noiseModel::mEstimator::Cauchy::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:226
gtsam::noiseModel::mEstimator::AsymmetricCauchy::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:510
gtsam::noiseModel::mEstimator::Cauchy
Definition: LossFunctions.h:257
A2
static const double A2[]
Definition: expn.h:7
cholesky::expected
Matrix expected
Definition: testMatrix.cpp:971
log1p
double log1p(double x)
Definition: unity.c:49
gtsam::noiseModel::mEstimator::Custom::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:541
gtsam::noiseModel::mEstimator::AsymmetricCauchy::k_
double k_
Definition: LossFunctions.h:521
gtsam::noiseModel::mEstimator::Tukey::Tukey
Tukey(double c=4.6851, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:244
gtsam::noiseModel::mEstimator::L2WithDeadZone
Definition: LossFunctions.h:447
gtsam::noiseModel::mEstimator::Custom::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:533
gtsam::noiseModel::mEstimator::DCS::shared_ptr
std::shared_ptr< DCS > shared_ptr
Definition: LossFunctions.h:408
gtsam::noiseModel::mEstimator::Tukey::shared_ptr
std::shared_ptr< Tukey > shared_ptr
Definition: LossFunctions.h:298
gtsam::noiseModel::mEstimator::Custom::shared_ptr
std::shared_ptr< Custom > shared_ptr
Definition: LossFunctions.h:561
gtsam::noiseModel::mEstimator::Tukey::equals
bool equals(const Base &expected, double tol=1e-8) const override
Definition: LossFunctions.cpp:273
gtsam::noiseModel::mEstimator::Tukey::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:250
gtsam::noiseModel::mEstimator::DCS::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:385
LossFunctions.h
gtsam::noiseModel::mEstimator::Huber::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:179
gtsam::noiseModel::mEstimator::Custom::Create
static shared_ptr Create(std::function< double(double)> weight, std::function< double(double)> loss, const ReweightScheme reweight=Block, const std::string &name="Custom")
Definition: LossFunctions.cpp:549
gtsam::noiseModel::mEstimator::GemanMcClure::GemanMcClure
GemanMcClure(double c=1.0, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:316
gtsam::noiseModel::mEstimator::AsymmetricCauchy
Definition: LossFunctions.h:519
gtsam::noiseModel::mEstimator::DCS::c_
double c_
Definition: LossFunctions.h:420
gtsam::noiseModel::mEstimator::Custom::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:529
move
detail::enable_if_t<!detail::move_never< T >::value, T > move(object &&obj)
Definition: cast.h:1243
gtsam
traits
Definition: SFMdata.h:40
error
static double error
Definition: testRot3.cpp:37
gtsam::noiseModel::mEstimator::Fair::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:150
gtsam::noiseModel::mEstimator::AsymmetricTukey::c_
double c_
Definition: LossFunctions.h:485
gtsam::symbol_shorthand::W
Key W(std::uint64_t j)
Definition: inference/Symbol.h:170
std
Definition: BFloat16.h:88
p
float * p
Definition: Tutorial_Map_using.cpp:9
A1
static const double A1[]
Definition: expn.h:6
gtsam::noiseModel::mEstimator::AsymmetricTukey::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:462
c2
static double c2
Definition: airy.c:55
gtsam::noiseModel::mEstimator::Cauchy::k_
double k_
Definition: LossFunctions.h:259
gtsam::noiseModel::mEstimator::AsymmetricTukey
Definition: LossFunctions.h:483
gtsam::noiseModel::mEstimator::AsymmetricCauchy::shared_ptr
std::shared_ptr< AsymmetricCauchy > shared_ptr
Definition: LossFunctions.h:524
gtsam::noiseModel::mEstimator::L2WithDeadZone::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:424
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::noiseModel::mEstimator::Cauchy::Cauchy
Cauchy(double k=0.1, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:211
gtsam::noiseModel::mEstimator::Welsch
Definition: LossFunctions.h:328
gtsam::distance
Double_ distance(const OrientedPlane3_ &p)
Definition: slam/expressions.h:117
abs
#define abs(x)
Definition: datatypes.h:17
gtsam::noiseModel::mEstimator::L2WithDeadZone::k_
double k_
Definition: LossFunctions.h:449
gtsam::noiseModel::mEstimator::L2WithDeadZone::print
void print(const std::string &s) const override
Definition: LossFunctions.cpp:414
gtsam::noiseModel::mEstimator::Welsch::c_
double c_
Definition: LossFunctions.h:330
gtsam::noiseModel::mEstimator::Huber::k_
double k_
Definition: LossFunctions.h:219
gtsam::noiseModel::mEstimator::Cauchy::shared_ptr
std::shared_ptr< Cauchy > shared_ptr
Definition: LossFunctions.h:262
gtsam::noiseModel::mEstimator::AsymmetricCauchy::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:516
gtsam::noiseModel::mEstimator::Tukey::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:279
gtsam::noiseModel::mEstimator::DCS::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:354
align_3::t
Point2 t(10, 10)
gtsam::noiseModel::mEstimator::Base
Definition: LossFunctions.h:66
gtsam::noiseModel::mEstimator::Huber::Huber
Huber(double k=1.345, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:173
gtsam::noiseModel::mEstimator::DCS::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:365
gtsam::noiseModel::mEstimator::Fair::Create
static shared_ptr Create(double c, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:166
gtsam::noiseModel::mEstimator::GemanMcClure
Definition: LossFunctions.h:366
gtsam::noiseModel::mEstimator::GemanMcClure::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:343
gtsam::noiseModel::mEstimator::Tukey::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:258
gtsam::noiseModel::mEstimator::AsymmetricTukey::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:439
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::noiseModel::mEstimator::Base::reweight
void reweight(Vector &error) const
Definition: LossFunctions.cpp:51
gtsam::noiseModel::mEstimator::AsymmetricTukey::csquared_
double csquared_
Definition: LossFunctions.h:485
gtsam::noiseModel::mEstimator::DCS
Definition: LossFunctions.h:406
gtsam::noiseModel::mEstimator::Custom::name_
std::string name_
Definition: LossFunctions.h:558
gtsam::noiseModel::mEstimator::GemanMcClure::loss
double loss(double distance) const override
Definition: LossFunctions.cpp:327
gtsam::noiseModel::mEstimator::AsymmetricCauchy::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:487
gtsam::noiseModel::mEstimator::AsymmetricTukey::Create
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
Definition: LossFunctions.cpp:472
gtsam::noiseModel::mEstimator::GemanMcClure::weight
double weight(double distance) const override
Definition: LossFunctions.cpp:320
gtsam::noiseModel::mEstimator::Welsch::csquared_
double csquared_
Definition: LossFunctions.h:330


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:57