- merge ei_xpr_copy and ei_eval_if_needed_before_nesting

- make use of CoeffReadCost to determine when to unroll the loops,
  for now only in Product.h and in OperatorEquals.h
performance remains the same: generally still not as good as before the
big changes.
This commit is contained in:
Benoit Jacob
2008-04-06 18:01:03 +00:00
parent 30ec34de36
commit 371d302efb
5 changed files with 49 additions and 32 deletions

View File

@@ -102,14 +102,15 @@ template<typename OtherDerived>
Derived& MatrixBase<Derived>
::lazyAssign(const MatrixBase<OtherDerived>& other)
{
const bool unroll = SizeAtCompileTime * OtherDerived::CoeffReadCost <= EIGEN_UNROLLING_LIMIT;
if(IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime)
// copying a vector expression into a vector
{
ei_assert(size() == other.size());
if(SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
if(unroll)
ei_vector_operator_equals_unroller
<Derived, OtherDerived,
SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic
unroll ? SizeAtCompileTime : Dynamic
>::run(derived(), other.derived());
else
for(int i = 0; i < size(); i++)
@@ -118,11 +119,11 @@ Derived& MatrixBase<Derived>
else // copying a matrix expression into a matrix
{
ei_assert(rows() == other.rows() && cols() == other.cols());
if(SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT)
if(unroll)
{
ei_matrix_operator_equals_unroller
<Derived, OtherDerived,
SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic
unroll ? SizeAtCompileTime : Dynamic
>::run(derived(), other.derived());
}
else
@@ -152,7 +153,7 @@ template<typename OtherDerived>
Derived& MatrixBase<Derived>
::operator=(const MatrixBase<OtherDerived>& other)
{
if (OtherDerived::Flags & EvalBeforeAssigningBit)
if(OtherDerived::Flags & EvalBeforeAssigningBit)
{
return lazyAssign(other.derived().eval());
}