11 #ifndef EIGEN_CWISE_UNARY_OP_H 12 #define EIGEN_CWISE_UNARY_OP_H 15 #include "./InternalHeaderCheck.h" 20 template <
typename UnaryOp,
typename XprType>
21 struct traits<CwiseUnaryOp<UnaryOp, XprType> > : traits<XprType> {
22 typedef typename result_of<UnaryOp(const typename XprType::Scalar&)>::type Scalar;
23 typedef typename XprType::Nested XprTypeNested;
24 typedef std::remove_reference_t<XprTypeNested> XprTypeNested_;
25 enum { Flags = XprTypeNested_::Flags &
RowMajorBit };
29 template <
typename UnaryOp,
typename XprType,
typename StorageKind>
30 class CwiseUnaryOpImpl;
51 template <
typename UnaryOp,
typename XprType>
52 class CwiseUnaryOp :
public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>,
53 internal::no_assignment_operator {
55 typedef typename CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>::Base Base;
57 typedef typename internal::ref_selector<XprType>::type XprTypeNested;
58 typedef internal::remove_all_t<XprType> NestedExpression;
60 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit CwiseUnaryOp(
const XprType& xpr,
const UnaryOp& func = UnaryOp())
61 : m_xpr(xpr), m_functor(func) {}
63 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr
Index rows()
const noexcept {
return m_xpr.rows(); }
64 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr
Index cols()
const noexcept {
return m_xpr.cols(); }
67 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const UnaryOp&
functor()
const {
return m_functor; }
70 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const internal::remove_all_t<XprTypeNested>&
nestedExpression()
const {
75 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::remove_all_t<XprTypeNested>&
nestedExpression() {
return m_xpr; }
79 const UnaryOp m_functor;
83 template <
typename UnaryOp,
typename XprType,
typename StorageKind>
84 class CwiseUnaryOpImpl :
public internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type {
86 typedef typename internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
91 #endif // EIGEN_CWISE_UNARY_OP_H Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
const unsigned int RowMajorBit
Definition: Constants.h:70
internal::remove_all_t< XprTypeNested > & nestedExpression()
Definition: CwiseUnaryOp.h:75
const internal::remove_all_t< XprTypeNested > & nestedExpression() const
Definition: CwiseUnaryOp.h:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
const UnaryOp & functor() const
Definition: CwiseUnaryOp.h:67
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:52