Fixing compile problems
parent
dde245ef3b
commit
cee0a234ac
|
|
@ -23,6 +23,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ namespace gtsam {
|
|||
treeNode(treeNode), myData(myData), visitorPre(visitorPre), visitorPost(visitorPost),
|
||||
problemSizeThreshold(problemSizeThreshold), makeNewTasks(makeNewTasks) {}
|
||||
|
||||
typedef ParallelTraversalNode<NODE, DATA> ParallelTraversalNode;
|
||||
typedef ParallelTraversalNode<NODE, DATA> ParallelTraversalNodeType;
|
||||
|
||||
tbb::task* execute()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtsam/inference/Ordering.h>
|
||||
#include <gtsam/inference/BayesTree.h>
|
||||
#include <gtsam/base/treeTraversal-inst.h>
|
||||
#include <gtsam/base/timing.h>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <fstream>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <gtsam/base/timing.h>
|
||||
#include <gtsam/base/treeTraversal-inst.h>
|
||||
#include <gtsam/inference/BayesTree.h>
|
||||
#include <gtsam/inference/JunctionTree.h>
|
||||
#include <gtsam/symbolic/SymbolicConditional.h>
|
||||
#include <gtsam/symbolic/SymbolicFactorGraph.h>
|
||||
|
|
@ -217,7 +218,7 @@ namespace gtsam {
|
|||
/* ************************************************************************* */
|
||||
template<class BAYESTREE, class GRAPH>
|
||||
void JunctionTree<BAYESTREE,GRAPH>::print(
|
||||
const std::string& s = "", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const
|
||||
const std::string& s, const KeyFormatter& keyFormatter) const
|
||||
{
|
||||
treeTraversal::PrintForest(*this, s, keyFormatter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||
* Atlanta, Georgia 30332-0415
|
||||
* All Rights Reserved
|
||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||
|
||||
* See LICENSE for the license information
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @file GaussianConditional-inl.h
|
||||
* @brief Conditional Gaussian Base class
|
||||
* @author Christian Potthast
|
||||
*/
|
||||
|
||||
// \callgraph
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/range/join.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class PARENTS>
|
||||
GaussianConditional::GaussianConditional(Index key, const Vector& d,
|
||||
const Matrix& R, const PARENTS& parents, const SharedDiagonal& sigmas, const typename PARENTS::value_type*) :
|
||||
BaseFactor(boost::join(boost::assign::cref_list_of<1,typename PARENTS::value_type>(std::make_pair(key, R)), parents), d, sigmas),
|
||||
BaseConditional(1) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<typename TERMS>
|
||||
GaussianConditional::GaussianConditional(const TERMS& terms,
|
||||
size_t nrFrontals, const Vector& d, const SharedDiagonal& sigmas) :
|
||||
BaseFactor(terms, d, sigmas), BaseConditional(nrFrontals) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<typename KEYS>
|
||||
GaussianConditional::GaussianConditional(
|
||||
const KEYS& keys, size_t nrFrontals, const VerticalBlockMatrix& augmentedMatrix, const SharedDiagonal& sigmas) :
|
||||
BaseFactor(keys, augmentedMatrix, sigmas), BaseConditional(nrFrontals) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<typename ITERATOR>
|
||||
GaussianConditional::shared_ptr GaussianConditional::Combine(ITERATOR firstConditional, ITERATOR lastConditional)
|
||||
{
|
||||
// TODO: check for being a clique
|
||||
|
||||
// Get dimensions from first conditional
|
||||
std::vector<size_t> dims; dims.reserve((*firstConditional)->size() + 1);
|
||||
for(const_iterator j = (*firstConditional)->begin(); j != (*firstConditional)->end(); ++j)
|
||||
dims.push_back((*firstConditional)->dim(j));
|
||||
dims.push_back(1);
|
||||
|
||||
// We assume the conditionals form clique, so the first n variables will be
|
||||
// frontal variables in the new conditional.
|
||||
size_t nFrontals = 0;
|
||||
size_t nRows = 0;
|
||||
for(ITERATOR c = firstConditional; c != lastConditional; ++c) {
|
||||
nRows += dims[nFrontals];
|
||||
++ nFrontals;
|
||||
}
|
||||
|
||||
// Allocate combined conditional, has same keys as firstConditional
|
||||
Matrix tempCombined;
|
||||
VerticalBlockView<Matrix> tempBlockView(tempCombined, dims.begin(), dims.end(), 0);
|
||||
GaussianConditional::shared_ptr combinedConditional =
|
||||
boost::make_shared<GaussianConditional>(
|
||||
(*firstConditional)->begin(), (*firstConditional)->end(), nFrontals, tempBlockView, Vector::Zero(nRows));
|
||||
|
||||
// Resize to correct number of rows
|
||||
combinedConditional->matrix_.resize(nRows, combinedConditional->matrix_.cols());
|
||||
combinedConditional->rsd_.rowEnd() = combinedConditional->matrix_.rows();
|
||||
|
||||
// Copy matrix and sigmas
|
||||
const size_t totalDims = combinedConditional->matrix_.cols();
|
||||
size_t currentSlot = 0;
|
||||
for(ITERATOR c = firstConditional; c != lastConditional; ++c) {
|
||||
const size_t startRow = combinedConditional->rsd_.offset(currentSlot); // Start row is same as start column
|
||||
combinedConditional->rsd_.range(0, currentSlot).block(startRow, 0, dims[currentSlot], combinedConditional->rsd_.offset(currentSlot)).operator=(
|
||||
Matrix::Zero(dims[currentSlot], combinedConditional->rsd_.offset(currentSlot)));
|
||||
combinedConditional->rsd_.range(currentSlot, dims.size()).block(startRow, 0, dims[currentSlot], totalDims - startRow).operator=(
|
||||
(*c)->matrix_);
|
||||
combinedConditional->sigmas_.segment(startRow, dims[currentSlot]) = (*c)->sigmas_;
|
||||
++ currentSlot;
|
||||
}
|
||||
|
||||
return combinedConditional;
|
||||
}
|
||||
|
||||
} // gtsam
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <functional>
|
||||
#include <boost/format.hpp>
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
|
|
@ -117,6 +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());
|
||||
|
||||
|
|
@ -162,8 +164,9 @@ namespace gtsam {
|
|||
frontalVec = gtsam::backSubstituteUpper(frontalVec, Matrix(get_R()));
|
||||
|
||||
// Check for indeterminant solution
|
||||
if(frontalVec.unaryExpr(!boost::lambda::bind(ptr_fun(isfinite<double>), boost::lambda::_1)).any())
|
||||
throw IndeterminantLinearSystemException(this->keys().front());
|
||||
// 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());
|
||||
|
||||
for (const_iterator it = beginParents(); it!= endParents(); it++)
|
||||
gtsam::transposeMultiplyAdd(-1.0, Matrix(getA(it)), frontalVec, gy[*it]);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ namespace gtsam {
|
|||
|
||||
/** Scale the values in \c gy according to the sigmas for the frontal variables in this
|
||||
* conditional. */
|
||||
__declspec(deprecated) void scaleFrontalsBySigma(VectorValues& gy) const;
|
||||
void scaleFrontalsBySigma(VectorValues& gy) const;
|
||||
// __declspec(deprecated) void scaleFrontalsBySigma(VectorValues& gy) const; // FIXME: depreciated flag doesn't appear to exist?
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -151,5 +152,3 @@ namespace gtsam {
|
|||
|
||||
} // gtsam
|
||||
|
||||
#include <gtsam/linear/GaussianConditional-inl.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <gtsam/linear/GaussianConditional.h>
|
||||
#include <gtsam/linear/GaussianFactor.h>
|
||||
#include <gtsam/linear/HessianFactor.h>
|
||||
#include <gtsam/linear/JacobianFactor.h>
|
||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ SharedDiagonal Gaussian::QR(Matrix& Ab) const {
|
|||
// get size(A) and maxRank
|
||||
// TODO: really no rank problems ?
|
||||
size_t m = Ab.rows(), n = Ab.cols()-1;
|
||||
size_t maxRank = min(m,n);
|
||||
// size_t maxRank = min(m,n);
|
||||
|
||||
// pre-whiten everything (cheaply if possible)
|
||||
WhitenInPlace(Ab);
|
||||
|
|
@ -272,9 +272,9 @@ double Constrained::distance(const Vector& v) const {
|
|||
Vector w = Diagonal::whiten(v); // get noisemodel for constrained elements
|
||||
// TODO Find a better way of doing these checks
|
||||
for (size_t i=0; i<dim_; ++i) { // add mu weights on constrained variables
|
||||
if (isinf(w[i])) // whiten makes constrained variables infinite
|
||||
if (std::isinf(w[i])) // whiten makes constrained variables infinite
|
||||
w[i] = v[i] * sqrt(mu_[i]); // TODO: may want to store sqrt rather than rebuild
|
||||
if (isnan(w[i])) // ensure no other invalid values make it through
|
||||
if (std::isnan(w[i])) // ensure no other invalid values make it through
|
||||
w[i] = v[i];
|
||||
}
|
||||
return w.dot(w);
|
||||
|
|
|
|||
Loading…
Reference in New Issue