25 #ifndef EIGEN_CWISE_UNARY_VIEW_H
26 #define EIGEN_CWISE_UNARY_VIEW_H
45 template<
typename ViewOp,
typename MatrixType>
46 struct traits<CwiseUnaryView<ViewOp, MatrixType> >
49 typedef typename result_of<
52 typedef typename MatrixType::Nested MatrixTypeNested;
53 typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested;
57 MatrixTypeInnerStride = inner_stride_at_compile_time<MatrixType>::ret,
60 InnerStrideAtCompileTime = MatrixTypeInnerStride ==
Dynamic
62 : int(MatrixTypeInnerStride)
63 * int(sizeof(typename
traits<MatrixType>::Scalar) / sizeof(Scalar)),
64 OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::ret
69 template<
typename ViewOp,
typename MatrixType,
typename StorageKind>
72 template<
typename ViewOp,
typename MatrixType>
74 public CwiseUnaryViewImpl<ViewOp, MatrixType, typename internal::traits<MatrixType>::StorageKind>
82 : m_matrix(mat), m_functor(func) {}
90 const ViewOp&
functor()
const {
return m_functor; }
93 const typename internal::remove_all<typename MatrixType::Nested>::type&
97 typename internal::remove_all<typename MatrixType::Nested>::type&
102 typename internal::nested<MatrixType>::type
m_matrix;
106 template<
typename ViewOp,
typename MatrixType>
108 :
public internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
113 typedef typename internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
Base;
117 inline Index innerStride()
const
119 return derived().nestedExpression().innerStride() *
sizeof(
typename internal::traits<MatrixType>::Scalar) /
sizeof(Scalar);
122 inline Index outerStride()
const
124 return derived().nestedExpression().outerStride();
129 return derived().functor()(derived().nestedExpression().coeff(row, col));
134 return derived().functor()(derived().nestedExpression().coeff(index));
139 return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col));
144 return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index));
150 #endif // EIGEN_CWISE_UNARY_VIEW_H