CwiseUnaryOp.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_CWISE_UNARY_OP_H
12 #define EIGEN_CWISE_UNARY_OP_H
13 
14 namespace Eigen {
15 
16 namespace internal {
17 template<typename UnaryOp, typename XprType>
18 struct traits<CwiseUnaryOp<UnaryOp, XprType> >
19  : traits<XprType>
20 {
21  typedef typename result_of<
22  UnaryOp(const typename XprType::Scalar&)
24  typedef typename XprType::Nested XprTypeNested;
26  enum {
27  Flags = _XprTypeNested::Flags & RowMajorBit
28  };
29 };
30 }
31 
32 template<typename UnaryOp, typename XprType, typename StorageKind>
34 
54 template<typename UnaryOp, typename XprType>
55 class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>, internal::no_assignment_operator
56 {
57  public:
58 
61  typedef typename internal::ref_selector<XprType>::type XprTypeNested;
62  typedef typename internal::remove_all<XprType>::type NestedExpression;
63 
65  explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
66  : m_xpr(xpr), m_functor(func) {}
67 
69  Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); }
71  Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); }
72 
75  const UnaryOp& functor() const { return m_functor; }
76 
80  nestedExpression() const { return m_xpr; }
81 
85  nestedExpression() { return m_xpr; }
86 
87  protected:
89  const UnaryOp m_functor;
90 };
91 
92 // Generic API dispatcher
93 template<typename UnaryOp, typename XprType, typename StorageKind>
94 class CwiseUnaryOpImpl
95  : public internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
96 {
97 public:
99 };
100 
101 } // end namespace Eigen
102 
103 #endif // EIGEN_CWISE_UNARY_OP_H
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::RowMajorBit
const unsigned int RowMajorBit
Definition: Constants.h:66
EIGEN_CONSTEXPR
#define EIGEN_CONSTEXPR
Definition: Macros.h:787
Eigen::CwiseUnaryOp::nestedExpression
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::remove_all< XprTypeNested >::type & nestedExpression()
Definition: CwiseUnaryOp.h:85
type
Definition: pytypes.h:1491
Eigen::internal::true_type
Definition: Meta.h:96
EIGEN_GENERIC_PUBLIC_INTERFACE
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1264
Eigen::CwiseUnaryOp::nestedExpression
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE internal::remove_all< XprTypeNested >::type & nestedExpression() const
Definition: CwiseUnaryOp.h:80
Eigen::CwiseUnaryOpImpl::Base
internal::generic_xpr_base< CwiseUnaryOp< UnaryOp, XprType > >::type Base
Definition: CwiseUnaryOp.h:98
Eigen::internal::traits< CwiseUnaryOp< UnaryOp, XprType > >::_XprTypeNested
remove_reference< XprTypeNested >::type _XprTypeNested
Definition: CwiseUnaryOp.h:25
Eigen::internal::generic_xpr_base
Definition: XprHelper.h:501
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::internal::traits< CwiseUnaryOp< UnaryOp, XprType > >::Scalar
result_of< UnaryOp(const typename XprType::Scalar &) >::type Scalar
Definition: CwiseUnaryOp.h:23
Eigen::Triplet< double >
Eigen::CwiseUnaryOp::cols
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: CwiseUnaryOp.h:71
XprType
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
Definition: nestbyvalue.cpp:15
Eigen::internal::traits< CwiseUnaryOp< UnaryOp, XprType > >::XprTypeNested
XprType::Nested XprTypeNested
Definition: CwiseUnaryOp.h:24
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::CwiseUnaryOp
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
Eigen::CwiseUnaryOp::m_functor
const UnaryOp m_functor
Definition: CwiseUnaryOp.h:89
Eigen::CwiseUnaryOp::rows
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: CwiseUnaryOp.h:69
Eigen::CwiseUnaryOp::m_xpr
XprTypeNested m_xpr
Definition: CwiseUnaryOp.h:88
Eigen::internal::result_of
Definition: Meta.h:513
Eigen::CwiseUnaryOp::Base
CwiseUnaryOpImpl< UnaryOp, XprType, typename internal::traits< XprType >::StorageKind >::Base Base
Definition: CwiseUnaryOp.h:59
Eigen::CwiseUnaryOp::functor
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE UnaryOp & functor() const
Definition: CwiseUnaryOp.h:75
Eigen::internal::no_assignment_operator
Definition: XprHelper.h:109
EIGEN_NOEXCEPT
#define EIGEN_NOEXCEPT
Definition: Macros.h:1418
internal
Definition: BandTriangularSolver.h:13
func
Definition: benchGeometry.cpp:23
Eigen::CwiseUnaryOpImpl
Definition: CwiseUnaryOp.h:33
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


gtsam
Author(s):
autogenerated on Sat Jun 1 2024 03:01:26