mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
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.
This commit is contained in:
parent
b3007db131
commit
3a3f163e31
@ -334,16 +334,7 @@ class SparseMatrix
|
|||||||
/** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */
|
/** Suppress all nonzeros which are smaller than \a reference under the tolerence \a epsilon */
|
||||||
void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
|
void prune(Scalar reference, RealScalar epsilon = NumTraits<RealScalar>::dummy_precision())
|
||||||
{
|
{
|
||||||
struct func {
|
prune(default_prunning_func(reference,epsilon));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Suppress all nonzeros which do not satisfy the predicate \a keep.
|
/** Suppress all nonzeros which do not satisfy the predicate \a keep.
|
||||||
@ -608,6 +599,17 @@ class SparseMatrix
|
|||||||
|
|
||||||
/** \deprecated use finalize */
|
/** \deprecated use finalize */
|
||||||
EIGEN_DEPRECATED void endFill() { 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>
|
template<typename Scalar, int _Options, typename _Index>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user