Fixing more compile problems: Switched BayesTree-inst.h function to use a functor struct rather than an address of a template function - seems to compile. Small include fixes elsewhere
parent
375f7c16e6
commit
b2b7b0b3f3
|
|
@ -152,6 +152,16 @@ namespace gtsam {
|
|||
fg.push_back(clique->conditional_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class FACTOR, class CLIQUE>
|
||||
struct _pushCliqueFunctor {
|
||||
_pushCliqueFunctor(FactorGraph<FACTOR>& graph_) : graph(graph_) {}
|
||||
FactorGraph<FACTOR>& graph;
|
||||
int operator()(const boost::shared_ptr<CLIQUE>& clique, int dummy) {
|
||||
graph.push_back(clique->conditional_);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
@ -160,7 +170,9 @@ namespace gtsam {
|
|||
{
|
||||
// Traverse the BayesTree and add all conditionals to this graph
|
||||
int data = 0; // Unused
|
||||
treeTraversal::DepthFirstForest(*this, data, boost::bind(&_pushClique<FactorType,CLIQUE>, boost::ref(graph), _1));
|
||||
_pushCliqueFunctor<FactorType,CLIQUE> functor(graph);
|
||||
treeTraversal::DepthFirstForest(*this, data, functor); // FIXME: sort of works?
|
||||
// treeTraversal::DepthFirstForest(*this, data, boost::bind(&_pushClique<FactorType,CLIQUE>, boost::ref(graph), _1));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -118,9 +118,7 @@ namespace gtsam {
|
|||
Vector soln = get_R().triangularView<Eigen::Upper>().solve(xS);
|
||||
|
||||
// Check for indeterminant solution
|
||||
// FIXME: can't use std::isfinite() as a templated function with gcc
|
||||
if(soln.unaryExpr(!boost::lambda::bind(ptr_fun(isfinite<double>), boost::lambda::_1)).any())
|
||||
throw IndeterminantLinearSystemException(keys().front());
|
||||
if(soln.hasNaN()) throw IndeterminantLinearSystemException(keys().front());
|
||||
|
||||
// Insert solution into a VectorValues
|
||||
VectorValues result;
|
||||
|
|
@ -164,9 +162,7 @@ namespace gtsam {
|
|||
frontalVec = gtsam::backSubstituteUpper(frontalVec, Matrix(get_R()));
|
||||
|
||||
// Check for indeterminant solution
|
||||
// FIXME: can't use isfinite() as a templated function with gcc
|
||||
// if(frontalVec.unaryExpr(!boost::lambda::bind(std::ptr_fun(isfinite<double>), boost::lambda::_1)).any())
|
||||
// throw IndeterminantLinearSystemException(this->keys().front());
|
||||
if (frontalVec.hasNaN()) throw IndeterminantLinearSystemException(this->keys().front());
|
||||
|
||||
for (const_iterator it = beginParents(); it!= endParents(); it++)
|
||||
gtsam::transposeMultiplyAdd(-1.0, Matrix(getA(it)), frontalVec, gy[*it]);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,17 @@ namespace gtsam {
|
|||
// Forward declarations
|
||||
class Ordering;
|
||||
class JacobianFactor;
|
||||
class HessianFactor;
|
||||
class GaussianConditional;
|
||||
class GaussianBayesNet;
|
||||
class GaussianFactorGraph;
|
||||
|
||||
GTSAM_EXPORT std::pair<boost::shared_ptr<GaussianConditional>, boost::shared_ptr<GaussianFactor> >
|
||||
EliminatePreferCholesky(const GaussianFactorGraph& factors, const Ordering& keys);
|
||||
|
||||
GTSAM_EXPORT std::pair<boost::shared_ptr<GaussianConditional>, boost::shared_ptr<HessianFactor> >
|
||||
EliminateCholesky(const GaussianFactorGraph& factors, const Ordering& keys);
|
||||
|
||||
// Definition of Scatter, which is an intermediate data structure used when building a
|
||||
// HessianFactor incrementally, to get the keys in the right order. The "scatter" is a map from
|
||||
// global variable indices to slot indices in the union of involved variables. We also include
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ namespace gtsam {
|
|||
class HessianFactor;
|
||||
class VectorValues;
|
||||
class Ordering;
|
||||
class JacobianFactor;
|
||||
|
||||
GTSAM_EXPORT std::pair<boost::shared_ptr<GaussianConditional>, boost::shared_ptr<JacobianFactor> >
|
||||
EliminateQR(const GaussianFactorGraph& factors, const Ordering& keys);
|
||||
|
||||
/**
|
||||
* A Gaussian factor in the squared-error form.
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
* @author Richard Roberts
|
||||
* @date Aug 17, 2012
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <gtsam/linear/linearExceptions.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <gtsam/base/DerivedValue.h>
|
||||
#include <gtsam/nonlinear/Values.h> // Only so Eclipse finds class definition
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/pool/pool_alloc.hpp>
|
||||
#include <boost/ptr_container/ptr_map.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
|
|
|||
Loading…
Reference in New Issue