From a4cc4c1e5e0ca1ee46818cda81793e4b5e586221 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 9 Oct 2015 14:57:51 +0200 Subject: Clarify note in nested_eval for evaluator creating temporaries. --- Eigen/src/Core/util/XprHelper.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Eigen/src') 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::type> struc DynamicAsInteger = 10000, ScalarReadCost = NumTraits::Scalar>::ReadCost, ScalarReadCostAsInteger = ScalarReadCost == Dynamic ? int(DynamicAsInteger) : int(ScalarReadCost), - CoeffReadCost = evaluator::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::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, -- cgit v1.2.3