gtsam  4.0.0
gtsam
Scatter.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 
20 #pragma once
21 
22 #include <gtsam/inference/Key.h>
23 #include <gtsam/base/FastMap.h>
24 #include <gtsam/dllexport.h>
25 
26 #include <boost/optional.hpp>
27 
28 namespace gtsam {
29 
30 class GaussianFactorGraph;
31 class Ordering;
32 
34 struct GTSAM_EXPORT SlotEntry {
35  Key key;
36  size_t dimension;
37  SlotEntry(Key _key, size_t _dimension) : key(_key), dimension(_dimension) {}
38  std::string toString() const;
39  friend bool operator<(const SlotEntry& p, const SlotEntry& q) {
40  return p.key < q.key;
41  }
42  static bool Zero(const SlotEntry& p) { return p.dimension==0;}
43 };
44 
51 class Scatter : public FastVector<SlotEntry> {
52  public:
54  Scatter() {}
55 
57  Scatter(const GaussianFactorGraph& gfg,
58  boost::optional<const Ordering&> ordering = boost::none);
59 
61  void add(Key key, size_t dim);
62 
63  private:
64 
66  iterator find(Key key);
67 };
68 
69 } // \ namespace gtsam
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
One SlotEntry stores the slot index for a variable, as well its dim.
Definition: Scatter.h:34
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:65
Scatter()
Default Constructor.
Definition: Scatter.h:54
A thin wrapper around std::map that uses boost's fast_pool_allocator.
Scatter is an intermediate data structure used when building a HessianFactor incrementally,...
Definition: Scatter.h:51
void add(Key key, size_t dim)
Add a key/dim pair.
Definition: Scatter.cpp:76
Global functions in a separate testing namespace.
Definition: chartTesting.h:28