DSFVector.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/dllexport.h>
22 #include <gtsam/global_includes.h>
23 
24 #include <memory>
25 
26 #include <vector>
27 #include <set>
28 #include <map>
29 
30 namespace gtsam {
31 
38 class GTSAM_EXPORT DSFBase {
39 
40 public:
41  typedef std::vector<size_t> V;
42 
43 private:
44  std::shared_ptr<V> v_;
45 
46 public:
48  DSFBase(const size_t numNodes);
49 
51  DSFBase(const std::shared_ptr<V>& v_in);
52 
54  size_t find(size_t key) const;
55 
57  void merge(const size_t& i1, const size_t& i2);
58 };
59 
64 class GTSAM_EXPORT DSFVector: public DSFBase {
65 
66 private:
67  std::vector<size_t> keys_;
68 
69 public:
71  DSFVector(const size_t numNodes);
72 
74  DSFVector(const std::vector<size_t>& keys);
75 
77  DSFVector(const std::shared_ptr<V>& v_in, const std::vector<size_t>& keys);
78 
79  // All operations below loop over all keys and hence are *at least* O(n)
80 
82  bool isSingleton(const size_t& label) const;
83 
85  std::set<size_t> set(const size_t& label) const;
86 
88  std::map<size_t, std::set<size_t> > sets() const;
89 
91  std::map<size_t, std::vector<size_t> > arrays() const;
92 };
93 
94 }
global_includes.h
Included from all GTSAM files.
keys
const KeyVector keys
Definition: testRegularImplicitSchurFactor.cpp:40
gtsam::DSFBase::V
std::vector< size_t > V
Vector of ints.
Definition: DSFVector.h:41
gtsam::DSFBase::v_
std::shared_ptr< V > v_
Stores parent pointers, representative iff v[i]==i.
Definition: DSFVector.h:44
key
const gtsam::Symbol key('X', 0)
set
void set(Container &c, Position position, const Value &value)
Definition: stdlist_overload.cpp:37
gtsam
traits
Definition: SFMdata.h:40
i1
double i1(double x)
Definition: i1.c:150
gtsam::DSFBase
Definition: DSFVector.h:38
gtsam::DSFVector
Definition: DSFVector.h:64
gtsam::DSFVector::keys_
std::vector< size_t > keys_
stores keys to support more expensive operations
Definition: DSFVector.h:67


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:29