fix CwiseUnaryView: it shouldn't have the AlignedBit, but it should have the DirectAccessBit and corresponding strides API.

This commit is contained in:
Benoit Jacob 2010-05-08 13:42:41 -04:00
parent 2d74f1ac92
commit d03779f75f

View File

@ -47,8 +47,13 @@ struct ei_traits<CwiseUnaryView<ViewOp, MatrixType> >
typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
enum {
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | AlignedBit)),
CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)),
CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost,
MatrixTypeInnerStride = ei_inner_stride_at_compile_time<MatrixType>::ret,
InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic
? Dynamic
: MatrixTypeInnerStride * sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar),
OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<MatrixType>::ret
};
};
@ -97,6 +102,16 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
public:
inline int innerStride() const
{
return derived().nestedExpression().innerStride() * sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar);
}
inline int outerStride() const
{
return derived().nestedExpression().outerStride();
}
typedef typename ei_dense_xpr_base<CwiseUnaryView<ViewOp, MatrixType> >::type Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived)