16 #include <boost/shared_ptr.hpp> 20 namespace gtsam {
namespace partition {
41 : key1(index1, type1), key2(index2, type2), index(index_), weight(weight_) {}
42 GenericFactor2D(
const size_t index1,
const char type1,
const size_t index2,
const char type2,
const int index_ = -1,
const int weight_ = 1)
43 : key1(index1, type1 ==
'x' ?
NODE_POSE_2D : NODE_LANDMARK_2D),
44 key2(index2, type2 ==
'x' ?
NODE_POSE_2D : NODE_LANDMARK_2D), index(index_), weight(weight_) {}
53 const int minNrConstraintsPerCamera,
const int minNrConstraintsPerLandmark);
56 inline void reduceGenericGraph(
const GenericGraph2D&
graph,
const std::vector<size_t>& cameraKeys,
const std::vector<size_t>& landmarkKeys,
57 const std::vector<int>& dictionary, GenericGraph2D& reducedGraph) {
58 throw std::runtime_error(
"reduceGenericGraph 2d not implemented");
63 WorkSpace& workspace,
const int minNrConstraintsPerCamera,
const int minNrConstraintsPerLandmark) {
return; }
66 void print(
const GenericGraph2D&
graph,
const std::string
name =
"GenericGraph2D");
92 : key1(index1, type1), key2(index2, type2), index(index_), weight(weight_) {}
100 std::list<std::vector<size_t> >
findIslands(
const GenericGraph3D& graph,
const std::vector<size_t>&
keys,
WorkSpace& workspace,
101 const size_t minNrConstraintsPerCamera,
const size_t minNrConstraintsPerLandmark);
104 void reduceGenericGraph(
const GenericGraph3D& graph,
const std::vector<size_t>& cameraKeys,
const std::vector<size_t>& landmarkKeys,
105 const std::vector<int>& dictionary, GenericGraph3D& reducedGraph);
108 void checkSingularity(
const GenericGraph3D& graph,
const std::vector<size_t>& frontals,
109 WorkSpace& workspace,
const size_t minNrConstraintsPerCamera,
const size_t minNrConstraintsPerLandmark);
113 void print(
const GenericGraph3D& graph,
const std::string
name =
"GenericGraph3D");
123 : key(key_, type_), index(index_) {}
125 : key(key_, type_ ==
'x' ?
NODE_POSE_2D : NODE_LANDMARK_2D), index(index_) {}
135 inline bool hasCommonCamera(
const std::set<size_t>& cameras1,
const std::set<size_t>& cameras2) {
136 if (cameras1.empty() || cameras2.empty())
137 throw std::invalid_argument(
"hasCommonCamera: the input camera set is empty!");
138 std::set<size_t>::const_iterator it1 = cameras1.begin();
139 std::set<size_t>::const_iterator it2 = cameras2.begin();
140 while (it1 != cameras1.end() && it2 != cameras2.end()) {
143 else if (*it1 < *it2)
list< vector< size_t > > findIslands(const GenericGraph2D &graph, const vector< size_t > &keys, WorkSpace &workspace, const int minNrConstraintsPerCamera, const int minNrConstraintsPerLandmark)
void checkSingularity(const GenericGraph3D &graph, const std::vector< size_t > &frontals, WorkSpace &workspace, const size_t minNrConstraintsPerCamera, const size_t minNrConstraintsPerLandmark)
bool hasCommonCamera(const std::set< size_t > &cameras1, const std::set< size_t > &cameras2)
GenericFactor2D(const size_t index1, const GenericNode2DType type1, const size_t index2, const GenericNode2DType type2, const int index_=-1, const int weight_=1)
GenericUnaryFactor(const size_t key_, const GenericNode2DType type_, const int index_=-1)
boost::shared_ptr< GenericFactor3D > sharedGenericFactor3D
std::vector< sharedGenericUnaryFactor > GenericUnaryGraph
NonlinearFactorGraph graph
void print(const GenericGraph2D &graph, const std::string name)
std::vector< sharedGenericFactor2D > GenericGraph2D
std::vector< sharedGenericFactor3D > GenericGraph3D
boost::shared_ptr< GenericFactor2D > sharedGenericFactor2D
GenericUnaryFactor(const size_t key_, const char type_, const int index_=-1)
void reduceGenericGraph(const GenericGraph3D &graph, const std::vector< size_t > &cameraKeys, const std::vector< size_t > &landmarkKeys, const std::vector< int > &dictionary, GenericGraph3D &reducedGraph)
GenericNode3D(const std::size_t &index_in, const GenericNode3DType &type_in)
GenericFactor3D(const size_t index1, const size_t index2, const int index_=-1, const GenericNode3DType type1=NODE_POSE_3D, const GenericNode3DType type2=NODE_LANDMARK_3D, const int weight_=1)
GenericFactor2D(const size_t index1, const char type1, const size_t index2, const char type2, const int index_=-1, const int weight_=1)
boost::shared_ptr< GenericUnaryFactor > sharedGenericUnaryFactor
Annotation for function names.
GenericNode2D(const std::size_t &index_in, const GenericNode2DType &type_in)