18 if (!linearizationPoint.
empty()) {
57 Base::print(s+
"LinearContainerFactor", keyFormatter);
59 factor_->print(
" Stored Factor", keyFormatter);
121 jacFactor->
getb() = -jacFactor->unweighted_error(delta);
125 const auto view = hesFactor->informationView();
127 Vector G_delta = view * deltaVector;
128 hesFactor->constantTerm() += deltaVector.dot(G_delta) - 2.0 * deltaVector.dot(hesFactor->linearTerm().col(0));
129 hesFactor->linearTerm() -= G_delta;
169 const std::map<Key, Key>& rekey_mapping)
const {
170 auto rekeyed_base_factor =
Base::rekey(rekey_mapping);
175 Values newLinearizationPoint;
176 for (
size_t i = 0;
i <
factor_->size(); ++
i) {
178 if (mapping != rekey_mapping.end()) {
179 new_factor->factor_->keys()[
i] = mapping->second;
183 new_factor->linearizationPoint_ = newLinearizationPoint;
196 new_factor->
factor_->keys() = new_factor->keys();
198 Values newLinearizationPoint;
199 for(
size_t i=0;
i<new_keys.size(); ++
i) {
203 new_factor->linearizationPoint_ = newLinearizationPoint;
214 for (
const auto&
f : linear_graph)
const gtsam::Symbol key('X', 0)
std::shared_ptr< HessianFactor > toHessian() const
const GaussianFactor::shared_ptr & factor() const
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
GaussianFactor::shared_ptr negateToGaussian() const
Wrap Jacobian and Hessian linear factors to allow simple injection into a nonlinear graph...
std::shared_ptr< This > shared_ptr
A shared_ptr to this class.
const ValueType at(Key j) const
const std::optional< Values > & linearizationPoint() const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set view
deref_iterator find(Key j) const
NonlinearFactor::shared_ptr rekey(const std::map< Key, Key > &rekey_mapping) const override
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
GaussianFactor::shared_ptr factor_
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
std::optional< Values > linearizationPoint_
const constBVector getb() const
size_t dim() const override
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Contains the HessianFactor class, a general quadratic factor.
Linear Factor Graph where all factors are Gaussians.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
void print(const std::string &s="", const KeyFormatter &keyFormatter=gtsam::DefaultKeyFormatter) const override
bool equals(const NonlinearFactor &f, double tol=1e-9) const override
std::vector< float > Values
bool hasLinearizationPoint() const
Casting syntactic sugar.
NonlinearFactor::shared_ptr clone() const override
std::shared_ptr< This > shared_ptr
virtual shared_ptr rekey(const std::map< Key, Key > &rekey_mapping) const
void initializeLinearizationPoint(const Values &linearizationPoint)
NonlinearFactor::shared_ptr negateToNonlinear() const
A Gaussian factor using the canonical parameters (information form)
const KeyVector & keys() const
Access the factor's involved variable keys.
void insert(Key j, const Value &val)
void reserve(size_t size)
std::shared_ptr< JacobianFactor > toJacobian() const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
static NonlinearFactorGraph ConvertLinearGraph(const GaussianFactorGraph &linear_graph, const Values &linearizationPoint=Values())
GaussianFactor::shared_ptr linearize(const Values &c) const override
double error(const Values &c) const override
std::uint64_t Key
Integer nonlinear key type.