diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-08-11 19:21:43 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-08-11 19:21:43 +0200 |
commit | bffdc491b304cb207ed63cc421f39e597f8a6a9d (patch) | |
tree | 80e3460d8458f194cb3fffc27b2fe28ad5b4cdef /Eigen/src/Core/VectorwiseOp.h | |
parent | 6719e56b5bfe9ae4badc9a6e894c5824f663d62e (diff) |
Fix cost evaluation of partial reduxions -> improve performance of vectorwise/replicate expressions involving partial reduxions
Diffstat (limited to 'Eigen/src/Core/VectorwiseOp.h')
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 328b6179b..f25ddca17 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -50,7 +50,7 @@ struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> > MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime, Flags0 = (unsigned int)_MatrixTypeNested::Flags & HereditaryBits, Flags = (Flags0 & ~RowMajorBit) | (RowsAtCompileTime == 1 ? RowMajorBit : 0), - TraversalSize = Direction==Vertical ? RowsAtCompileTime : ColsAtCompileTime + TraversalSize = Direction==Vertical ? MatrixType::RowsAtCompileTime : MatrixType::ColsAtCompileTime }; #if EIGEN_GNUC_AT_LEAST(3,4) typedef typename MemberOp::template Cost<InputScalar,int(TraversalSize)> CostOpType; @@ -58,7 +58,8 @@ struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> > typedef typename MemberOp::template Cost<InputScalar,TraversalSize> CostOpType; #endif enum { - CoeffReadCost = TraversalSize * traits<_MatrixTypeNested>::CoeffReadCost + int(CostOpType::value) + CoeffReadCost = TraversalSize==Dynamic ? Dynamic + : TraversalSize * traits<_MatrixTypeNested>::CoeffReadCost + int(CostOpType::value) }; }; } |