gtsam
Loading...
Searching...
No Matches
LossFunctions.h
1
2/* ----------------------------------------------------------------------------
3
4 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
5 * Atlanta, Georgia 30332-0415
6 * All Rights Reserved
7 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
8
9 * See LICENSE for the license information
10
11 * -------------------------------------------------------------------------- */
12
20
21#pragma once
22
23#include <optional>
24#include <gtsam/base/Matrix.h>
25#include <gtsam/base/Testable.h>
26#include <gtsam/dllexport.h>
27
28#if GTSAM_ENABLE_BOOST_SERIALIZATION
29#include <boost/serialization/extended_type_info.hpp>
30#include <boost/serialization/nvp.hpp>
31#include <boost/serialization/version.hpp>
32#include <boost/serialization/optional.hpp>
33#include <boost/serialization/shared_ptr.hpp>
34#include <boost/serialization/singleton.hpp>
35#endif
36
37namespace gtsam {
38namespace noiseModel {
39// clang-format off
72// clang-format on
73namespace mEstimator {
74
81class GTSAM_EXPORT Base {
82 public:
85 enum ReweightScheme { Scalar, Block };
86 typedef std::shared_ptr<Base> shared_ptr;
87
88 protected:
91
92 public:
93 Base(const ReweightScheme reweight = Block) : reweight_(reweight) {}
94 virtual ~Base() {}
95
98
112 virtual double loss(double distance) const { return 0; }
113
124 virtual double weight(double distance) const = 0;
125
132 virtual double graduatedLoss(double distance, double mu) const = 0;
133
140 virtual double graduatedWeight(double distance, double mu) const = 0;
141
142 virtual void print(const std::string &s) const = 0;
143 virtual bool equals(const Base &expected, double tol = 1e-8) const = 0;
144
145 double sqrtWeight(double distance) const { return std::sqrt(weight(distance)); }
146
149 Vector weight(const Vector &error) const;
150
152 Vector sqrtWeight(const Vector &error) const;
153
156 void reweight(Vector &error) const;
157 void reweight(std::vector<Matrix> &A, Vector &error) const;
158 void reweight(Matrix &A, Vector &error) const;
159 void reweight(Matrix &A1, Matrix &A2, Vector &error) const;
160 void reweight(Matrix &A1, Matrix &A2, Matrix &A3, Vector &error) const;
161
162 private:
163#if GTSAM_ENABLE_BOOST_SERIALIZATION
165 friend class boost::serialization::access;
166 template <class ARCHIVE>
167 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
168 ar &BOOST_SERIALIZATION_NVP(reweight_);
169 }
170#endif
171};
172
182class GTSAM_EXPORT Null : public Base {
183 public:
184 typedef std::shared_ptr<Null> shared_ptr;
185
186 Null(const ReweightScheme reweight = Block) : Base(reweight) {}
187 ~Null() override {}
188 double weight(double /*error*/) const override { return 1.0; }
189 double loss(double distance) const override { return 0.5 * distance * distance; }
190 double graduatedWeight(double distance, double /*error*/) const override { return weight(distance); }
191 double graduatedLoss(double distance, double /*error*/) const override { return loss(distance); }
192 void print(const std::string &s) const override;
193 bool equals(const Base & /*expected*/, double /*tol*/) const override { return true; }
194 static shared_ptr Create();
195
196 private:
197#if GTSAM_ENABLE_BOOST_SERIALIZATION
199 friend class boost::serialization::access;
200 template <class ARCHIVE>
201 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
202 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
203 }
204#endif
205};
206
217class GTSAM_EXPORT Fair : public Base {
218 protected:
219 double c_;
220
221 public:
222 typedef std::shared_ptr<Fair> shared_ptr;
223
224 Fair(double c = 1.3998, const ReweightScheme reweight = Block);
225 double weight(double distance) const override;
226 double loss(double distance) const override;
227 double graduatedWeight(double /*error*/, double /*error*/) const override;
228 double graduatedLoss(double /*error*/, double /*error*/) const override;
229 void print(const std::string &s) const override;
230 bool equals(const Base &expected, double tol = 1e-8) const override;
231 static shared_ptr Create(double c, const ReweightScheme reweight = Block);
232 double modelParameter() const { return c_; }
233
234 private:
235#if GTSAM_ENABLE_BOOST_SERIALIZATION
237 friend class boost::serialization::access;
238 template <class ARCHIVE>
239 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
240 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
241 ar &BOOST_SERIALIZATION_NVP(c_);
242 }
243#endif
244};
245
257class GTSAM_EXPORT Huber : public Base {
258 protected:
259 double k_;
260
261 public:
262 typedef std::shared_ptr<Huber> shared_ptr;
263
264 Huber(double k = 1.345, const ReweightScheme reweight = Block);
265 double weight(double distance) const override;
266 double loss(double distance) const override;
267 double graduatedWeight(double distance, double mu) const override;
268 double graduatedLoss(double distance, double mu) const override;
269 void print(const std::string &s) const override;
270 bool equals(const Base &expected, double tol = 1e-8) const override;
271 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
272 double modelParameter() const { return k_; }
273
275 static double Weight(double distance, double k);
277 static double Loss(double distance, double k);
278
279 private:
280#if GTSAM_ENABLE_BOOST_SERIALIZATION
282 friend class boost::serialization::access;
283 template <class ARCHIVE>
284 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
285 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
286 ar &BOOST_SERIALIZATION_NVP(k_);
287 }
288#endif
289};
290
307class GTSAM_EXPORT Cauchy : public Base {
308 protected:
309 double k_, ksquared_;
310
311 public:
312 typedef std::shared_ptr<Cauchy> shared_ptr;
313
314 Cauchy(double k = 0.1, const ReweightScheme reweight = Block);
315 double weight(double distance) const override;
316 double loss(double distance) const override;
317 double graduatedWeight(double distance, double mu) const override;
318 double graduatedLoss(double distance, double mu) const override;
319 void print(const std::string &s) const override;
320 bool equals(const Base &expected, double tol = 1e-8) const override;
321 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
322 double modelParameter() const { return k_; }
323
325 static double Weight(double distance, double ksquared);
327 static double Loss(double distance, double ksquared);
328
329 private:
330#if GTSAM_ENABLE_BOOST_SERIALIZATION
332 friend class boost::serialization::access;
333 template <class ARCHIVE>
334 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
335 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
336 ar &BOOST_SERIALIZATION_NVP(k_);
337 ar &BOOST_SERIALIZATION_NVP(ksquared_);
338 }
339#endif
340};
341
353class GTSAM_EXPORT Tukey : public Base {
354 protected:
355 double c_, csquared_;
356
357 public:
358 typedef std::shared_ptr<Tukey> shared_ptr;
359
360 Tukey(double c = 4.6851, const ReweightScheme reweight = Block);
361 double weight(double distance) const override;
362 double loss(double distance) const override;
363 double graduatedWeight(double distance, double mu) const override;
364 double graduatedLoss(double distance, double mu) const override;
365 void print(const std::string &s) const override;
366 bool equals(const Base &expected, double tol = 1e-8) const override;
367 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
368 double modelParameter() const { return c_; }
369
371 static double Weight(double distance, double c, double csquared);
373 static double Loss(double distance, double c, double csquared);
374
375
376 private:
377#if GTSAM_ENABLE_BOOST_SERIALIZATION
379 friend class boost::serialization::access;
380 template <class ARCHIVE>
381 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
382 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
383 ar &BOOST_SERIALIZATION_NVP(c_);
384 }
385#endif
386};
387
399class GTSAM_EXPORT Welsch : public Base {
400 protected:
401 double c_, csquared_;
402
403
404 public:
405 typedef std::shared_ptr<Welsch> shared_ptr;
406
407 Welsch(double c = 2.9846, const ReweightScheme reweight = Block);
408 double weight(double distance) const override;
409 double loss(double distance) const override;
410 double graduatedWeight(double distance, double mu) const override;
411 double graduatedLoss(double distance, double mu) const override;
412 void print(const std::string &s) const override;
413 bool equals(const Base &expected, double tol = 1e-8) const override;
414 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
415 double modelParameter() const { return c_; }
416
418 static double Weight(double distance, double csquared);
420 static double Loss(double distance, double csquared);
421
422 private:
423#if GTSAM_ENABLE_BOOST_SERIALIZATION
425 friend class boost::serialization::access;
426 template <class ARCHIVE>
427 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
428 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
429 ar &BOOST_SERIALIZATION_NVP(c_);
430 ar &BOOST_SERIALIZATION_NVP(csquared_);
431 }
432#endif
433};
434
462class GTSAM_EXPORT GemanMcClure : public Base {
463 public:
464 typedef std::shared_ptr<GemanMcClure> shared_ptr;
465 enum GradScheme { STANDARD, SCALE_INVARIANT };
466
468 GemanMcClure(double c = 1.0, const ReweightScheme reweight = Block);
470 GemanMcClure(double c, const GradScheme graduation,
471 const ReweightScheme reweight = Block);
472 ~GemanMcClure() override {}
473 double weight(double distance) const override;
474 double loss(double distance) const override;
475 double graduatedWeight(double distance, double mu) const override;
476 double graduatedLoss(double distance, double mu) const override;
477 void print(const std::string &s) const override;
478 bool equals(const Base &expected, double tol = 1e-8) const override;
479 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
481 static shared_ptr Create(double k, const GradScheme graduation,
482 const ReweightScheme reweight = Block);
483 double modelParameter() const { return c_; }
485 GradScheme gradScheme() const { return graduation_; }
486
488 static double Weight(double distance2, double c2);
490 static double Loss(double distance2, double c2);
492 static double GraduatedWeight(double distance2, double c2, double mu,
493 GradScheme graduation);
495 static double GraduatedLoss(double distance2, double c2, double mu,
496 GradScheme graduation);
497
509 static double ShapeParameterFromInfluenceThreshold(
510 double influenceThreshold, size_t dof, double chiSquaredOutlierThreshold);
511
512 protected:
513 double c_;
514 double csquared_;
515 GradScheme graduation_;
516
517 private:
518#if GTSAM_ENABLE_BOOST_SERIALIZATION
520 friend class boost::serialization::access;
521 template <class ARCHIVE>
522 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
523 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
524 ar &BOOST_SERIALIZATION_NVP(c_);
525 ar &BOOST_SERIALIZATION_NVP(csquared_);
526 ar &BOOST_SERIALIZATION_NVP(graduation_);
527 }
528#endif
529};
530
573class GTSAM_EXPORT TruncatedLeastSquares : public Base {
574 public:
575 typedef std::shared_ptr<TruncatedLeastSquares> shared_ptr;
576 enum GradScheme { STANDARD, GNC_LINEAR, GNC_SUPERLINEAR };
577
579 TruncatedLeastSquares(double c = 1.0, const ReweightScheme reweight = Block);
581 TruncatedLeastSquares(double c, GradScheme graduation,
582 const ReweightScheme reweight = Block);
583 double weight(double distance) const override;
584 double loss(double distance) const override;
585 double graduatedWeight(double distance, double mu) const override;
586 double graduatedLoss(double distance, double mu) const override;
587 void print(const std::string& s) const override;
588 bool equals(const Base& expected, double tol = 1e-8) const override;
589 static shared_ptr Create(double c, const ReweightScheme reweight = Block);
591 static shared_ptr Create(double c, GradScheme graduation,
592 const ReweightScheme reweight = Block);
593 double modelParameter() const { return c_; }
595 GradScheme gradScheme() const { return graduation_; }
596
598 static double Weight(double distance2, double c2);
600 static double Loss(double distance2, double c2);
601
603 static double GraduatedWeight(double distance2, double c2, double mu,
604 GradScheme graduation);
606 static double GraduatedLoss(double distance2, double c2, double mu,
607 GradScheme graduation);
608
609 protected:
610 double c_;
611 double csquared_;
612 GradScheme graduation_;
613
614 private:
615#if GTSAM_ENABLE_BOOST_SERIALIZATION
617 friend class boost::serialization::access;
618 template <class ARCHIVE>
619 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
620 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
621 ar &BOOST_SERIALIZATION_NVP(c_);
622 ar &BOOST_SERIALIZATION_NVP(csquared_);
623 ar &BOOST_SERIALIZATION_NVP(graduation_);
624 }
625#endif
626};
627
647class GTSAM_EXPORT DCS : public Base {
648 public:
649 typedef std::shared_ptr<DCS> shared_ptr;
650
651 DCS(double c = 1.0, const ReweightScheme reweight = Block);
652 ~DCS() override {}
653 double weight(double distance) const override;
654 double loss(double distance) const override;
655 double graduatedWeight(double distance, double mu) const override;
656 double graduatedLoss(double distance, double mu) const override;
657 void print(const std::string &s) const override;
658 bool equals(const Base &expected, double tol = 1e-8) const override;
659 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
660 double modelParameter() const { return c_; }
661
663 static double Weight(double distance, double c);
665 static double Loss(double distance, double c);
666
667 protected:
668 double c_;
669
670 private:
671#if GTSAM_ENABLE_BOOST_SERIALIZATION
673 friend class boost::serialization::access;
674 template <class ARCHIVE>
675 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
676 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
677 ar &BOOST_SERIALIZATION_NVP(c_);
678 }
679#endif
680};
681
697class GTSAM_EXPORT L2WithDeadZone : public Base {
698 protected:
699 double k_;
700
701 public:
702 typedef std::shared_ptr<L2WithDeadZone> shared_ptr;
703
704 L2WithDeadZone(double k = 1.0, const ReweightScheme reweight = Block);
705 double weight(double distance) const override;
706 double loss(double distance) const override;
707 double graduatedWeight(double /*error*/, double /*error*/) const override;
708 double graduatedLoss(double /*error*/, double /*error*/) const override;
709 void print(const std::string &s) const override;
710 bool equals(const Base &expected, double tol = 1e-8) const override;
711 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
712 double modelParameter() const { return k_; }
713
714 private:
715#if GTSAM_ENABLE_BOOST_SERIALIZATION
717 friend class boost::serialization::access;
718 template <class ARCHIVE>
719 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
720 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
721 ar &BOOST_SERIALIZATION_NVP(k_);
722 }
723#endif
724};
725
737class GTSAM_EXPORT AsymmetricTukey : public Base {
738 protected:
739 double c_, csquared_;
740
741 public:
742 typedef std::shared_ptr<AsymmetricTukey> shared_ptr;
743
744 AsymmetricTukey(double c = 4.6851, const ReweightScheme reweight = Block);
745 double weight(double distance) const override;
746 double loss(double distance) const override;
747 double graduatedWeight(double /*error*/, double /*error*/) const override;
748 double graduatedLoss(double /*error*/, double /*error*/) const override;
749 void print(const std::string &s) const override;
750 bool equals(const Base &expected, double tol = 1e-8) const override;
751 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
752 double modelParameter() const { return c_; }
753
754 private:
755#if GTSAM_ENABLE_BOOST_SERIALIZATION
757 friend class boost::serialization::access;
758 template <class ARCHIVE>
759 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
760 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
761 ar &BOOST_SERIALIZATION_NVP(c_);
762 }
763#endif
764};
765
777class GTSAM_EXPORT AsymmetricCauchy : public Base {
778 protected:
779 double k_, ksquared_;
780
781 public:
782 typedef std::shared_ptr<AsymmetricCauchy> shared_ptr;
783
784 AsymmetricCauchy(double k = 0.1, const ReweightScheme reweight = Block);
785 double weight(double distance) const override;
786 double loss(double distance) const override;
787 double graduatedWeight(double /*error*/, double /*error*/) const override;
788 double graduatedLoss(double /*error*/, double /*error*/) const override;
789 void print(const std::string &s) const override;
790 bool equals(const Base &expected, double tol = 1e-8) const override;
791 static shared_ptr Create(double k, const ReweightScheme reweight = Block);
792 double modelParameter() const { return k_; }
793
794 private:
795#if GTSAM_ENABLE_BOOST_SERIALIZATION
797 friend class boost::serialization::access;
798 template <class ARCHIVE>
799 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
800 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
801 ar &BOOST_SERIALIZATION_NVP(k_);
802 ar &BOOST_SERIALIZATION_NVP(ksquared_);
803 }
804#endif
805};
806
807// Type alias for the custom loss and weight functions
808using CustomLossFunction = std::function<double(double)>;
809using CustomWeightFunction = std::function<double(double)>;
810using CustomGraduatedLossFunction =
811 std::optional<std::function<double(double, double)>>;
812using CustomGraduatedWeightFunction =
813 std::optional<std::function<double(double, double)>>;
814
821class GTSAM_EXPORT Custom : public Base {
822 protected:
823 std::function<double(double)> weight_, loss_;
824 std::optional<std::function<double(double, double)>> gradWeight_, gradLoss_;
825 std::string name_;
826
827 public:
828 typedef std::shared_ptr<Custom> shared_ptr;
829
830 Custom(CustomWeightFunction weight, CustomLossFunction loss,
831 CustomGraduatedWeightFunction gradWeight = std::nullopt,
832 CustomGraduatedLossFunction gradLoss = std::nullopt,
833 const ReweightScheme reweight = Block, std::string name = "Custom");
834 Custom(CustomWeightFunction weight, CustomLossFunction loss,
835 const ReweightScheme reweight, std::string name = "Custom");
836 double weight(double distance) const override;
837 double loss(double distance) const override;
838 double graduatedWeight(double distance, double mu) const override;
839 double graduatedLoss(double distance, double mu) const override;
840 void print(const std::string& s) const override;
841 bool equals(const Base& expected, double tol = 1e-8) const override;
842 static shared_ptr Create(
843 std::function<double(double)> weight, std::function<double(double)> loss,
844 CustomGraduatedWeightFunction gradWeight = std::nullopt,
845 CustomGraduatedLossFunction gradLoss = std::nullopt,
846 const ReweightScheme reweight = Block,
847 const std::string &name = "Custom");
848 static shared_ptr Create(std::function<double(double)> weight,
849 std::function<double(double)> loss,
851 const std::string& name = "Custom");
852 inline std::string& name() { return name_; }
853
854 inline std::function<double(double)>& weightFunction() { return weight_; }
855 inline std::function<double(double)>& lossFunction() { return loss_; }
856
857 // Default constructor for serialization
858 inline Custom() = default;
859
860 private:
861#if GTSAM_ENABLE_BOOST_SERIALIZATION
863 friend class boost::serialization::access;
864 template <class ARCHIVE>
865 void serialize(ARCHIVE &ar, const unsigned int /*version*/) {
866 ar &BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
867 ar &BOOST_SERIALIZATION_NVP(name_);
868 }
869#endif
870};
871
872} // namespace mEstimator
873} // namespace noiseModel
874} // namespace gtsam
typedef and functions to augment Eigen's MatrixXd
Concept check for values that can be used in unit tests.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
double distance2(const Point2 &p, const Point2 &q, OptionalJacobian< 1, 2 > H1, OptionalJacobian< 1, 2 > H2)
distance between two points
Definition Point2.cpp:39
All noise models live in the noiseModel namespace.
Definition LossFunctions.cpp:33
The mEstimator name space contains all robust error functions.
Definition LossFunctions.cpp:39
Template to create a binary predicate.
Definition Testable.h:112
Pure virtual class for all robust error function classes.
Definition LossFunctions.h:81
virtual double graduatedLoss(double distance, double mu) const =0
This method is responsible for returning the total penalty for a given amount of error and the curren...
virtual double loss(double distance) const
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.h:112
ReweightScheme reweight_
Strategy for reweighting.
Definition LossFunctions.h:90
ReweightScheme reweightScheme() const
Returns the reweight scheme, as explained in ReweightScheme.
Definition LossFunctions.h:97
void reweight(Vector &error) const
reweight block matrices and a vector according to their weight implementation
Definition LossFunctions.cpp:99
virtual double weight(double distance) const =0
This method is responsible for returning the weight function for a given amount of error.
virtual double graduatedWeight(double distance, double mu) const =0
This method is responsible for returning the weight for a given amount of error and the current contr...
ReweightScheme
the rows can be weighted independently according to the error or uniformly with the norm of the right...
Definition LossFunctions.h:85
double weight(double) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.h:188
double graduatedLoss(double distance, double) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.h:191
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.h:189
double graduatedWeight(double distance, double) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.h:190
double graduatedLoss(double, double) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:167
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:156
double graduatedWeight(double, double) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:163
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:152
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:211
static double Weight(double distance, double k)
Static implementation of Huber Weight.
Definition LossFunctions.cpp:193
static double Loss(double distance, double k)
Static implementation of Huber Loss.
Definition LossFunctions.cpp:198
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:207
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:217
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:209
static double Loss(double distance, double ksquared)
Static implementation of Cauchy Loss.
Definition LossFunctions.cpp:251
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:262
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:256
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:260
static double Weight(double distance, double ksquared)
Static implementation of Cauchy Weight.
Definition LossFunctions.cpp:247
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:268
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:321
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:331
static double Loss(double distance, double c, double csquared)
Static implementation of Tukey Loss.
Definition LossFunctions.cpp:306
static double Weight(double distance, double c, double csquared)
Static implementation of Tukey Weight.
Definition LossFunctions.cpp:298
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:325
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:317
static double Weight(double distance, double csquared)
Static implementation of Welsch Weight.
Definition LossFunctions.cpp:357
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:371
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:367
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:379
static double Loss(double distance, double csquared)
Static implementation of Welsch Loss.
Definition LossFunctions.cpp:362
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:373
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:453
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:457
GradScheme gradScheme() const
Returns the graduation scheme used by this loss.
Definition LossFunctions.h:485
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:449
GemanMcClure(double c=1.0, const ReweightScheme reweight=Block)
Construct standard GemanMcClure loss.
Definition LossFunctions.cpp:402
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:445
GradScheme gradScheme() const
Returns the graduation scheme used by this loss.
Definition LossFunctions.h:595
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:601
TruncatedLeastSquares(double c=1.0, const ReweightScheme reweight=Block)
Construct standard TLS loss.
Definition LossFunctions.cpp:514
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:597
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:593
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:606
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:671
static double Weight(double distance, double c)
Static implementation of DCS Weight.
Definition LossFunctions.cpp:654
static double Loss(double distance, double c)
Static implementation of DCS Loss.
Definition LossFunctions.cpp:663
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:682
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:673
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:675
double graduatedLoss(double, double) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:732
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:713
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:722
double graduatedWeight(double, double) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:727
double graduatedLoss(double, double) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:789
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:772
double graduatedWeight(double, double) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:784
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:761
double graduatedLoss(double, double) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:843
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:819
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:829
double graduatedWeight(double, double) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:838
double weight(double distance) const override
This method is responsible for returning the weight function for a given amount of error.
Definition LossFunctions.cpp:885
double loss(double distance) const override
This method is responsible for returning the total penalty for a given amount of error.
Definition LossFunctions.cpp:887
double graduatedLoss(double distance, double mu) const override
This method is responsible for returning the total penalty for a given amount of error and the curren...
Definition LossFunctions.cpp:897
double graduatedWeight(double distance, double mu) const override
This method is responsible for returning the weight for a given amount of error and the current contr...
Definition LossFunctions.cpp:889
noiseModel::Base is the abstract base class for all noise models.
Definition NoiseModel.h:60