Removed BOOST_REVERSE_FOREACH
parent
7ffcf765b5
commit
ef38e80857
|
@ -50,6 +50,7 @@
|
|||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/range/algorithm/set_algorithm.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
|
@ -421,9 +422,9 @@ void runIncremental()
|
|||
//try {
|
||||
// Marginals marginals(graph, values);
|
||||
// int i=0;
|
||||
// BOOST_REVERSE_FOREACH(Key key1, values.keys()) {
|
||||
// for (Key key1: boost::adaptors::reverse(values.keys())) {
|
||||
// int j=0;
|
||||
// BOOST_REVERSE_FOREACH(Key key2, values.keys()) {
|
||||
// for (Key key12: boost::adaptors::reverse(values.keys())) {
|
||||
// if(i != j) {
|
||||
// gttic_(jointMarginalInformation);
|
||||
// std::vector<Key> keys(2);
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include <gtsam/discrete/DiscreteBayesNet.h>
|
||||
#include <gtsam/discrete/DiscreteConditional.h>
|
||||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
|
@ -55,7 +57,7 @@ namespace gtsam {
|
|||
DiscreteFactor::sharedValues DiscreteBayesNet::optimize() const {
|
||||
// solve each node in turn in topological sort order (parents first)
|
||||
DiscreteFactor::sharedValues result(new DiscreteFactor::Values());
|
||||
BOOST_REVERSE_FOREACH (DiscreteConditional::shared_ptr conditional, *this)
|
||||
for (auto conditional: boost::adaptors::reverse(*this))
|
||||
conditional->solveInPlace(*result);
|
||||
return result;
|
||||
}
|
||||
|
@ -64,7 +66,7 @@ namespace gtsam {
|
|||
DiscreteFactor::sharedValues DiscreteBayesNet::sample() const {
|
||||
// sample each node in turn in topological sort order (parents first)
|
||||
DiscreteFactor::sharedValues result(new DiscreteFactor::Values());
|
||||
BOOST_REVERSE_FOREACH(DiscreteConditional::shared_ptr conditional, *this)
|
||||
for (auto conditional: boost::adaptors::reverse(*this))
|
||||
conditional->sampleInPlace(*result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
#include <gtsam/inference/BayesNet.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <fstream>
|
||||
|
||||
namespace gtsam {
|
||||
|
@ -40,7 +40,7 @@ namespace gtsam {
|
|||
std::ofstream of(s.c_str());
|
||||
of << "digraph G{\n";
|
||||
|
||||
BOOST_REVERSE_FOREACH(const sharedConditional& conditional, *this) {
|
||||
for (auto conditional: boost::adaptors::reverse(*this)) {
|
||||
typename CONDITIONAL::Frontals frontals = conditional->frontals();
|
||||
Key me = frontals.front();
|
||||
typename CONDITIONAL::Parents parents = conditional->parents();
|
||||
|
|
|
@ -20,14 +20,11 @@
|
|||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
#include <gtsam/base/timing.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
||||
#define FOREACH_PAIR( KEY, VAL, COL) BOOST_FOREACH (boost::tie(KEY,VAL):COL)
|
||||
#define REVERSE_FOREACH_PAIR( KEY, VAL, COL) BOOST_REVERSE_FOREACH (boost::tie(KEY,VAL),COL)
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
// Instantiate base class
|
||||
|
@ -52,7 +49,7 @@ namespace gtsam {
|
|||
VectorValues soln(solutionForMissing); // possibly empty
|
||||
// (R*x)./sigmas = y by solving x=inv(R)*(y.*sigmas)
|
||||
/** solve each node in turn in topological sort order (parents first)*/
|
||||
BOOST_REVERSE_FOREACH(const sharedConditional& cg, *this) {
|
||||
for (auto cg: boost::adaptors::reverse(*this)) {
|
||||
// i^th part of R*x=y, x=inv(R)*y
|
||||
// (Rii*xi + R_i*x(i+1:))./si = yi <-> xi = inv(Rii)*(yi.*si - R_i*x(i+1:))
|
||||
soln.insert(cg->solve(soln));
|
||||
|
@ -88,7 +85,7 @@ namespace gtsam {
|
|||
VectorValues result;
|
||||
// TODO this looks pretty sketchy. result is passed as the parents argument
|
||||
// as it's filled up by solving the gaussian conditionals.
|
||||
BOOST_REVERSE_FOREACH(const sharedConditional& cg, *this) {
|
||||
for (auto cg: boost::adaptors::reverse(*this)) {
|
||||
result.insert(cg->solveOtherRHS(result, rhs));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -569,7 +569,7 @@ void SubgraphPreconditioner::solve(const Vector& y, Vector &x) const
|
|||
std::copy(y.data(), y.data() + y.rows(), x.data());
|
||||
|
||||
/* in place back substitute */
|
||||
BOOST_REVERSE_FOREACH(const boost::shared_ptr<GaussianConditional> & cg, *Rc1_) {
|
||||
for (auto cg: boost::adaptors::reverse(*Rc1_)) {
|
||||
/* collect a subvector of x that consists of the parents of cg (S) */
|
||||
const Vector xParent = getSubvector(x, keyInfo_, FastVector<Key>(cg->beginParents(), cg->endParents()));
|
||||
const Vector rhsFrontal = getSubvector(x, keyInfo_, FastVector<Key>(cg->beginFrontals(), cg->endFrontals()));
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
#include <gtsam/symbolic/SymbolicConditional.h>
|
||||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <fstream>
|
||||
|
||||
namespace gtsam {
|
||||
|
@ -41,7 +40,7 @@ namespace gtsam {
|
|||
std::ofstream of(s.c_str());
|
||||
of << "digraph G{\n";
|
||||
|
||||
BOOST_REVERSE_FOREACH(const sharedConditional& conditional, *this) {
|
||||
for (auto conditional: boost::adaptors::reverse(*this)) {
|
||||
SymbolicConditional::Frontals frontals = conditional->frontals();
|
||||
Key me = frontals.front();
|
||||
SymbolicConditional::Parents parents = conditional->parents();
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
@ -225,9 +226,9 @@ int main(int argc, char *argv[]) {
|
|||
try {
|
||||
Marginals marginals(graph, values);
|
||||
int i=0;
|
||||
BOOST_REVERSE_FOREACH(Key key1, values.keys()) {
|
||||
for (Key key1: boost::adaptors::reverse(values.keys())) {
|
||||
int j=0;
|
||||
BOOST_REVERSE_FOREACH(Key key2, values.keys()) {
|
||||
for (Key key2: boost::adaptors::reverse(values.keys())) {
|
||||
if(i != j) {
|
||||
gttic_(jointMarginalInformation);
|
||||
std::vector<Key> keys(2);
|
||||
|
|
Loading…
Reference in New Issue