JacobianMap.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <gtsam/inference/Key.h>
22 #include <gtsam/base/FastVector.h>
24 
25 namespace gtsam {
26 namespace internal {
27 
28 // A JacobianMap is the primary mechanism by which derivatives are returned.
29 // Expressions are designed to write their derivatives into an already allocated
30 // Jacobian of the correct size, of type VerticalBlockMatrix.
31 // The JacobianMap provides a mapping from keys to the underlying blocks.
32 class JacobianMap {
33 private:
34  const KeyVector& keys_;
36 
37 public:
40  keys_(keys), Ab_(Ab) {
41  }
42 
45  KeyVector::const_iterator it = std::find(keys_.begin(), keys_.end(), key);
46  DenseIndex block = it - keys_.begin();
47  return Ab_(block);
48  }
49 };
50 
51 } // namespace internal
52 } // namespace gtsam
53 
Eigen::Block
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
FastVector.h
A thin wrapper around std::vector that uses a custom allocator.
keys
const KeyVector keys
Definition: testRegularImplicitSchurFactor.cpp:40
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:92
block
m m block(1, 0, 2, 2)<< 4
Key.h
gtsam::VerticalBlockMatrix
Definition: VerticalBlockMatrix.h:42
gtsam::internal::JacobianMap::Ab_
VerticalBlockMatrix & Ab_
Definition: JacobianMap.h:35
VerticalBlockMatrix.h
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
gtsam::internal::JacobianMap
Definition: JacobianMap.h:32
gtsam::internal::JacobianMap::JacobianMap
JacobianMap(const KeyVector &keys, VerticalBlockMatrix &Ab)
Construct a JacobianMap for writing into a VerticalBlockMatrix Ab.
Definition: JacobianMap.h:39
key
const gtsam::Symbol key('X', 0)
gtsam
traits
Definition: SFMdata.h:40
gtsam::internal::JacobianMap::operator()
VerticalBlockMatrix::Block operator()(Key key)
Access blocks of via key.
Definition: JacobianMap.h:44
gtsam::DenseIndex
ptrdiff_t DenseIndex
The index type for Eigen objects.
Definition: types.h:103
exampleQR::Ab
Matrix Ab
Definition: testNoiseModel.cpp:207
internal
Definition: BandTriangularSolver.h:13
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
gtsam::internal::JacobianMap::keys_
const KeyVector & keys_
Definition: JacobianMap.h:34


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:34