12#ifndef EIGEN_CWISE_UNARY_OP_H
13#define EIGEN_CWISE_UNARY_OP_H
16#include "./InternalHeaderCheck.h"
21template <
typename UnaryOp,
typename XprType>
22struct traits<CwiseUnaryOp<UnaryOp, XprType> > : traits<XprType> {
23 using Scalar =
typename result_of<UnaryOp(
const typename XprType::Scalar&)>::type;
24 using XprTypeNested =
typename XprType::Nested;
25 using XprTypeNested_ = std::remove_reference_t<XprTypeNested>;
26 enum { Flags = XprTypeNested_::Flags &
RowMajorBit };
30template <
typename UnaryOp,
typename XprType,
typename StorageKind>
31class CwiseUnaryOpImpl;
53template <
typename UnaryOp,
typename XprType>
54class CwiseUnaryOp :
public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>,
55 internal::no_assignment_operator {
57 using Base =
typename CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>::Base;
58 EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
59 using XprTypeNested =
typename internal::ref_selector<XprType>::type;
60 using NestedExpression = internal::remove_all_t<XprType>;
62 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
explicit CwiseUnaryOp(
const XprType& xpr,
63 const UnaryOp& func = UnaryOp())
64 : m_xpr(xpr), m_functor(func) {}
66 EIGEN_DEVICE_FUNC
constexpr Index rows()
const noexcept {
return m_xpr.rows(); }
67 EIGEN_DEVICE_FUNC
constexpr Index cols()
const noexcept {
return m_xpr.cols(); }
70 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
const UnaryOp&
functor()
const {
return m_functor; }
73 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
const internal::remove_all_t<XprTypeNested>&
nestedExpression()
79 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE internal::remove_all_t<XprTypeNested>&
nestedExpression() {
85 const UnaryOp m_functor;
89template <
typename UnaryOp,
typename XprType,
typename StorageKind>
90class CwiseUnaryOpImpl :
public internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type {
92 using Base =
typename internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType>>::type;
constexpr internal::remove_all_t< XprTypeNested > & nestedExpression()
Definition CwiseUnaryOp.h:79
constexpr const internal::remove_all_t< XprTypeNested > & nestedExpression() const
Definition CwiseUnaryOp.h:73
constexpr const UnaryOp & functor() const
Definition CwiseUnaryOp.h:70
constexpr unsigned int RowMajorBit
Definition Constants.h:71