27 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 28 #include <boost/serialization/version.hpp> 29 #include <boost/serialization/split_member.hpp> 37 class GaussianFactorGraph;
49 GTSAM_EXPORT std::pair<std::shared_ptr<GaussianConditional>, std::shared_ptr<JacobianFactor> >
143 template<
typename TERMS>
150 template<
typename KEYS>
192 std::make_shared<JacobianFactor>(*this));
196 void print(
const std::string&
s =
"",
217 Matrix augmentedInformation()
const override;
222 Matrix information()
const override;
225 using Base::hessianDiagonal;
231 void hessianDiagonal(
double* d)
const override;
234 std::map<Key,Matrix> hessianBlockDiagonal()
const override;
239 std::pair<Matrix, Vector> jacobian()
const override;
244 std::pair<Matrix, Vector> jacobianUnweighted()
const;
249 Matrix augmentedJacobian()
const override;
254 Matrix augmentedJacobianUnweighted()
const;
271 return model_ && model_->isConstrained();
278 return Ab_(variable - begin()).
cols();
298 const constBVector
getb()
const {
return Ab_(
size()).col(0); }
327 void transposeMultiplyAdd(
double alpha,
const Vector&
e,
331 void multiplyHessianAdd(
double alpha,
const VectorValues& x,
342 void multiplyHessianAdd(
double alpha,
const double* x,
double* y,
343 const std::vector<size_t>& accumulatedDims)
const;
349 void gradientAtZero(
double* d)
const override;
358 std::pair<std::shared_ptr<GaussianConditional>, shared_ptr>
362 void setModel(
bool anyConstrained,
const Vector&
sigmas);
375 friend GTSAM_EXPORT std::pair<std::shared_ptr<GaussianConditional>, shared_ptr>
385 std::shared_ptr<GaussianConditional> splitConditional(
size_t nrFrontals);
390 template<
typename TERMS>
399 void JacobianFactorHelper(
409 template<
class KEYS,
class DIMENSIONS>
412 Base(keys), Ab_(dims.begin(), dims.
end(), m, true), model_(
model) {
418 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 420 friend class boost::serialization::access;
421 template<
class ARCHIVE>
422 void save(ARCHIVE & ar,
const unsigned int version)
const {
427 ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
428 ar << BOOST_SERIALIZATION_NVP(Ab_);
429 bool model_null =
false;
430 if(model_.get() ==
nullptr) {
432 ar << boost::serialization::make_nvp(
"model_null", model_null);
434 ar << boost::serialization::make_nvp(
"model_null", model_null);
435 ar << BOOST_SERIALIZATION_NVP(model_);
439 template<
class ARCHIVE>
440 void load(ARCHIVE & ar,
const unsigned int version) {
442 ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
443 ar >> BOOST_SERIALIZATION_NVP(Ab_);
445 ar >> BOOST_SERIALIZATION_NVP(model_);
448 ar >> BOOST_SERIALIZATION_NVP(model_null);
450 ar >> BOOST_SERIALIZATION_NVP(model_);
455 BOOST_SERIALIZATION_SPLIT_MEMBER()
465 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION void print(const Matrix &A, const string &s, ostream &stream)
const gtsam::Symbol key('X', 0)
DenseIndex cols() const
Column size.
void save(const Matrix &A, const string &s, const string &filename)
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ConstColXpr
const VerticalBlockMatrix & matrixObject() const
noiseModel::Diagonal::shared_ptr model
DenseIndex rows() const
Row size.
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
noiseModel::Diagonal::shared_ptr model_
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
A factor with a quadratic error function - a Gaussian.
const GaussianFactorGraph factors
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ColXpr
Point2 operator*(double s, const Point2 &p)
multiply with scalar
NonlinearFactorGraph graph
JacobianFactor(const JacobianFactor &jf)
static const KeyFormatter DefaultKeyFormatter
static enum @1107 ordering
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...
bool isConstrained() const
GaussianFactor::shared_ptr clone() const override
constABlock::ConstColXpr constBVector
VerticalBlockMatrix::constBlock constABlock
const constBVector getb() const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
DenseIndex getDim(const_iterator variable) const override
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
VerticalBlockMatrix::Block ABlock
JacobianFactor(const KEYS &keys, const DIMENSIONS &dims, DenseIndex m, const SharedDiagonal &model=SharedDiagonal())
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
ABlock getA(iterator variable)
Block range(DenseIndex startBlock, DenseIndex endBlock)
VerticalBlockMatrix & matrixObject()
noiseModel::Diagonal::shared_ptr SharedDiagonal
Expression of a fixed-size or dynamic-size block.
static EIGEN_DEPRECATED const end_t end
JacobianFactor This
Typedef to this class.
A Gaussian factor using the canonical parameters (information form)
KeyVector::const_iterator const_iterator
Const iterator over keys.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
~JacobianFactor() override
std::shared_ptr< Diagonal > shared_ptr
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::uint64_t Key
Integer nonlinear key type.
GaussianFactor Base
Typedef to base class.
const SharedDiagonal & get_model() const
virtual double error(const VectorValues &c) const
constABlock getA(const_iterator variable) const