27 #include <boost/make_shared.hpp> 28 #include <boost/serialization/version.hpp> 29 #include <boost/serialization/split_member.hpp> 36 class GaussianFactorGraph;
37 class GaussianConditional;
48 GTSAM_EXPORT std::pair<boost::shared_ptr<GaussianConditional>, boost::shared_ptr<JacobianFactor> >
142 template<
typename TERMS>
149 template<
typename KEYS>
191 boost::make_shared<JacobianFactor>(*this));
195 void print(
const std::string&
s =
"",
211 Matrix augmentedInformation()
const override;
216 Matrix information()
const override;
219 using Base::hessianDiagonal;
225 void hessianDiagonal(
double* d)
const override;
228 std::map<Key,Matrix> hessianBlockDiagonal()
const override;
233 std::pair<Matrix, Vector> jacobian()
const override;
238 std::pair<Matrix, Vector> jacobianUnweighted()
const;
243 Matrix augmentedJacobian()
const override;
248 Matrix augmentedJacobianUnweighted()
const;
268 return model_ && model_->isConstrained();
275 return Ab_(variable - begin()).
cols();
295 const constBVector
getb()
const {
return Ab_(
size()).col(0); }
324 void transposeMultiplyAdd(
double alpha,
const Vector&
e,
328 void multiplyHessianAdd(
double alpha,
const VectorValues& x,
339 void multiplyHessianAdd(
double alpha,
const double* x,
double* y,
340 const std::vector<size_t>& accumulatedDims)
const;
346 void gradientAtZero(
double* d)
const override;
355 std::pair<boost::shared_ptr<GaussianConditional>, shared_ptr>
359 void setModel(
bool anyConstrained,
const Vector&
sigmas);
372 friend GTSAM_EXPORT std::pair<boost::shared_ptr<GaussianConditional>, shared_ptr>
382 boost::shared_ptr<GaussianConditional> splitConditional(
size_t nrFrontals);
387 template<
typename TERMS>
396 void JacobianFactorHelper(
406 template<
class KEYS,
class DIMENSIONS>
409 Base(keys), Ab_(dims.begin(), dims.
end(), m, true), model_(
model) {
416 friend class boost::serialization::access;
417 template<
class ARCHIVE>
423 ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
424 ar << BOOST_SERIALIZATION_NVP(Ab_);
425 bool model_null =
false;
426 if(model_.get() ==
nullptr) {
428 ar << boost::serialization::make_nvp(
"model_null", model_null);
430 ar << boost::serialization::make_nvp(
"model_null", model_null);
431 ar << BOOST_SERIALIZATION_NVP(model_);
435 template<
class ARCHIVE>
438 ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
439 ar >> BOOST_SERIALIZATION_NVP(Ab_);
441 ar >> BOOST_SERIALIZATION_NVP(model_);
444 ar >> BOOST_SERIALIZATION_NVP(model_null);
446 ar >> BOOST_SERIALIZATION_NVP(model_);
451 BOOST_SERIALIZATION_SPLIT_MEMBER()
462 #include <gtsam/linear/JacobianFactor-inl.h> void print(const Matrix &A, const string &s, ostream &stream)
const VerticalBlockMatrix & matrixObject() const
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, 1,!IsRowMajor > ConstColXpr
noiseModel::Diagonal::shared_ptr model
static enum @843 ordering
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
noiseModel::Diagonal::shared_ptr model_
A factor with a quadratic error function - a Gaussian.
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1,!IsRowMajor > ColXpr
GaussianFactorGraph factors(list_of(factor1)(factor2)(factor3))
Point2 operator*(double s, const Point2 &p)
multiply with scalar
NonlinearFactorGraph graph
JacobianFactor(const JacobianFactor &jf)
static const KeyFormatter DefaultKeyFormatter
SharedDiagonal & get_model()
ptrdiff_t DenseIndex
The index type for Eigen objects.
const KeyFormatter & formatter
Included from all GTSAM files.
VariableSlots describes the structure of a combined factor in terms of where each block comes from in...
void load(ARCHIVE &ar, const unsigned int version)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
void save(ARCHIVE &ar, const unsigned int version) const
GaussianFactor::shared_ptr clone() const override
const constBVector getb() const
constABlock::ConstColXpr constBVector
VerticalBlockMatrix::constBlock constABlock
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
bool empty() const override
DenseIndex getDim(const_iterator variable) const override
VerticalBlockMatrix::Block ABlock
JacobianFactor(const KEYS &keys, const DIMENSIONS &dims, DenseIndex m, const SharedDiagonal &model=SharedDiagonal())
constABlock getA(const_iterator variable) const
boost::shared_ptr< Diagonal > shared_ptr
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
ABlock getA(iterator variable)
const SharedDiagonal & get_model() const
Block range(DenseIndex startBlock, DenseIndex endBlock)
VerticalBlockMatrix & matrixObject()
noiseModel::Diagonal::shared_ptr SharedDiagonal
bool isConstrained() const
Expression of a fixed-size or dynamic-size block.
JacobianFactor This
Typedef to this class.
A Gaussian factor using the canonical parameters (information form)
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
KeyVector::const_iterator const_iterator
Const iterator over keys.
DenseIndex cols() const
Column size.
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
~JacobianFactor() override
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 x
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
std::uint64_t Key
Integer nonlinear key type.
GaussianFactor Base
Typedef to base class.
DenseIndex rows() const
Row size.