fix flag and cost computations for nested expressions

This commit is contained in:
Gael Guennebaud
2008-05-01 18:58:30 +00:00
parent 5588def0cf
commit ef5b20bc50
7 changed files with 43 additions and 19 deletions

View File

@@ -45,15 +45,19 @@ struct ei_traits<CwiseUnaryOp<UnaryOp, MatrixType> >
typedef typename ei_result_of<
UnaryOp(typename MatrixType::Scalar)
>::type Scalar;
typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {
MatrixTypeCoeffReadCost = _MatrixTypeNested::CoeffReadCost,
MatrixTypeFlags = _MatrixTypeNested::Flags,
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
Flags = (MatrixType::Flags & (
Flags = (MatrixTypeFlags & (
DefaultLostFlagMask | Like1DArrayBit
| (ei_functor_traits<UnaryOp>::IsVectorizable ? VectorizableBit : 0))),
CoeffReadCost = MatrixType::CoeffReadCost + ei_functor_traits<UnaryOp>::Cost
CoeffReadCost = MatrixTypeCoeffReadCost + ei_functor_traits<UnaryOp>::Cost
};
};