10 #ifndef EIGEN_CWISE_UNARY_VIEW_H 11 #define EIGEN_CWISE_UNARY_VIEW_H 16 template<
typename ViewOp,
typename MatrixType>
17 struct traits<CwiseUnaryView<ViewOp, MatrixType> >
20 typedef typename result_of<
21 ViewOp(
const typename traits<MatrixType>::Scalar&)
23 typedef typename MatrixType::Nested MatrixTypeNested;
24 typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested;
26 FlagsLvalueBit = is_lvalue<MatrixType>::value ?
LvalueBit : 0,
28 MatrixTypeInnerStride = inner_stride_at_compile_time<MatrixType>::ret,
31 InnerStrideAtCompileTime = MatrixTypeInnerStride ==
Dynamic 33 : int(MatrixTypeInnerStride) * int(sizeof(typename traits<MatrixType>::Scalar) / sizeof(Scalar)),
34 OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::ret ==
Dynamic 36 : outer_stride_at_compile_time<MatrixType>::ret * int(sizeof(typename traits<MatrixType>::Scalar) / sizeof(Scalar))
41 template<
typename ViewOp,
typename MatrixType,
typename StorageKind>
42 class CwiseUnaryViewImpl;
57 template<
typename ViewOp,
typename MatrixType>
58 class CwiseUnaryView :
public CwiseUnaryViewImpl<ViewOp, MatrixType, typename internal::traits<MatrixType>::StorageKind>
62 typedef typename CwiseUnaryViewImpl<ViewOp, MatrixType,typename internal::traits<MatrixType>::StorageKind>::Base Base;
64 typedef typename internal::ref_selector<MatrixType>::non_const_type MatrixTypeNested;
65 typedef typename internal::remove_all<MatrixType>::type NestedExpression;
67 explicit inline CwiseUnaryView(MatrixType& mat,
const ViewOp& func = ViewOp())
68 : m_matrix(mat), m_functor(func) {}
72 EIGEN_STRONG_INLINE
Index rows()
const {
return m_matrix.rows(); }
73 EIGEN_STRONG_INLINE
Index cols()
const {
return m_matrix.cols(); }
76 const ViewOp&
functor()
const {
return m_functor; }
79 const typename internal::remove_all<MatrixTypeNested>::type&
83 typename internal::remove_reference<MatrixTypeNested>::type&
87 MatrixTypeNested m_matrix;
92 template<
typename ViewOp,
typename XprType,
typename StorageKind>
93 class CwiseUnaryViewImpl
94 :
public internal::generic_xpr_base<CwiseUnaryView<ViewOp, XprType> >::type
97 typedef typename internal::generic_xpr_base<CwiseUnaryView<ViewOp, XprType> >::type Base;
100 template<
typename ViewOp,
typename MatrixType>
101 class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
102 :
public internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type
107 typedef typename internal::dense_xpr_base< CwiseUnaryView<ViewOp, MatrixType> >::type Base;
109 EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
110 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl)
112 EIGEN_DEVICE_FUNC
inline Scalar* data() {
return &(this->coeffRef(0)); }
113 EIGEN_DEVICE_FUNC
inline const Scalar* data()
const {
return &(this->coeff(0)); }
115 EIGEN_DEVICE_FUNC
inline Index innerStride()
const 117 return derived().nestedExpression().innerStride() *
sizeof(
typename internal::traits<MatrixType>::Scalar) /
sizeof(Scalar);
120 EIGEN_DEVICE_FUNC
inline Index outerStride()
const 122 return derived().nestedExpression().outerStride() *
sizeof(
typename internal::traits<MatrixType>::Scalar) /
sizeof(Scalar);
128 #endif // EIGEN_CWISE_UNARY_VIEW_H const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition: CwiseUnaryView.h:80
const unsigned int DirectAccessBit
Definition: Constants.h:150
const unsigned int LvalueBit
Definition: Constants.h:139
const ViewOp & functor() const
Definition: CwiseUnaryView.h:76
Namespace containing all symbols from the Eigen library.
Definition: Core:287
const unsigned int RowMajorBit
Definition: Constants.h:61
Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector.
Definition: CwiseUnaryView.h:58
internal::remove_reference< MatrixTypeNested >::type & nestedExpression()
Definition: CwiseUnaryView.h:84
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Eigen_Colamd.h:50
const int Dynamic
Definition: Constants.h:21