| 1 | /** |
| 2 | * @file DummyFactor.h |
| 3 | * @brief Just to help in timing overhead |
| 4 | * @author Frank Dellaert |
| 5 | */ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <gtsam/slam/RegularImplicitSchurFactor.h> |
| 10 | |
| 11 | namespace gtsam { |
| 12 | |
| 13 | /** |
| 14 | * DummyFactor |
| 15 | */ |
| 16 | template<typename CAMERA> // |
| 17 | class DummyFactor: public RegularImplicitSchurFactor<CAMERA> { |
| 18 | |
| 19 | public: |
| 20 | |
| 21 | typedef Eigen::Matrix<double, 2, CAMERA::dimension> Matrix2D; |
| 22 | typedef std::pair<Key, Matrix2D> KeyMatrix2D; |
| 23 | |
| 24 | DummyFactor() { |
| 25 | } |
| 26 | |
| 27 | DummyFactor(const std::vector<KeyMatrix2D>& Fblocks, const Matrix& E, |
| 28 | const Matrix3& P, const Vector& b) : |
| 29 | RegularImplicitSchurFactor<CAMERA>(Fblocks, E, P, b) { |
| 30 | } |
| 31 | |
| 32 | virtual ~DummyFactor() { |
| 33 | } |
| 34 | |
| 35 | public: |
| 36 | |
| 37 | /** |
| 38 | * @brief Dummy version to measure overhead of key access |
| 39 | */ |
| 40 | void multiplyHessian(double alpha, const VectorValues& x, |
| 41 | VectorValues& y) const { |
| 42 | |
| 43 | for(const KeyMatrix2D& Fi: this->Fblocks_) { |
| 44 | static const Vector empty; |
| 45 | Key key = Fi.first; |
| 46 | std::pair<VectorValues::iterator, bool> it = y.tryInsert(j: key, value: empty); |
| 47 | Vector& yi = it.first->second; |
| 48 | yi = x.at(j: key); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | }; |
| 53 | // DummyFactor |
| 54 | |
| 55 | } |
| 56 | |
| 57 | |