diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-11-30 20:16:17 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-11-30 20:16:17 -0800 |
commit | fd1dc3363eebac5a22046ce0aa497e898e8d9fc0 (patch) | |
tree | 7a3bed5a0fa48f56edc37da82f2ddbf9ab9fc6bf /Eigen | |
parent | f5107010eebfa3b9422b95fa896cd0d9fd97adb4 (diff) | |
parent | 8df272af8889bf01d800a83d64c17e19dd291744 (diff) |
Merged eigen/eigen into default
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/GeneralProduct.h | 5 | ||||
-rw-r--r-- | Eigen/src/Core/ProductEvaluators.h | 9 | ||||
-rw-r--r-- | Eigen/src/Core/functors/NullaryFunctors.h | 7 | ||||
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 10 |
4 files changed, 21 insertions, 10 deletions
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 0cc2d08e2..f62ecfcbe 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -25,7 +25,8 @@ template<int Rows, int Cols, int Depth> struct product_type_selector; template<int Size, int MaxSize> struct product_size_category { enum { is_large = MaxSize == Dynamic || - Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD, + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD || + (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD), value = is_large ? Large : Size == 1 ? 1 : Small @@ -329,6 +330,7 @@ template<> struct gemv_dense_selector<OnTheRight,ColMajor,false> template<typename Lhs, typename Rhs, typename Dest> static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { + EIGEN_STATIC_ASSERT((!nested_eval<Lhs,1>::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp typename nested_eval<Rhs,1>::type actual_rhs(rhs); const Index size = rhs.rows(); @@ -342,6 +344,7 @@ template<> struct gemv_dense_selector<OnTheRight,RowMajor,false> template<typename Lhs, typename Rhs, typename Dest> static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { + EIGEN_STATIC_ASSERT((!nested_eval<Lhs,1>::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); typename nested_eval<Rhs,Lhs::RowsAtCompileTime>::type actual_rhs(rhs); const Index rows = dest.rows(); for(Index i=0; i<rows; ++i) diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index c9e2e1a07..b0e8b189e 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -366,17 +366,22 @@ template<typename Lhs, typename Rhs> struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct> : generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct> > { + typedef typename nested_eval<Lhs,1>::type LhsNested; + typedef typename nested_eval<Rhs,1>::type RhsNested; typedef typename Product<Lhs,Rhs>::Scalar Scalar; enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; - typedef typename internal::conditional<int(Side)==OnTheRight,Lhs,Rhs>::type MatrixType; + typedef typename internal::remove_all<typename internal::conditional<int(Side)==OnTheRight,LhsNested,RhsNested>::type>::type MatrixType; template<typename Dest> static EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) { + LhsNested actual_lhs(lhs); + RhsNested actual_rhs(rhs); + internal::gemv_dense_selector<Side, (int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor, bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess) - >::run(lhs, rhs, dst, alpha); + >::run(actual_lhs, actual_rhs, dst, alpha); } }; diff --git a/Eigen/src/Core/functors/NullaryFunctors.h b/Eigen/src/Core/functors/NullaryFunctors.h index 0000ea1f1..70efec3ec 100644 --- a/Eigen/src/Core/functors/NullaryFunctors.h +++ b/Eigen/src/Core/functors/NullaryFunctors.h @@ -173,6 +173,13 @@ template<typename Scalar, typename PacketType,typename IndexType> struct has_unary_operator<linspaced_op<Scalar,PacketType>,IndexType> { enum { value = 1}; }; template<typename Scalar, typename PacketType,typename IndexType> struct has_binary_operator<linspaced_op<Scalar,PacketType>,IndexType> { enum { value = 0}; }; + +template<typename Scalar,typename IndexType> +struct has_nullary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 1}; }; +template<typename Scalar,typename IndexType> +struct has_unary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 0}; }; +template<typename Scalar,typename IndexType> +struct has_binary_operator<scalar_random_op<Scalar>,IndexType> { enum { value = 0}; }; #endif } // end namespace internal diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 7cfa2c49f..efd179b35 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -445,15 +445,11 @@ template<typename T, int n, typename PlainObject = typename plain_object_eval<T> // Another solution could be to count the number of temps? NAsInteger = n == Dynamic ? HugeCost : n, CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost, - CostNoEval = NAsInteger * CoeffReadCost + CostNoEval = NAsInteger * CoeffReadCost, + Evaluate = (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || (int(CostEval) < int(CostNoEval)) }; - typedef typename conditional< - ( (int(evaluator<T>::Flags) & EvalBeforeNestingBit) || - (int(CostEval) < int(CostNoEval)) ), - PlainObject, - typename ref_selector<T>::type - >::type type; + typedef typename conditional<Evaluate, PlainObject, typename ref_selector<T>::type>::type type; }; template<typename T> |