Replaced BOOSE_FOREACH with for in tests folder. Tested the changed code locally: successful.
parent
20b02d3f4d
commit
a464769ce1
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/assign/std/list.hpp> // for operator +=
|
#include <boost/assign/std/list.hpp> // for operator +=
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
|
@ -220,7 +219,7 @@ TEST( GaussianBayesTree, balanced_smoother_shortcuts )
|
||||||
// Permutation toFront(Permutation::PullToFront(C3->keys(), varIndex.size()));
|
// Permutation toFront(Permutation::PullToFront(C3->keys(), varIndex.size()));
|
||||||
// Permutation toFrontInverse(*toFront.inverse());
|
// Permutation toFrontInverse(*toFront.inverse());
|
||||||
// varIndex.permute(toFront);
|
// varIndex.permute(toFront);
|
||||||
// BOOST_FOREACH(const GaussianFactor::shared_ptr& factor, marginal) {
|
// for(const GaussianFactor::shared_ptr& factor: marginal) {
|
||||||
// factor->permuteWithInverse(toFrontInverse); }
|
// factor->permuteWithInverse(toFrontInverse); }
|
||||||
// GaussianBayesNet actual = *inference::EliminateUntil(marginal, C3->keys().size(), varIndex);
|
// GaussianBayesNet actual = *inference::EliminateUntil(marginal, C3->keys().size(), varIndex);
|
||||||
// actual.permuteWithInverse(toFront);
|
// actual.permuteWithInverse(toFront);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/assign/std/list.hpp> // for operator +=
|
#include <boost/assign/std/list.hpp> // for operator +=
|
||||||
#include <boost/assign/std/set.hpp> // for operator +=
|
#include <boost/assign/std/set.hpp> // for operator +=
|
||||||
|
@ -585,7 +584,7 @@ TEST( GaussianFactorGraph, conditional_sigma_failure) {
|
||||||
GaussianBayesTree actBT = *lfg.eliminateMultifrontal();
|
GaussianBayesTree actBT = *lfg.eliminateMultifrontal();
|
||||||
|
|
||||||
// Check that all sigmas in an unconstrained bayes tree are set to one
|
// Check that all sigmas in an unconstrained bayes tree are set to one
|
||||||
BOOST_FOREACH(const GaussianBayesTree::sharedClique& clique, actBT.nodes() | br::map_values) {
|
for(const GaussianBayesTree::sharedClique& clique: actBT.nodes() | br::map_values) {
|
||||||
GaussianConditional::shared_ptr conditional = clique->conditional();
|
GaussianConditional::shared_ptr conditional = clique->conditional();
|
||||||
//size_t dim = conditional->rows();
|
//size_t dim = conditional->rows();
|
||||||
//EXPECT(assert_equal(gtsam::Vector::Ones(dim), conditional->get_model()->sigmas(), tol));
|
//EXPECT(assert_equal(gtsam::Vector::Ones(dim), conditional->get_model()->sigmas(), tol));
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <gtsam/linear/GaussianISAM.h>
|
#include <gtsam/linear/GaussianISAM.h>
|
||||||
#include <gtsam/inference/Ordering.h>
|
#include <gtsam/inference/Ordering.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/assign/std/list.hpp> // for operator +=
|
#include <boost/assign/std/list.hpp> // for operator +=
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
#include <boost/range/adaptor/map.hpp>
|
#include <boost/range/adaptor/map.hpp>
|
||||||
|
@ -46,7 +45,7 @@ TEST( ISAM, iSAM_smoother )
|
||||||
|
|
||||||
// run iSAM for every factor
|
// run iSAM for every factor
|
||||||
GaussianISAM actual;
|
GaussianISAM actual;
|
||||||
BOOST_FOREACH(boost::shared_ptr<GaussianFactor> factor, smoother) {
|
for(boost::shared_ptr<GaussianFactor> factor: smoother) {
|
||||||
GaussianFactorGraph factorGraph;
|
GaussianFactorGraph factorGraph;
|
||||||
factorGraph.push_back(factor);
|
factorGraph.push_back(factor);
|
||||||
actual.update(factorGraph);
|
actual.update(factorGraph);
|
||||||
|
@ -56,7 +55,7 @@ TEST( ISAM, iSAM_smoother )
|
||||||
GaussianBayesTree expected = *smoother.eliminateMultifrontal(ordering);
|
GaussianBayesTree expected = *smoother.eliminateMultifrontal(ordering);
|
||||||
|
|
||||||
// Verify sigmas in the bayes tree
|
// Verify sigmas in the bayes tree
|
||||||
BOOST_FOREACH(const GaussianBayesTree::sharedClique& clique, expected.nodes() | br::map_values) {
|
for(const GaussianBayesTree::sharedClique& clique: expected.nodes() | br::map_values) {
|
||||||
GaussianConditional::shared_ptr conditional = clique->conditional();
|
GaussianConditional::shared_ptr conditional = clique->conditional();
|
||||||
EXPECT(!conditional->get_model());
|
EXPECT(!conditional->get_model());
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <gtsam/base/debug.h>
|
#include <gtsam/base/debug.h>
|
||||||
#include <gtsam/base/TestableAssertions.h>
|
#include <gtsam/base/TestableAssertions.h>
|
||||||
#include <gtsam/base/treeTraversal-inst.h>
|
#include <gtsam/base/treeTraversal-inst.h>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/assign/list_of.hpp>
|
#include <boost/assign/list_of.hpp>
|
||||||
#include <gtsam/base/deprecated/LieScalar.h>
|
#include <gtsam/base/deprecated/LieScalar.h>
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
@ -212,7 +211,7 @@ struct ConsistencyVisitor
|
||||||
if(find(node->parent()->children.begin(), node->parent()->children.end(), node) == node->parent()->children.end())
|
if(find(node->parent()->children.begin(), node->parent()->children.end(), node) == node->parent()->children.end())
|
||||||
consistent = false;
|
consistent = false;
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(Key j, node->conditional()->frontals())
|
for(Key j: node->conditional()->frontals())
|
||||||
{
|
{
|
||||||
if(isam.nodes().at(j).get() != node.get())
|
if(isam.nodes().at(j).get() != node.get())
|
||||||
consistent = false;
|
consistent = false;
|
||||||
|
@ -251,7 +250,7 @@ bool isam_check(const NonlinearFactorGraph& fullgraph, const Values& fullinit, c
|
||||||
// Check gradient at each node
|
// Check gradient at each node
|
||||||
bool nodeGradientsOk = true;
|
bool nodeGradientsOk = true;
|
||||||
typedef ISAM2::sharedClique sharedClique;
|
typedef ISAM2::sharedClique sharedClique;
|
||||||
BOOST_FOREACH(const sharedClique& clique, isam.nodes() | br::map_values) {
|
for(const sharedClique& clique: isam.nodes() | br::map_values) {
|
||||||
// Compute expected gradient
|
// Compute expected gradient
|
||||||
GaussianFactorGraph jfg;
|
GaussianFactorGraph jfg;
|
||||||
jfg += clique->conditional();
|
jfg += clique->conditional();
|
||||||
|
@ -483,7 +482,7 @@ TEST(ISAM2, swapFactors)
|
||||||
|
|
||||||
// Check gradient at each node
|
// Check gradient at each node
|
||||||
typedef ISAM2::sharedClique sharedClique;
|
typedef ISAM2::sharedClique sharedClique;
|
||||||
BOOST_FOREACH(const sharedClique& clique, isam.nodes() | br::map_values) {
|
for(const sharedClique& clique: isam.nodes() | br::map_values) {
|
||||||
// Compute expected gradient
|
// Compute expected gradient
|
||||||
GaussianFactorGraph jfg;
|
GaussianFactorGraph jfg;
|
||||||
jfg += clique->conditional();
|
jfg += clique->conditional();
|
||||||
|
@ -608,7 +607,7 @@ TEST(ISAM2, constrained_ordering)
|
||||||
|
|
||||||
// Check gradient at each node
|
// Check gradient at each node
|
||||||
typedef ISAM2::sharedClique sharedClique;
|
typedef ISAM2::sharedClique sharedClique;
|
||||||
BOOST_FOREACH(const sharedClique& clique, isam.nodes() | br::map_values) {
|
for(const sharedClique& clique: isam.nodes() | br::map_values) {
|
||||||
// Compute expected gradient
|
// Compute expected gradient
|
||||||
GaussianFactorGraph jfg;
|
GaussianFactorGraph jfg;
|
||||||
jfg += clique->conditional();
|
jfg += clique->conditional();
|
||||||
|
@ -650,7 +649,7 @@ namespace {
|
||||||
bool checkMarginalizeLeaves(ISAM2& isam, const FastList<Key>& leafKeys) {
|
bool checkMarginalizeLeaves(ISAM2& isam, const FastList<Key>& leafKeys) {
|
||||||
Matrix expectedAugmentedHessian, expected3AugmentedHessian;
|
Matrix expectedAugmentedHessian, expected3AugmentedHessian;
|
||||||
vector<Key> toKeep;
|
vector<Key> toKeep;
|
||||||
BOOST_FOREACH(Key j, isam.getDelta() | br::map_keys)
|
for(Key j: isam.getDelta() | br::map_keys)
|
||||||
if(find(leafKeys.begin(), leafKeys.end(), j) == leafKeys.end())
|
if(find(leafKeys.begin(), leafKeys.end(), j) == leafKeys.end())
|
||||||
toKeep.push_back(j);
|
toKeep.push_back(j);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <CppUnitLite/Test.h>
|
#include <CppUnitLite/Test.h>
|
||||||
#include <CppUnitLite/TestRegistry.h>
|
#include <CppUnitLite/TestRegistry.h>
|
||||||
#include <CppUnitLite/TestResult.h>
|
#include <CppUnitLite/TestResult.h>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -51,7 +50,7 @@ TEST(PinholeCamera, BAL) {
|
||||||
NonlinearFactorGraph graph;
|
NonlinearFactorGraph graph;
|
||||||
|
|
||||||
for (size_t j = 0; j < db.number_tracks(); j++) {
|
for (size_t j = 0; j < db.number_tracks(); j++) {
|
||||||
BOOST_FOREACH (const SfM_Measurement& m, db.tracks[j].measurements)
|
for (const SfM_Measurement& m: db.tracks[j].measurements)
|
||||||
graph.push_back(sfmFactor(m.second, unit2, m.first, P(j)));
|
graph.push_back(sfmFactor(m.second, unit2, m.first, P(j)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ TEST( SubgraphPreconditioner, planarOrdering ) {
|
||||||
/** unnormalized error */
|
/** unnormalized error */
|
||||||
static double error(const GaussianFactorGraph& fg, const VectorValues& x) {
|
static double error(const GaussianFactorGraph& fg, const VectorValues& x) {
|
||||||
double total_error = 0.;
|
double total_error = 0.;
|
||||||
BOOST_FOREACH(const GaussianFactor::shared_ptr& factor, fg)
|
for(const GaussianFactor::shared_ptr& factor: fg)
|
||||||
total_error += factor->error(x);
|
total_error += factor->error(x);
|
||||||
return total_error;
|
return total_error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <gtsam/inference/Ordering.h>
|
#include <gtsam/inference/Ordering.h>
|
||||||
#include <gtsam/base/numericalDerivative.h>
|
#include <gtsam/base/numericalDerivative.h>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/assign/std/list.hpp>
|
#include <boost/assign/std/list.hpp>
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
@ -41,7 +40,7 @@ using namespace example;
|
||||||
/** unnormalized error */
|
/** unnormalized error */
|
||||||
static double error(const GaussianFactorGraph& fg, const VectorValues& x) {
|
static double error(const GaussianFactorGraph& fg, const VectorValues& x) {
|
||||||
double total_error = 0.;
|
double total_error = 0.;
|
||||||
BOOST_FOREACH(const GaussianFactor::shared_ptr& factor, fg)
|
for(const GaussianFactor::shared_ptr& factor: fg)
|
||||||
total_error += factor->error(x);
|
total_error += factor->error(x);
|
||||||
return total_error;
|
return total_error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue