22 #include <boost/format.hpp> 24 #pragma GCC diagnostic push 25 #pragma GCC diagnostic ignored "-Wunused-variable" 27 #include <boost/lambda/lambda.hpp> 28 #include <boost/lambda/bind.hpp> 30 #pragma GCC diagnostic pop 42 GaussianConditional::GaussianConditional(
60 cout << s <<
" Conditional density ";
62 cout << (boost::format(
"[%1%]")%(
formatter(*it))).str() <<
" ";
72 model_->print(
" Noise model: ");
74 cout <<
" No noise model" << endl;
86 list<Vector> rows1, rows2;
88 rows2.push_back(
Vector(
c->R().row(
i)));
97 rows2.push_back(
row(
c->getA(it2),
i));
129 if (solution.hasNaN()) {
137 result.
emplace(*frontal, solution.segment(vectorPosition,
getDim(frontal)));
138 vectorPosition +=
getDim(frontal);
152 xS = rhsR -
S() * xS;
159 soln.array() *=
model_->sigmas().array();
165 result.
emplace(*frontal, soln.segment(vectorPosition,
getDim(frontal)));
166 vectorPosition +=
getDim(frontal);
181 gy[*it].noalias() += -1.0 *
getA(it).transpose() * frontalVec;
185 frontalVec.array() *=
model_->sigmas().array();
190 gy[*frontal] = frontalVec.segment(vectorPosition,
getDim(frontal));
191 vectorPosition +=
getDim(frontal);
199 gy[*frontal].array() *=
model_->sigmas().segment(vectorPosition,
getDim(frontal)).array();
200 vectorPosition +=
getDim(frontal);
VectorValues solveOtherRHS(const VectorValues &parents, const VectorValues &rhs) const
std::string formatMatrixIndented(const std::string &label, const Matrix &matrix, bool makeVectorHorizontal)
const MATRIX::ConstRowXpr row(const MATRIX &A, size_t j)
void solveTransposeInPlace(VectorValues &gy) const
JacobianFactor::const_iterator endParents() const
noiseModel::Diagonal::shared_ptr model_
Rot2 R(Rot2::fromAngle(0.1))
ptrdiff_t DenseIndex
The index type for Eigen objects.
const KeyFormatter & formatter
bool equals(const GaussianFactor &cg, double tol=1e-9) const override
JacobianFactor::const_iterator beginParents() const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Key front() const
First key.
void print(const std::string &="GaussianConditional", const KeyFormatter &formatter=DefaultKeyFormatter) const override
const constBVector getb() const
JacobianFactor::const_iterator endFrontals() const
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
DenseIndex getDim(const_iterator variable) const override
Conditional Gaussian Base class.
const constBVector d() const
Exceptions that may be thrown by linear solver components.
void scaleFrontalsBySigma(VectorValues &gy) const
noiseModel::Diagonal::shared_ptr SharedDiagonal
bool linear_dependent(const Matrix &A, const Matrix &B, double tol)
JacobianFactor::const_iterator beginFrontals() const
const KeyVector & keys() const
Access the factor's involved variable keys.
VectorValues solve(const VectorValues &parents) const
KeyVector::const_iterator const_iterator
Const iterator over keys.
std::pair< VectorValues::iterator, bool > emplace(Key j, Args &&...args)
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.
Vector concatVectors(const std::list< Vector > &vs)
DenseIndex rows() const
Row size.