From 2388f5df45b7445f8a53947a71f6eccca7e2ff2b Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 8 Aug 2013 16:29:48 +0000 Subject: [PATCH] Revert "Fixing issues with boost::assign" This reverts commit d820732adc34a6622aae5d2bc0eb4a88e133beaf. --- gtsam/inference/BayesTreeCliqueBase-inst.h | 3 +-- gtsam/inference/ISAM-inst.h | 3 +-- gtsam/linear/HessianFactor.cpp | 17 ++--------------- gtsam/linear/JacobianFactor-inl.h | 14 ++------------ gtsam/linear/JacobianFactor.cpp | 3 +-- gtsam/linear/KalmanFilter.cpp | 6 ++---- 6 files changed, 9 insertions(+), 37 deletions(-) diff --git a/gtsam/inference/BayesTreeCliqueBase-inst.h b/gtsam/inference/BayesTreeCliqueBase-inst.h index 104d7f26f..90ca98863 100644 --- a/gtsam/inference/BayesTreeCliqueBase-inst.h +++ b/gtsam/inference/BayesTreeCliqueBase-inst.h @@ -160,8 +160,7 @@ namespace gtsam { gttic(BayesTreeCliqueBase_separatorMarginal); gttic(BayesTreeCliqueBase_separatorMarginal_cachemiss); // now add the parent conditional -// p_Cp += parent->conditional_; // P(Fp|Sp) // FIXME: assign error? - p_Cp.push_back(parent->conditional_); + p_Cp += parent->conditional_; // P(Fp|Sp) // The variables we want to keepSet are exactly the ones in S std::vector indicesS(this->conditional()->beginParents(), this->conditional()->endParents()); diff --git a/gtsam/inference/ISAM-inst.h b/gtsam/inference/ISAM-inst.h index 43f82fb1b..d73673755 100644 --- a/gtsam/inference/ISAM-inst.h +++ b/gtsam/inference/ISAM-inst.h @@ -41,8 +41,7 @@ namespace gtsam { // Add the orphaned subtrees BOOST_FOREACH(const sharedClique& orphan, orphans) - factors.push_back(boost::make_shared >(orphan)); -// factors += boost::make_shared >(orphan); + factors += boost::make_shared >(orphan); // eliminate into a Bayes net const VariableIndex varIndex(factors); diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp index fc3061be3..7302b0880 100644 --- a/gtsam/linear/HessianFactor.cpp +++ b/gtsam/linear/HessianFactor.cpp @@ -168,26 +168,13 @@ GaussianFactor(cref_list_of<3>(j1)(j2)(j3)), } /* ************************************************************************* */ -namespace { -DenseIndex _getSizeHF(const Vector& m) { return m.size(); } -} +namespace { DenseIndex _getSizeHF(const Vector& m) { return m.size(); } } /* ************************************************************************* */ HessianFactor::HessianFactor(const std::vector& js, const std::vector& Gs, const std::vector& gs, double f) : -GaussianFactor(js) //, info_(br::join(gs | br::transformed(&_getSizeHF), cref_list_of<1,DenseIndex>(1))) +GaussianFactor(js), info_(br::join(gs | br::transformed(&_getSizeHF), cref_list_of<1,DenseIndex>(1))) { - -// // FIXME: Issue with boost::range::join here - replacing with simpler version - info_ = SymmetricBlockMatrix(br::join(gs | br::transformed(&_getSizeHF), std::vector(1,1))); -// info_ = SymmetricBlockMatrix(br::join(gs | br::transformed(&_getSizeHF), cref_list_of<1,DenseIndex>(1))); // Original - // Alternate implementation -// std::vector dims(gs.size() + 1, 1); -// size_t i=0; -// BOOST_FOREACH(const Vector& m, gs) -// dims[i++] = m.size(); -// info_ = SymmetricBlockMatrix(dims); - // Get the number of variables size_t variable_count = js.size(); diff --git a/gtsam/linear/JacobianFactor-inl.h b/gtsam/linear/JacobianFactor-inl.h index 94b3583dc..fb66be882 100644 --- a/gtsam/linear/JacobianFactor-inl.h +++ b/gtsam/linear/JacobianFactor-inl.h @@ -82,19 +82,9 @@ namespace gtsam { // a single '1' to add a dimension for the b vector. { using boost::adaptors::transformed; -// using boost::assign::cref_list_of; + using boost::assign::cref_list_of; namespace br = boost::range; - // FIXME: compile error with type mismatch in boost::join -// Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), cref_list_of<1,DenseIndex>(1)), b.size()); // Original - Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), std::vector(1,1)), b.size()); - -// // Simple implementation -// std::vector dims(terms.size() + 1, 1); -// size_t i=0; -// typedef std::pair KeyMatrixPair; -// BOOST_FOREACH(const KeyMatrixPair& p, terms) -// dims[i++] = p.second.cols(); -// Ab_ = VerticalBlockMatrix(dims, b.size()); + Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), cref_list_of<1,DenseIndex>(1)), b.size()); } // Check and add terms diff --git a/gtsam/linear/JacobianFactor.cpp b/gtsam/linear/JacobianFactor.cpp index a7f1dbcb1..2b154958b 100644 --- a/gtsam/linear/JacobianFactor.cpp +++ b/gtsam/linear/JacobianFactor.cpp @@ -265,8 +265,7 @@ namespace gtsam { // Allocate matrix and copy keys in order gttic(allocate); - Ab_ = VerticalBlockMatrix(boost::join(varDims, std::vector(1,1)), m); // Allocate augmented matrix -// Ab_ = VerticalBlockMatrix(boost::join(varDims, cref_list_of<1,DenseIndex>(1)), m); // Allocate augmented matrix - original + Ab_ = VerticalBlockMatrix(boost::join(varDims, cref_list_of<1,DenseIndex>(1)), m); // Allocate augmented matrix Base::keys_.resize(orderedSlots.size()); boost::range::copy( // Get variable keys orderedSlots | boost::adaptors::indirected | boost::adaptors::map_keys, Base::keys_.begin()); diff --git a/gtsam/linear/KalmanFilter.cpp b/gtsam/linear/KalmanFilter.cpp index aea379857..c37df5ad2 100644 --- a/gtsam/linear/KalmanFilter.cpp +++ b/gtsam/linear/KalmanFilter.cpp @@ -57,14 +57,12 @@ namespace gtsam { } /* ************************************************************************* */ - KalmanFilter::State fuse(KalmanFilter::State p, GaussianFactor::shared_ptr newFactor, + KalmanFilter::State fuse(const KalmanFilter::State& p, GaussianFactor::shared_ptr newFactor, const GaussianFactorGraph::Eliminate& function) { // Create a factor graph GaussianFactorGraph factorGraph; - factorGraph.push_back(p); - factorGraph.push_back(newFactor); -// factorGraph += p, newFactor; // FIXME: bad insert at some point here - fills in a template argument with a shared_ptr where a non-pointer should go + factorGraph += p, newFactor; // Eliminate graph in order x0, x1, to get Bayes net P(x0|x1)P(x1) return solve(factorGraph, function);