finish making use of CoeffReadCost and the new XprCopy everywhere

seems appropriate to me.
This commit is contained in:
Benoit Jacob
2008-04-08 14:15:01 +00:00
parent 371d302efb
commit 4920f2011e
4 changed files with 75 additions and 38 deletions

View File

@@ -74,10 +74,13 @@ template<typename Derived>
template<typename Visitor>
void MatrixBase<Derived>::visit(Visitor& visitor) const
{
if(SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
const bool unroll = SizeAtCompileTime * CoeffReadCost
+ (SizeAtCompileTime-1) * ei_functor_traits<Visitor>::Cost
<= EIGEN_UNROLLING_LIMIT;
if(unroll)
return ei_visitor_unroller<Visitor, Derived,
(SizeAtCompileTime>0 && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) ?
SizeAtCompileTime : Dynamic>::run(derived(), visitor);
unroll ? SizeAtCompileTime : Dynamic
>::run(derived(), visitor);
else
{
visitor.init(coeff(0,0), 0, 0);
@@ -124,6 +127,13 @@ struct ei_min_coeff_visitor : ei_coeff_visitor<Scalar>
}
};
template<typename Scalar>
struct ei_functor_traits<ei_min_coeff_visitor<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost
};
};
/** \internal
* \brief Visitor computing the max coefficient with its value and coordinates
*
@@ -143,6 +153,13 @@ struct ei_max_coeff_visitor : ei_coeff_visitor<Scalar>
}
};
template<typename Scalar>
struct ei_functor_traits<ei_max_coeff_visitor<Scalar> > {
enum {
Cost = NumTraits<Scalar>::AddCost
};
};
/** \returns the minimum of all coefficients of *this
* and puts in *row and *col its location.
*