diff options
author | Hauke Heibel <hauke.heibel@gmail.com> | 2010-11-02 14:32:41 +0100 |
---|---|---|
committer | Hauke Heibel <hauke.heibel@gmail.com> | 2010-11-02 14:32:41 +0100 |
commit | 3a3f163e312f292550768314881195eac036ddc4 (patch) | |
tree | fdf7859463e42b987f8304620042b2678aae4419 /Eigen/src/Sparse | |
parent | b3007db131c0362354a35b34d376b1fc799aa534 (diff) |
Fix bug #65.
In order to prevent compilation errors, the default functor "struct func" must not be defined inside the function scope. I just moved it into a private section of SparseMatrix.
Diffstat (limited to 'Eigen/src/Sparse')
-rw-r--r-- | Eigen/src/Sparse/SparseMatrix.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h index 3187bca00..38e810725 100644 --- a/Eigen/src/Sparse/SparseMatrix.h +++ b/Eigen/src/Sparse/SparseMatrix.h @@ -334,16 +334,7 @@ class SparseMatrix /** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */ void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision()) { - struct func { - func(Scalar ref, RealScalar eps) : reference(ref), epsilon(eps) {} - inline bool operator() (const Index& row, const Index& col, const Scalar& value) const - { - return !internal::isMuchSmallerThan(value, reference, epsilon); - } - Scalar reference; - RealScalar epsilon; - }; - prune(func(reference,epsilon)); + prune(default_prunning_func(reference,epsilon)); } /** Suppress all nonzeros which do not satisfy the predicate \a keep. @@ -608,6 +599,17 @@ class SparseMatrix /** \deprecated use finalize */ EIGEN_DEPRECATED void endFill() { finalize(); } + +private: + struct default_prunning_func { + default_prunning_func(Scalar ref, RealScalar eps) : reference(ref), epsilon(eps) {} + inline bool operator() (const Index&, const Index&, const Scalar& value) const + { + return !internal::isMuchSmallerThan(value, reference, epsilon); + } + Scalar reference; + RealScalar epsilon; + }; }; template<typename Scalar, int _Options, typename _Index> |