diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-03-12 13:34:11 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-03-12 13:34:11 +0100 |
commit | 8dd3b716e39d4b4b472b948de1af20838bf17493 (patch) | |
tree | 3fa4e90f1a6caf23e5028c8c5025e04ad27a8768 /Eigen/src/Core/Product.h | |
parent | 7eefdb948c1ff372f85991ff3f9d998e66a554d9 (diff) |
Move evaluation related flags from traits to evaluator and fix evaluators of MapBase and Replicate
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r-- | Eigen/src/Core/Product.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index cac90bc1f..453180049 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -33,14 +33,29 @@ template<typename Lhs, typename Rhs, int Option, typename StorageKind> class Pro namespace internal { template<typename Lhs, typename Rhs, int Option> struct traits<Product<Lhs, Rhs, Option> > - : traits<CoeffBasedProduct<Lhs, Rhs, NestByRefBit> > -{ - // We want A+B*C to be of type Product<Matrix, Sum> and not Product<Matrix, Matrix> - // TODO: This flag should eventually go in a separate evaluator traits class +{ + typedef typename remove_all<Lhs>::type LhsCleaned; + typedef typename remove_all<Rhs>::type RhsCleaned; + + typedef MatrixXpr XprKind; + + typedef typename scalar_product_traits<typename LhsCleaned::Scalar, typename RhsCleaned::Scalar>::ReturnType Scalar; + typedef typename promote_storage_type<typename traits<LhsCleaned>::StorageKind, + typename traits<RhsCleaned>::StorageKind>::ret StorageKind; + typedef typename promote_index_type<typename traits<LhsCleaned>::Index, + typename traits<RhsCleaned>::Index>::type Index; + enum { - Flags = traits<CoeffBasedProduct<Lhs, Rhs, NestByRefBit> >::Flags & ~(EvalBeforeNestingBit | DirectAccessBit) + RowsAtCompileTime = LhsCleaned::RowsAtCompileTime, + ColsAtCompileTime = RhsCleaned::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime, + + // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. + Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0) }; }; + } // end namespace internal @@ -59,8 +74,6 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option, typename internal::promote_storage_type<typename Lhs::StorageKind, typename Rhs::StorageKind>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(Product) - - typedef typename internal::nested<Lhs>::type LhsNested; typedef typename internal::nested<Rhs>::type RhsNested; |