63 std::cout << s <<
"AntiFactor version of:" << std::endl;
64 factor_->print(s, keyFormatter);
69 const This *
e =
dynamic_cast<const This*
> (&
expected);
70 return e !=
nullptr &&
Base::equals(*e,
tol) && this->factor_->equals(*e->factor_,
tol);
80 double error(
const Values&
c)
const override {
return -factor_->error(c); }
83 size_t dim()
const override {
return factor_->dim(); }
89 bool active(
const Values&
c)
const override {
return factor_->active(c); }
103 return gaussianFactor->negate();
109 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 111 friend class boost::serialization::access;
112 template<
class ARCHIVE>
113 void serialize(ARCHIVE & ar,
const unsigned int ) {
114 ar & boost::serialization::make_nvp(
"AntiFactor",
115 boost::serialization::base_object<Base>(*
this));
116 ar & BOOST_SERIALIZATION_NVP(factor_);
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
std::string serialize(const T &input)
serializes to a string
std::shared_ptr< AntiFactor > shared_ptr
A factor with a quadratic error function - a Gaussian.
static const KeyFormatter DefaultKeyFormatter
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
double error(const Values &c) const override
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
bool active(const Values &c) const override
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Non-linear factor base classes.
std::shared_ptr< This > shared_ptr
gtsam::NonlinearFactor::shared_ptr clone() const override
AntiFactor(NonlinearFactor::shared_ptr factor)
const KeyVector & keys() const
Access the factor's involved variable keys.
std::shared_ptr< GaussianFactor > linearize(const Values &c) const override
NonlinearFactor::shared_ptr sharedFactor
size_t dim() const override