29 for(
const Key&
key: gaussian->keys()) {
45 :
Base(jacobian, lin_points) {
48 size_t *dims = (
size_t *)alloca(
sizeof(
size_t) * (jacobian->size() + 1));
51 dims[index++] = jacobian->getDim(
iter);
58 Ab_.
matrix() = jacobian->augmentedJacobian();
64 std::cout << s << std::endl;
66 std::cout <<
"Nonlinear Keys: ";
68 std::cout << keyFormatter(
key) <<
" ";
69 std::cout << std::endl;
72 std::cout << boost::format(
"A[%1%]=\n")%keyFormatter(*
key) <<
A(*
key) << std::endl;
73 std::cout <<
"b=\n" <<
b() << std::endl;
98 return 0.5 * errorVector.dot(errorVector);
102 boost::shared_ptr<GaussianFactor>
106 std::vector<std::pair<Key, Matrix> > terms;
108 terms.push_back(std::make_pair(
key, this->
A(
key)));
127 errorVector += A *
d;
142 :
Base(hessian, lin_points), info_(hessian->
info()) {}
147 std::cout << s << std::endl;
149 std::cout <<
"Nonlinear Keys: ";
151 std::cout << keyFormatter(
key) <<
" ";
152 std::cout << std::endl;
166 thisMatrix(thisMatrix.rows()-1, thisMatrix.cols()-1) = 0.0;
167 Matrix rhsMatrix = e->info_.selfadjointView();
168 rhsMatrix(rhsMatrix.rows()-1, rhsMatrix.cols()-1) = 0.0;
184 for(
unsigned int i = 0;
i < this->
size(); ++
i){
186 const Value& newPt = c.
at(key);
189 index += linPt.
dim();
197 return 0.5 * (f - 2.0 * xtg + xGx);
201 boost::shared_ptr<GaussianFactor>
207 for(
unsigned int i = 0;
i < this->
size(); ++
i){
209 const Value& newPt = c.
at(key);
212 index += linPt.
dim();
222 std::vector<Vector> gs;
226 gs.push_back(g.segment(offset, dim));
232 std::vector<Matrix> Gs;
void print(const Matrix &A, const string &s, ostream &stream)
Vector error_vector(const Values &c) const
void insert(Key j, const Value &val)
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
const Matrix & matrix() const
const_iterator end() 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 set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
iterator iter(handle obj)
LinearizedHessianFactor()
size_t dim() const override
virtual Vector localCoordinates_(const Value &value) const =0
bool equals(const Values &other, double tol=1e-9) const
LinearizedJacobianFactor()
ptrdiff_t DenseIndex
The index type for Eigen objects.
void g(const string &key, int i)
static shared_ptr Create(size_t dim)
boost::shared_ptr< GaussianFactor > linearize(const Values &c) const override
DenseIndex nBlocks() const
Block count.
double error(const Values &c) const override
double constantTerm() const
const ValueType at(Key j) const
const_iterator begin() const
size_t dim() const override
constColumn linearTerm() const
boost::shared_ptr< This > shared_ptr
A shared_ptr to this class.
A dummy factor that allows a linear factor to act as a nonlinear factor.
Eigen::SelfAdjointView< constBlock, Eigen::Upper > squaredTerm() 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 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const constBVector b() const
constBlock aboveDiagonalBlock(DenseIndex I, DenseIndex J) const
Get block above the diagonal (I, J).
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
virtual size_t dim() const =0
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
Block range(DenseIndex startBlock, DenseIndex endBlock)
const constABlock A() const
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
Expression of a fixed-size or dynamic-size block.
const KeyVector & keys() const
Access the factor's involved variable keys.
boost::shared_ptr< GaussianFactor > linearize(const Values &c) const override
double error(const Values &c) const override
Eigen::SelfAdjointView< constBlock, Eigen::Upper > selfadjointView(DenseIndex I, DenseIndex J) const
Return the square sub-matrix that contains blocks(i:j, i:j).
A Gaussian factor using the canonical parameters (information form)
DenseIndex getDim(DenseIndex block) const
Number of dimensions for variable on this diagonal block.
Eigen::SelfAdjointView< Block, Eigen::Upper > diagonalBlock(DenseIndex J)
Return the J'th diagonal block as a self adjoint view.
KeyVector::const_iterator const_iterator
Const iterator over keys.
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
DenseIndex nBlocks() const
Block count.
SymmetricBlockMatrix info_
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
std::uint64_t Key
Integer nonlinear key type.
LinearizedGaussianFactor()