Eigen::internal::nested_eval< T, n, PlainObject > Struct Template Reference

#include <XprHelper.h>

Public Types

enum  {
  ScalarReadCost = NumTraits<typename traits<T>::Scalar>::ReadCost , CoeffReadCost , NAsInteger = n == Dynamic ? HugeCost : n , CostEval = (NAsInteger + 1) * ScalarReadCost + CoeffReadCost ,
  CostNoEval = int(NAsInteger) * int(CoeffReadCost) , Evaluate = (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || (int(CostEval) < int(CostNoEval))
}
 
typedef std::conditional_t< Evaluate, PlainObject, typename ref_selector< T >::typetype
 

Detailed Description

template<typename T, int n, typename PlainObject = typename plain_object_eval<T>::type>
struct Eigen::internal::nested_eval< T, n, PlainObject >

Determines how a given expression should be nested when evaluated multiple times. For example, when you do a * (b+c), Eigen will determine how the expression b+c should be evaluated into the bigger product expression. The choice is between nesting the expression b+c as-is, or evaluating that expression b+c into a temporary variable d, and nest d so that the resulting expression is a*d. Evaluating can be beneficial for example if every coefficient access in the resulting expression causes many coefficient accesses in the nested expressions – as is the case with matrix product for example.

Template Parameters
Tthe type of the expression being nested.
nthe number of coefficient accesses in the nested expression for each coefficient access in the bigger expression.
PlainObjectthe type of the temporary if needed.

Member Typedef Documentation

◆ type

template<typename T , int n, typename PlainObject = typename plain_object_eval<T>::type>
typedef std::conditional_t<Evaluate, PlainObject, typename ref_selector<T>::type> Eigen::internal::nested_eval< T, n, PlainObject >::type

Member Enumeration Documentation

◆ anonymous enum

template<typename T , int n, typename PlainObject = typename plain_object_eval<T>::type>
anonymous enum
Enumerator
ScalarReadCost 
CoeffReadCost 
NAsInteger 
CostEval 
CostNoEval 
Evaluate 
534  {
536  CoeffReadCost =
537  evaluator<T>::CoeffReadCost, // NOTE What if an evaluator evaluate itself into a temporary?
538  // Then CoeffReadCost will be small (e.g., 1) but we still have to evaluate,
539  // especially if n>1. This situation is already taken care by the
540  // EvalBeforeNestingBit flag, which is turned ON for all evaluator creating a
541  // temporary. This flag is then propagated by the parent evaluators. Another
542  // solution could be to count the number of temps?
543  NAsInteger = n == Dynamic ? HugeCost : n,
546  Evaluate = (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || (int(CostEval) < int(CostNoEval))
547  };
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
SCALAR Scalar
Definition: bench_gemm.cpp:45
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:74
return int(ret)+1
const int HugeCost
Definition: Constants.h:48
const int Dynamic
Definition: Constants.h:25
@ CoeffReadCost
Definition: XprHelper.h:536
@ CostNoEval
Definition: XprHelper.h:545
@ NAsInteger
Definition: XprHelper.h:543
@ ScalarReadCost
Definition: XprHelper.h:535
@ Evaluate
Definition: XprHelper.h:546
@ CostEval
Definition: XprHelper.h:544

The documentation for this struct was generated from the following file: