11#ifndef EIGEN_CWISE_UNARY_OP_H
12#define EIGEN_CWISE_UNARY_OP_H
15#include "./InternalHeaderCheck.h"
20template <
typename UnaryOp,
typename XprType>
21struct 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 };
29template <
typename UnaryOp,
typename XprType,
typename StorageKind>
30class CwiseUnaryOpImpl;
51template <
typename UnaryOp,
typename XprType>
52class 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 EIGEN_CONSTEXPR
Index rows()
const EIGEN_NOEXCEPT {
return m_xpr.rows(); }
64 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
Index cols()
const EIGEN_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;
83template <
typename UnaryOp,
typename XprType,
typename StorageKind>
84class CwiseUnaryOpImpl :
public internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type {
86 typedef typename internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:53
const internal::remove_all_t< XprTypeNested > & nestedExpression() const
Definition CwiseUnaryOp.h:70
internal::remove_all_t< XprTypeNested > & nestedExpression()
Definition CwiseUnaryOp.h:75
const UnaryOp & functor() const
Definition CwiseUnaryOp.h:67
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83