gtsam
Loading...
Searching...
No Matches
KeyInfo.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
18
19#pragma once
20
21#include <gtsam/base/Vector.h>
22#include <gtsam/dllexport.h>
24
25#include <map>
26#include <vector>
27
28namespace gtsam {
29
31class VectorValues;
32
34struct GTSAM_EXPORT KeyInfoEntry {
35 size_t index = 0;
36 size_t dim = 0;
37 size_t start = 0;
38
39 KeyInfoEntry() = default;
40 KeyInfoEntry(size_t index, size_t dimension, size_t start)
41 : index(index), dim(dimension), start(start) {}
42};
43
51class GTSAM_EXPORT KeyInfo : public std::map<Key, KeyInfoEntry> {
52 public:
53 using Base = std::map<Key, KeyInfoEntry>;
54
56 KeyInfo() = default;
57
59 explicit KeyInfo(const GaussianFactorGraph& graph);
60
62 KeyInfo(const GaussianFactorGraph& graph, const Ordering& ordering);
63
65 explicit KeyInfo(const std::map<Key, size_t>& dimensions);
66
68 KeyInfo(const std::map<Key, size_t>& dimensions, const Ordering& ordering);
69
71 size_t numCols() const { return numCols_; }
72
74 const Ordering& ordering() const { return ordering_; }
75
77 std::vector<size_t> colSpec() const;
78
80 VectorValues x0() const;
81
83 Vector x0vector() const;
84
85 private:
86 Ordering ordering_;
87 size_t numCols_ = 0;
88
89 void initialize(const std::map<Key, size_t>& dimensions);
90};
91
98GTSAM_EXPORT VectorValues buildVectorValues(const Vector& vector,
99 const KeyInfo& keyInfo);
100
101} // namespace gtsam
typedef and functions to augment Eigen's VectorXd
Variable ordering for the elimination algorithm.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
VectorValues buildVectorValues(const Vector &vector, const KeyInfo &keyInfo)
Split a flat vector into keyed blocks using KeyInfo offsets and dimensions.
Definition KeyInfo.cpp:107
Definition Ordering.h:33
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77
KeyInfo()=default
Construct an empty layout.
const Ordering & ordering() const
Return the key block ordering.
Definition KeyInfo.h:74
size_t numCols() const
Return the total scalar dimension.
Definition KeyInfo.h:71
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:73
The Factor::error simply extracts the.
STL class.