From 2322b0e509a582e857217e14cac803a008ac2d6a Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 13 Aug 2013 04:21:59 +0000 Subject: [PATCH] Trying to fix error on clang --- gtsam/linear/JacobianFactor-inl.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/gtsam/linear/JacobianFactor-inl.h b/gtsam/linear/JacobianFactor-inl.h index 76dea1989..894f44473 100644 --- a/gtsam/linear/JacobianFactor-inl.h +++ b/gtsam/linear/JacobianFactor-inl.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include namespace gtsam { @@ -64,12 +64,34 @@ namespace gtsam { DenseIndex _getColsJF(const std::pair& p) { return p.second.cols(); } + + //struct _fillTerm { + // mutable std::vector& keys; + // mutable VerticalBlockMatrix& Ab; + // mutable DenseIndex& i; + // _fillTerm(std::vector& keys, VerticalBlockMatrix& Ab, DenseIndex& i) + // : keys(keys), Ab(Ab), i(i) {} + // template void operator()(const TERM& term) const + // { + // // Check block rows + // if(term.second.rows() != Ab.rows()) + // throw InvalidMatrixBlock(Ab.rows(), term.second.rows()); + // // Assign key and matrix + // keys[i] = term.first; + // Ab(i) = term.second; + // // Increment block index + // ++ i; + // } + //}; } /* ************************************************************************* */ template void JacobianFactor::fillTerms(const TERMS& terms, const Vector& b, const SharedDiagonal& noiseModel) { + using boost::adaptors::transformed; + namespace br = boost::range; + // Check noise model dimension if(noiseModel && (DenseIndex)noiseModel->dim() != b.size()) throw InvalidNoiseModel(b.size(), noiseModel->dim()); @@ -81,12 +103,13 @@ namespace gtsam { // matrices, then extract the number of columns e.g. dimensions in each matrix. Then joins with // a single '1' to add a dimension for the b vector. { - using boost::adaptors::transformed; - namespace br = boost::range; Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), ListOfOne((DenseIndex)1)), b.size()); } // Check and add terms + //DenseIndex i = 0; // For block index + //br::for_each(terms, _fillTerm(Base::keys_, Ab_, i)); + typedef std::pair Term; DenseIndex i = 0; // For block index BOOST_FOREACH(const Term& term, terms) {