Loading...
Searching...
No Matches
DSFVector.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/dllexport.h>
#include <gtsam/global_includes.h>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <set>
#include <map>
namespace gtsam {
class GTSAM_EXPORT DSFBase {
public:
typedef std::vector<size_t> V;
private:
boost::shared_ptr<V> v_;
public:
DSFBase(const size_t numNodes);
DSFBase(const boost::shared_ptr<V>& v_in);
size_t find(size_t key) const;
void merge(const size_t& i1, const size_t& i2);
};
class GTSAM_EXPORT DSFVector: public DSFBase {
private:
std::vector<size_t> keys_;
public:
DSFVector(const size_t numNodes);
DSFVector(const std::vector<size_t>& keys);
DSFVector(const boost::shared_ptr<V>& v_in, const std::vector<size_t>& keys);
// All operations below loop over all keys and hence are *at least* O(n)
bool isSingleton(const size_t& label) const;
std::set<size_t> set(const size_t& label) const;
std::map<size_t, std::set<size_t> > sets() const;
std::map<size_t, std::vector<size_t> > arrays() const;
};
}
global_includes.h
Included from all GTSAM files.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::DSFBase::find
size_t find(size_t key) const
Find the label of the set in which {key} lives.
Definition DSFVector.cpp:44
gtsam::DSFBase::merge
void merge(const size_t &i1, const size_t &i2)
Merge the sets containing i1 and i2. Does nothing if i1 and i2 are already in the same set.
Definition DSFVector.cpp:54
gtsam::DSFBase::V
std::vector< size_t > V
Vector of ints.
Definition DSFVector.h:41
gtsam::DSFBase::DSFBase
DSFBase(const size_t numNodes)
Constructor that allocates new memory, allows for keys 0...numNodes-1.
Definition DSFVector.cpp:28
gtsam::DSFVector::set
std::set< size_t > set(const size_t &label) const
Get the nodes in the tree with the given label.
Definition DSFVector.cpp:93
gtsam::DSFVector::isSingleton
bool isSingleton(const size_t &label) const
Find whether there is one and only one occurrence for the given {label}.
Definition DSFVector.cpp:79
gtsam::DSFVector::sets
std::map< size_t, std::set< size_t > > sets() const
Return all sets, i.e. a partition of all elements.
Definition DSFVector.cpp:102
gtsam::DSFVector::arrays
std::map< size_t, std::vector< size_t > > arrays() const
Return all sets, i.e. a partition of all elements.
Definition DSFVector.cpp:110
gtsam::DSFVector::DSFVector
DSFVector(const size_t numNodes)
Constructor that allocates new memory, uses sequential keys 0...numNodes-1.
Definition DSFVector.cpp:59