Fixed many warnings on Ubuntu
parent
e43591e4d5
commit
4ba329c23b
|
@ -45,11 +45,11 @@ struct TestForest {
|
|||
};
|
||||
|
||||
TestForest makeTestForest() {
|
||||
// 0 1
|
||||
// / \
|
||||
// 2 3
|
||||
// |
|
||||
// 4
|
||||
// 0 1
|
||||
// / |
|
||||
// 2 3
|
||||
// |
|
||||
// 4
|
||||
TestForest forest;
|
||||
forest.roots_.push_back(boost::make_shared<TestNode>(0));
|
||||
forest.roots_.push_back(boost::make_shared<TestNode>(1));
|
||||
|
|
|
@ -467,7 +467,7 @@ namespace gtsam {
|
|||
|
||||
// find highest label among branches
|
||||
boost::optional<L> highestLabel;
|
||||
boost::optional<size_t> nrChoices;
|
||||
size_t nrChoices = 0;
|
||||
for (Iterator it = begin; it != end; it++) {
|
||||
if (it->root_->isLeaf())
|
||||
continue;
|
||||
|
@ -475,22 +475,21 @@ namespace gtsam {
|
|||
boost::dynamic_pointer_cast<const Choice>(it->root_);
|
||||
if (!highestLabel || c->label() > *highestLabel) {
|
||||
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 (!highestLabel || !nrChoices || label > *highestLabel) {
|
||||
if (!nrChoices || !highestLabel || label > *highestLabel) {
|
||||
boost::shared_ptr<Choice> choiceOnLabel(new Choice(label, end - begin));
|
||||
for (Iterator it = begin; it != end; it++)
|
||||
choiceOnLabel->push_back(it->root_);
|
||||
return Choice::Unique(choiceOnLabel);
|
||||
} else {
|
||||
// Set up a new choice on the highest label
|
||||
boost::shared_ptr<Choice> choiceOnHighestLabel(
|
||||
new Choice(*highestLabel, *nrChoices));
|
||||
boost::shared_ptr<Choice> choiceOnHighestLabel(new Choice(*highestLabel, nrChoices));
|
||||
// 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
|
||||
// functions, and selecting the appropriate branch.
|
||||
std::vector<DecisionTree> functions;
|
||||
|
|
|
@ -293,7 +293,7 @@ namespace internal {
|
|||
// switch precisions and invsigmas to finite value
|
||||
// TODO: why?? And, why not just ask s==0.0 below ?
|
||||
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])) {
|
||||
precisions[i] = 0.0;
|
||||
invsigmas[i] = 0.0;
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -178,7 +179,7 @@ GaussianFactorGraph::shared_ptr LevenbergMarquardtOptimizer::buildDampedSystem(
|
|||
SharedDiagonal model = noiseModel::Isotropic::Sigma(dim, sigma);
|
||||
damped += boost::make_shared<JacobianFactor>(key_vector.first, A, b,
|
||||
model);
|
||||
} catch (std::exception e) {
|
||||
} catch (const std::exception& e) {
|
||||
// Don't attempt any damping if no key found in diagonal
|
||||
continue;
|
||||
}
|
||||
|
@ -247,7 +248,7 @@ void LevenbergMarquardtOptimizer::iterate() {
|
|||
double modelFidelity = 0.0;
|
||||
bool step_is_successful = false;
|
||||
bool stopSearchingLambda = false;
|
||||
double newError;
|
||||
double newError = numeric_limits<double>::infinity();
|
||||
Values newValues;
|
||||
VectorValues delta;
|
||||
|
||||
|
@ -255,7 +256,7 @@ void LevenbergMarquardtOptimizer::iterate() {
|
|||
try {
|
||||
delta = solve(dampedSystem, state_.values, params_);
|
||||
systemSolvedSuccessfully = true;
|
||||
} catch (IndeterminantLinearSystemException) {
|
||||
} catch (const IndeterminantLinearSystemException& e) {
|
||||
systemSolvedSuccessfully = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,9 +73,7 @@ TEST( InvDepthFactorVariant1, optimize) {
|
|||
// Optimize the graph to recover the actual landmark position
|
||||
LevenbergMarquardtParams params;
|
||||
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");
|
||||
// result.at<Pose3>(poseKey1).print("Pose1 After:\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";
|
||||
stringstream command;
|
||||
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";
|
||||
}
|
||||
return equal;
|
||||
|
|
Loading…
Reference in New Issue