Medial Code Documentation
Loading...
Searching...
No Matches
CwiseUnaryOp.h
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
14namespace Eigen {
15
36namespace internal {
37template<typename UnaryOp, typename XprType>
38struct traits<CwiseUnaryOp<UnaryOp, XprType> >
39 : traits<XprType>
40{
41 typedef typename result_of<
42 UnaryOp(typename XprType::Scalar)
43 >::type Scalar;
44 typedef typename XprType::Nested XprTypeNested;
45 typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;
46 enum {
47 Flags = _XprTypeNested::Flags & RowMajorBit
48 };
49};
50}
51
52template<typename UnaryOp, typename XprType, typename StorageKind>
54
55template<typename UnaryOp, typename XprType>
56class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal::traits<XprType>::StorageKind>, internal::no_assignment_operator
57{
58 public:
59
61 EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
63
65 explicit inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
66 : m_xpr(xpr), m_functor(func) {}
67
69 EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); }
71 EIGEN_STRONG_INLINE Index cols() const { 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.const_cast_derived(); }
86
87 protected:
88 typename XprType::Nested m_xpr;
89 const UnaryOp m_functor;
90};
91
92// Generic API dispatcher
93template<typename UnaryOp, typename XprType, typename StorageKind>
95 : public internal::generic_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
96{
97public:
99};
100
101} // end namespace Eigen
102
103#endif // EIGEN_CWISE_UNARY_OP_H
Definition CwiseUnaryOp.h:96
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:57
EIGEN_DEVICE_FUNC const internal::remove_all< typenameXprType::Nested >::type & nestedExpression() const
Definition CwiseUnaryOp.h:80
EIGEN_DEVICE_FUNC const UnaryOp & functor() const
Definition CwiseUnaryOp.h:75
EIGEN_DEVICE_FUNC internal::remove_all< typenameXprType::Nested >::type & nestedExpression()
Definition CwiseUnaryOp.h:85
Pseudo expression representing a solving operation.
Definition Solve.h:63
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
Definition XprHelper.h:445
Definition Meta.h:253
Definition ForwardDeclarations.h:17