diff options
author | 2015-10-09 14:57:51 +0200 | |
---|---|---|
committer | 2015-10-09 14:57:51 +0200 | |
commit | a4cc4c1e5e0ca1ee46818cda81793e4b5e586221 (patch) | |
tree | 68295482239cd0e70a145aac2329d5e84687b8d0 /Eigen/src | |
parent | ae38910693d9ff96eb5be3ac6cd9a075fc8f7da9 (diff) |
Clarify note in nested_eval for evaluator creating temporaries.
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 052f824ae..c85a6be80 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -396,9 +396,11 @@ template<typename T, int n, typename PlainObject = typename eval<T>::type> struc DynamicAsInteger = 10000, ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost, ScalarReadCostAsInteger = ScalarReadCost == Dynamic ? int(DynamicAsInteger) : int(ScalarReadCost), - CoeffReadCost = evaluator<T>::CoeffReadCost, // TODO What if an evaluator evaluate itself into a tempory? - // Then CoeffReadCost will be small but we still have to evaluate if n>1... - // The solution might be to ask the evaluator if it creates a temp. Perhaps we could even ask the number of temps? + CoeffReadCost = evaluator<T>::CoeffReadCost, // NOTE What if an evaluator evaluate itself into a tempory? + // Then CoeffReadCost will be small (e.g., 1) but we still have to evaluate, especially if n>1. + // This situation is already taken care by the EvalBeforeNestingBit flag, which is turned ON + // for all evaluator creating a temporary. This flag is then propagated by the parent evaluators. + // Another solution could be to count the number of temps? CoeffReadCostAsInteger = CoeffReadCost == Dynamic ? int(DynamicAsInteger) : int(CoeffReadCost), NAsInteger = n == Dynamic ? int(DynamicAsInteger) : n, CostEvalAsInteger = (NAsInteger+1) * ScalarReadCostAsInteger + CoeffReadCostAsInteger, |