cleanup some formatting and comments

release/4.3a0
Ankur Roy Chowdhury 2023-02-04 20:54:08 -08:00
parent d5ec65e320
commit c3045c097d
5 changed files with 15 additions and 17 deletions

View File

@ -10,7 +10,7 @@
* -------------------------------------------------------------------------- */
/**
* @file SubgraphBuilder-inl.h
* @file kruskal-inl.h
* @date Dec 31, 2009
* @author Frank Dellaert, Yong-Dian Jian
*/

View File

@ -234,7 +234,7 @@ PredecessorMap<KEY> findMinimumSpanningTree(const G& fg) {
// Convert to a graph that boost understands
SDGraph<KEY> g = gtsam::toBoostGraph<G, FACTOR2, KEY>(fg);
// // find minimum spanning tree
// find minimum spanning tree
std::vector<typename SDGraph<KEY>::Vertex> p_map(boost::num_vertices(g));
prim_minimum_spanning_tree(g, &p_map[0]);

View File

@ -362,44 +362,44 @@ SubgraphBuilder::Weights SubgraphBuilder::weights(
using Weights = std::vector<double>;
const size_t m = gfg.size();
Weights weights;
weights.reserve(m);
Weights weight;
weight.reserve(m);
for (const GaussianFactor::shared_ptr &gf : gfg) {
switch (parameters_.skeletonWeight) {
case SubgraphBuilderParameters::EQUAL:
weights.push_back(1.0);
weight.push_back(1.0);
break;
case SubgraphBuilderParameters::RHS_2NORM: {
if (JacobianFactor::shared_ptr jf =
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
weights.push_back(jf->getb().norm());
weight.push_back(jf->getb().norm());
} else if (HessianFactor::shared_ptr hf =
std::dynamic_pointer_cast<HessianFactor>(gf)) {
weights.push_back(hf->linearTerm().norm());
weight.push_back(hf->linearTerm().norm());
}
} break;
case SubgraphBuilderParameters::LHS_FNORM: {
if (JacobianFactor::shared_ptr jf =
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
weights.push_back(std::sqrt(jf->getA().squaredNorm()));
weight.push_back(std::sqrt(jf->getA().squaredNorm()));
} else if (HessianFactor::shared_ptr hf =
std::dynamic_pointer_cast<HessianFactor>(gf)) {
weights.push_back(std::sqrt(hf->information().squaredNorm()));
weight.push_back(std::sqrt(hf->information().squaredNorm()));
}
} break;
case SubgraphBuilderParameters::RANDOM:
weights.push_back(std::rand() % 100 + 1.0);
weight.push_back(std::rand() % 100 + 1.0);
break;
default:
throw std::invalid_argument(
"SubgraphBuilder::weights(): undefined weight scheme ");
"SubgraphBuilder::weights: undefined weight scheme ");
break;
}
}
return weights;
return weight;
}
/*****************************************************************************/

View File

@ -167,12 +167,11 @@ class GTSAM_EXPORT SubgraphBuilder {
std::vector<size_t> unary(const GaussianFactorGraph &gfg) const;
std::vector<size_t> natural_chain(const GaussianFactorGraph &gfg) const;
std::vector<size_t> bfs(const GaussianFactorGraph &gfg) const;
std::vector<size_t> sample(const std::vector<double> &weights,
const size_t t) const;
std::vector<size_t> kruskal(const GaussianFactorGraph &gfg,
const std::vector<double> &weights) const;
std::vector<size_t> sample(const std::vector<double> &weights,
const size_t t) const;
Weights weights(const GaussianFactorGraph &gfg) const ;
SubgraphBuilderParameters parameters_;
};

View File

@ -270,9 +270,8 @@ static VectorValues computeOrientations(const NonlinearFactorGraph& pose2Graph,
// Find a minimum spanning tree
if (useOdometricPath)
tree = findOdometricPath(pose2Graph);
else {
else
tree = findMinimumSpanningTree(pose2Graph);
}
// Create a linear factor graph (LFG) of scalars
key2doubleMap deltaThetaMap;