mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
- 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:
@@ -83,27 +83,30 @@ template<typename T> struct ei_eval
|
||||
template<typename T> struct ei_unref { typedef T type; };
|
||||
template<typename T> struct ei_unref<T&> { typedef T type; };
|
||||
|
||||
template<typename T> struct ei_xpr_copy
|
||||
template<typename T> struct ei_is_temporary
|
||||
{
|
||||
typedef typename ei_meta_if< ei_traits<T>::Flags & EvalBeforeNestingBit,
|
||||
typename ei_eval<T>::type, const T&>::ret type;
|
||||
enum { ret = 0 };
|
||||
};
|
||||
|
||||
template<typename T> struct ei_xpr_copy<Temporary<T> >
|
||||
template<typename T> struct ei_is_temporary<Temporary<T> >
|
||||
{
|
||||
typedef Temporary<T> type;
|
||||
enum { ret = 1 };
|
||||
};
|
||||
|
||||
template<typename T, int n=1> struct ei_eval_if_needed_before_nesting
|
||||
template<typename T, int n=1> struct ei_xpr_copy
|
||||
{
|
||||
// FIXME should we consider the additional store as well as the creation cost of the temporary ?
|
||||
enum { eval = T::Flags & EvalBeforeNestingBit
|
||||
|| (n+1) * NumTraits<typename ei_traits<T>::Scalar>::ReadCost < (n-1) * T::CoeffReadCost };
|
||||
typedef typename ei_meta_if<eval, typename ei_eval<T>::type, T>::ret XprType;
|
||||
typedef typename ei_meta_if<eval, typename ei_eval<T>::type, typename T::XprCopy>::ret CopyType;
|
||||
typedef typename ei_meta_if<
|
||||
ei_is_temporary<T>::ret,
|
||||
T,
|
||||
typename ei_meta_if<
|
||||
ei_traits<T>::Flags & EvalBeforeNestingBit
|
||||
|| (n+1) * NumTraits<typename ei_traits<T>::Scalar>::ReadCost < (n-1) * T::CoeffReadCost,
|
||||
typename ei_eval<T>::type,
|
||||
const T&
|
||||
>::ret
|
||||
>::ret type;
|
||||
};
|
||||
|
||||
|
||||
template<typename T> struct ei_functor_traits
|
||||
{
|
||||
enum
|
||||
|
||||
Reference in New Issue
Block a user