JacobianFactorSVD.h
Go to the documentation of this file.
1 /*
2  * @file JacobianFactorSVD.h
3  * @date Oct 27, 2013
4  * @uthor Frank Dellaert
5  */
6 
7 #pragma once
9 
10 namespace gtsam {
27 template<size_t D, size_t ZDim>
29 
31  typedef Eigen::Matrix<double, ZDim, D> MatrixZD; // e.g 2 x 6 with Z=Point2
32  typedef std::pair<Key, Matrix> KeyMatrix;
33 
34 public:
35 
38  }
39 
42  const SharedDiagonal& model = SharedDiagonal()) :
43  Base() {
44  Matrix zeroMatrix = Matrix::Zero(0, D);
45  Vector zeroVector = Vector::Zero(0);
46  std::vector<KeyMatrix> QF;
47  QF.reserve(keys.size());
48  for(const Key& key: keys)
49  QF.push_back(KeyMatrix(key, zeroMatrix));
50  JacobianFactor::fillTerms(QF, zeroVector, model);
51  }
52 
62  const std::vector<MatrixZD, Eigen::aligned_allocator<MatrixZD> >& Fblocks, const Matrix& Enull,
63  const Vector& b, //
64  const SharedDiagonal& model = SharedDiagonal()) :
65  Base() {
66  size_t numKeys = Enull.rows() / ZDim;
67  size_t m2 = ZDim * numKeys - 3; // TODO: is this not just Enull.rows()?
68  // PLAIN nullptr SPACE TRICK
69  // Matrix Q = Enull * Enull.transpose();
70  // for(const KeyMatrixZD& it: Fblocks)
71  // QF.push_back(KeyMatrix(it.first, Q.block(0, 2 * j++, m2, 2) * it.second));
72  // JacobianFactor factor(QF, Q * b);
73  std::vector<KeyMatrix> QF;
74  QF.reserve(numKeys);
75  for (size_t k = 0; k < Fblocks.size(); ++k) {
76  Key key = keys[k];
77  QF.push_back(
78  KeyMatrix(key,
79  (Enull.transpose()).block(0, ZDim * k, m2, ZDim) * Fblocks[k]));
80  }
81  JacobianFactor::fillTerms(QF, Enull.transpose() * b, model);
82  }
83 };
84 
85 }
void fillTerms(const TERMS &terms, const Vector &b, const SharedDiagonal &noiseModel)
Internal function to fill blocks and set dimensions.
Eigen::Matrix< double, ZDim, D > MatrixZD
m m block(1, 0, 2, 2)<< 4
noiseModel::Diagonal::shared_ptr model
JacobianFactorSVD(const KeyVector &keys, const SharedDiagonal &model=SharedDiagonal())
Empty constructor with keys.
MatrixType m2(n_dims)
RegularJacobianFactor< D > Base
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
JacobianFactorSVD()
Default constructor.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
Eigen::VectorXd Vector
Definition: Vector.h:38
STL compatible allocator to use with types requiring a non standrad alignment.
Definition: Memory.h:721
std::pair< Key, Matrix > KeyMatrix
JacobianFactor class with fixed sized blcoks.
const G & b
Definition: Group.h:83
JacobianFactorSVD(const KeyVector &keys, const std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > &Fblocks, const Matrix &Enull, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Constructor Takes the CameraSet derivatives (as ZDim*D blocks of block-diagonal F) and a reduced poin...
noiseModel::Diagonal::shared_ptr SharedDiagonal
Definition: NoiseModel.h:736
traits
Definition: chartTesting.h:28
const KeyVector & keys() const
Access the factor&#39;s involved variable keys.
Definition: Factor.h:124
The matrix class, also used for vectors and row-vectors.
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:23