From 58d83f704fa1f1a3e841dae264b0c9eb6c5a50b9 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 29 Oct 2011 04:00:14 +0000 Subject: [PATCH] Documentation and headers --- gtsam/linear/JacobianFactor.cpp | 20 ++++++++++++-------- gtsam/linear/JacobianFactor.h | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gtsam/linear/JacobianFactor.cpp b/gtsam/linear/JacobianFactor.cpp index 50d6474ee..c20dab3c1 100644 --- a/gtsam/linear/JacobianFactor.cpp +++ b/gtsam/linear/JacobianFactor.cpp @@ -15,17 +15,17 @@ * @date Dec 8, 2010 */ +#include +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include #include #include @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -337,8 +338,11 @@ namespace gtsam { // find first column index for this key size_t column_start = columnIndices[*var]; for (size_t i = 0; i < (size_t) whitenedA.rows(); i++) - for (size_t j = 0; j < (size_t) whitenedA.cols(); j++) - entries.push_back(boost::make_tuple(i, column_start+j, whitenedA(i,j))); + for (size_t j = 0; j < (size_t) whitenedA.cols(); j++) { + double s = whitenedA(i,j); + if (std::abs(s) > 1e-12) entries.push_back( + boost::make_tuple(i, column_start + j, s)); + } } Vector whitenedb(model_->whiten(getb())); diff --git a/gtsam/linear/JacobianFactor.h b/gtsam/linear/JacobianFactor.h index aba1cfdf1..07876caf8 100644 --- a/gtsam/linear/JacobianFactor.h +++ b/gtsam/linear/JacobianFactor.h @@ -223,7 +223,7 @@ namespace gtsam { * Return vector of i, j, and s to generate an m-by-n sparse matrix * such that S(i(k),j(k)) = s(k), which can be given to MATLAB's sparse. * As above, the standard deviations are baked into A and b - * @param first column index for each variable + * @param columnIndices First column index for each variable. */ std::vector > sparse(const std::vector& columnIndices) const;