Fixed many warnings on Ubuntu
parent
e43591e4d5
commit
4ba329c23b
|
@ -45,11 +45,11 @@ struct TestForest {
|
||||||
};
|
};
|
||||||
|
|
||||||
TestForest makeTestForest() {
|
TestForest makeTestForest() {
|
||||||
// 0 1
|
// 0 1
|
||||||
// / \
|
// / |
|
||||||
// 2 3
|
// 2 3
|
||||||
// |
|
// |
|
||||||
// 4
|
// 4
|
||||||
TestForest forest;
|
TestForest forest;
|
||||||
forest.roots_.push_back(boost::make_shared<TestNode>(0));
|
forest.roots_.push_back(boost::make_shared<TestNode>(0));
|
||||||
forest.roots_.push_back(boost::make_shared<TestNode>(1));
|
forest.roots_.push_back(boost::make_shared<TestNode>(1));
|
||||||
|
|
|
@ -467,7 +467,7 @@ namespace gtsam {
|
||||||
|
|
||||||
// find highest label among branches
|
// find highest label among branches
|
||||||
boost::optional<L> highestLabel;
|
boost::optional<L> highestLabel;
|
||||||
boost::optional<size_t> nrChoices;
|
size_t nrChoices = 0;
|
||||||
for (Iterator it = begin; it != end; it++) {
|
for (Iterator it = begin; it != end; it++) {
|
||||||
if (it->root_->isLeaf())
|
if (it->root_->isLeaf())
|
||||||
continue;
|
continue;
|
||||||
|
@ -475,22 +475,21 @@ namespace gtsam {
|
||||||
boost::dynamic_pointer_cast<const Choice>(it->root_);
|
boost::dynamic_pointer_cast<const Choice>(it->root_);
|
||||||
if (!highestLabel || c->label() > *highestLabel) {
|
if (!highestLabel || c->label() > *highestLabel) {
|
||||||
highestLabel.reset(c->label());
|
highestLabel.reset(c->label());
|
||||||
nrChoices.reset(c->nrChoices());
|
nrChoices = c->nrChoices();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if label is already in correct order, just put together a choice on label
|
// if label is already in correct order, just put together a choice on label
|
||||||
if (!highestLabel || !nrChoices || label > *highestLabel) {
|
if (!nrChoices || !highestLabel || label > *highestLabel) {
|
||||||
boost::shared_ptr<Choice> choiceOnLabel(new Choice(label, end - begin));
|
boost::shared_ptr<Choice> choiceOnLabel(new Choice(label, end - begin));
|
||||||
for (Iterator it = begin; it != end; it++)
|
for (Iterator it = begin; it != end; it++)
|
||||||
choiceOnLabel->push_back(it->root_);
|
choiceOnLabel->push_back(it->root_);
|
||||||
return Choice::Unique(choiceOnLabel);
|
return Choice::Unique(choiceOnLabel);
|
||||||
} else {
|
} else {
|
||||||
// Set up a new choice on the highest label
|
// Set up a new choice on the highest label
|
||||||
boost::shared_ptr<Choice> choiceOnHighestLabel(
|
boost::shared_ptr<Choice> choiceOnHighestLabel(new Choice(*highestLabel, nrChoices));
|
||||||
new Choice(*highestLabel, *nrChoices));
|
|
||||||
// now, for all possible values of highestLabel
|
// now, for all possible values of highestLabel
|
||||||
for (size_t index = 0; index < *nrChoices; index++) {
|
for (size_t index = 0; index < nrChoices; index++) {
|
||||||
// make a new set of functions for composing by iterating over the given
|
// make a new set of functions for composing by iterating over the given
|
||||||
// functions, and selecting the appropriate branch.
|
// functions, and selecting the appropriate branch.
|
||||||
std::vector<DecisionTree> functions;
|
std::vector<DecisionTree> functions;
|
||||||
|
|
|
@ -293,7 +293,7 @@ namespace internal {
|
||||||
// switch precisions and invsigmas to finite value
|
// switch precisions and invsigmas to finite value
|
||||||
// TODO: why?? And, why not just ask s==0.0 below ?
|
// TODO: why?? And, why not just ask s==0.0 below ?
|
||||||
static void fix(const Vector& sigmas, Vector& precisions, Vector& invsigmas) {
|
static void fix(const Vector& sigmas, Vector& precisions, Vector& invsigmas) {
|
||||||
for (size_t i = 0; i < sigmas.size(); ++i)
|
for (Vector::Index i = 0; i < sigmas.size(); ++i)
|
||||||
if (!std::isfinite(1. / sigmas[i])) {
|
if (!std::isfinite(1. / sigmas[i])) {
|
||||||
precisions[i] = 0.0;
|
precisions[i] = 0.0;
|
||||||
invsigmas[i] = 0.0;
|
invsigmas[i] = 0.0;
|
||||||
|
|
|
@ -25,9 +25,10 @@
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/range/adaptor/map.hpp>
|
#include <boost/range/adaptor/map.hpp>
|
||||||
|
#include <fstream>
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ GaussianFactorGraph::shared_ptr LevenbergMarquardtOptimizer::buildDampedSystem(
|
||||||
SharedDiagonal model = noiseModel::Isotropic::Sigma(dim, sigma);
|
SharedDiagonal model = noiseModel::Isotropic::Sigma(dim, sigma);
|
||||||
damped += boost::make_shared<JacobianFactor>(key_vector.first, A, b,
|
damped += boost::make_shared<JacobianFactor>(key_vector.first, A, b,
|
||||||
model);
|
model);
|
||||||
} catch (std::exception e) {
|
} catch (const std::exception& e) {
|
||||||
// Don't attempt any damping if no key found in diagonal
|
// Don't attempt any damping if no key found in diagonal
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +248,7 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
double modelFidelity = 0.0;
|
double modelFidelity = 0.0;
|
||||||
bool step_is_successful = false;
|
bool step_is_successful = false;
|
||||||
bool stopSearchingLambda = false;
|
bool stopSearchingLambda = false;
|
||||||
double newError;
|
double newError = numeric_limits<double>::infinity();
|
||||||
Values newValues;
|
Values newValues;
|
||||||
VectorValues delta;
|
VectorValues delta;
|
||||||
|
|
||||||
|
@ -255,7 +256,7 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
try {
|
try {
|
||||||
delta = solve(dampedSystem, state_.values, params_);
|
delta = solve(dampedSystem, state_.values, params_);
|
||||||
systemSolvedSuccessfully = true;
|
systemSolvedSuccessfully = true;
|
||||||
} catch (IndeterminantLinearSystemException) {
|
} catch (const IndeterminantLinearSystemException& e) {
|
||||||
systemSolvedSuccessfully = false;
|
systemSolvedSuccessfully = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,7 @@ TEST( InvDepthFactorVariant1, optimize) {
|
||||||
// Optimize the graph to recover the actual landmark position
|
// Optimize the graph to recover the actual landmark position
|
||||||
LevenbergMarquardtParams params;
|
LevenbergMarquardtParams params;
|
||||||
Values result = LevenbergMarquardtOptimizer(graph, values, params).optimize();
|
Values result = LevenbergMarquardtOptimizer(graph, values, params).optimize();
|
||||||
Vector6 actual = result.at<Vector6>(landmarkKey);
|
// Vector6 actual = result.at<Vector6>(landmarkKey);
|
||||||
|
|
||||||
|
|
||||||
// values.at<Pose3>(poseKey1).print("Pose1 Before:\n");
|
// values.at<Pose3>(poseKey1).print("Pose1 Before:\n");
|
||||||
// result.at<Pose3>(poseKey1).print("Pose1 After:\n");
|
// result.at<Pose3>(poseKey1).print("Pose1 After:\n");
|
||||||
// pose1.print("Pose1 Truth:\n");
|
// pose1.print("Pose1 Truth:\n");
|
||||||
|
|
|
@ -91,7 +91,8 @@ bool files_equal(const string& expected, const string& actual, bool skipheader)
|
||||||
cerr << "<<< DIFF OUTPUT (if none, white-space differences only):\n";
|
cerr << "<<< DIFF OUTPUT (if none, white-space differences only):\n";
|
||||||
stringstream command;
|
stringstream command;
|
||||||
command << "diff --ignore-all-space " << expected << " " << actual << endl;
|
command << "diff --ignore-all-space " << expected << " " << actual << endl;
|
||||||
system(command.str().c_str());
|
if (system(command.str().c_str())<0)
|
||||||
|
throw "command '" + command.str() + "' failed";
|
||||||
cerr << ">>>\n";
|
cerr << ">>>\n";
|
||||||
}
|
}
|
||||||
return equal;
|
return equal;
|
||||||
|
|
Loading…
Reference in New Issue