aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CoreEvaluators.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-02-19 14:51:46 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-02-19 14:51:46 +0100
commit95b0a6707b45b78bad11fa7a090cd6439072c554 (patch)
tree86ba53a7f5128b010815fcaca24396d942917e45 /Eigen/src/Core/CoreEvaluators.h
parentb1ab6a8e0b1f1ecaffb6257fe41aecf46709348c (diff)
evaluator<Replicate> must evaluate its argument to avoid redundant evaluations
Diffstat (limited to 'Eigen/src/Core/CoreEvaluators.h')
-rw-r--r--Eigen/src/Core/CoreEvaluators.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h
index 726a6854a..92b50d190 100644
--- a/Eigen/src/Core/CoreEvaluators.h
+++ b/Eigen/src/Core/CoreEvaluators.h
@@ -815,7 +815,8 @@ struct evaluator<Replicate<ArgType, RowFactor, ColFactor> >
typedef Replicate<ArgType, RowFactor, ColFactor> XprType;
evaluator(const XprType& replicate)
- : m_argImpl(replicate.nestedExpression()),
+ : m_arg(replicate.nestedExpression()),
+ m_argImpl(m_arg),
m_rows(replicate.nestedExpression().rows()),
m_cols(replicate.nestedExpression().cols())
{ }
@@ -851,7 +852,14 @@ struct evaluator<Replicate<ArgType, RowFactor, ColFactor> >
}
protected:
- typename evaluator<ArgType>::nestedType m_argImpl;
+ enum {
+ Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor
+ };
+ typedef typename internal::nested_eval<ArgType,Factor>::type ArgTypeNested;
+ typedef typename internal::remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;
+
+ const ArgTypeNested m_arg; // FIXME is it OK to store both the argument and its evaluator?? (we have the same situation in evalautor_product)
+ typename evaluator<ArgTypeNestedCleaned>::nestedType m_argImpl;
const variable_if_dynamic<Index, ArgType::RowsAtCompileTime> m_rows;
const variable_if_dynamic<Index, ArgType::ColsAtCompileTime> m_cols;
};