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 
const gtsam::Symbol key('X', 0)
m m block(1, 0, 2, 2)<< 4
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
JacobianMap(const KeyVector &keys, VerticalBlockMatrix &Ab)
Construct a JacobianMap for writing into a VerticalBlockMatrix Ab.
Definition: JacobianMap.h:39
ptrdiff_t DenseIndex
The index type for Eigen objects.
Definition: types.h:108
VerticalBlockMatrix::Block operator()(Key key)
Access blocks of via key.
Definition: JacobianMap.h:44
A thin wrapper around std::vector that uses a custom allocator.
traits
Definition: chartTesting.h:28
const KeyVector & keys_
Definition: JacobianMap.h:34
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
const KeyVector keys
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
VerticalBlockMatrix & Ab_
Definition: JacobianMap.h:35
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:27