MatrixCwiseUnaryOps.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-2009 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 // This file is included into the body of the base classes supporting matrix specific coefficient-wise functions.
12 // This include MatrixBase and SparseMatrixBase.
13 
14 
15 typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> CwiseAbsReturnType;
16 typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> CwiseAbs2ReturnType;
17 typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> CwiseArgReturnType;
18 typedef CwiseUnaryOp<internal::scalar_carg_op<Scalar>, const Derived> CwiseCArgReturnType;
19 typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> CwiseSqrtReturnType;
20 typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> CwiseSignReturnType;
21 typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> CwiseInverseReturnType;
22 
28 EIGEN_DOC_UNARY_ADDONS(cwiseAbs,absolute value)
33 EIGEN_STRONG_INLINE const CwiseAbsReturnType
34 cwiseAbs() const { return CwiseAbsReturnType(derived()); }
35 
41 EIGEN_DOC_UNARY_ADDONS(cwiseAbs2,squared absolute value)
46 EIGEN_STRONG_INLINE const CwiseAbs2ReturnType
47 cwiseAbs2() const { return CwiseAbs2ReturnType(derived()); }
48 
59 inline const CwiseSqrtReturnType
60 cwiseSqrt() const { return CwiseSqrtReturnType(derived()); }
61 
70 inline const CwiseSignReturnType
71 cwiseSign() const { return CwiseSignReturnType(derived()); }
72 
73 
84 inline const CwiseInverseReturnType
85 cwiseInverse() const { return CwiseInverseReturnType(derived()); }
86 
93 
95 inline const CwiseArgReturnType
96 cwiseArg() const { return CwiseArgReturnType(derived()); }
97 
99 EIGEN_STRONG_INLINE const CwiseCArgReturnType
100 cwiseCArg() const { return CwiseCArgReturnType(derived()); }
101 
102 template <typename ScalarExponent>
104  std::enable_if_t<internal::is_arithmetic<typename NumTraits<ScalarExponent>::Real>::value,
105  CwiseUnaryOp<internal::scalar_unary_pow_op<Scalar, ScalarExponent>, const Derived>>;
106 
107 template <typename ScalarExponent>
108 EIGEN_DEVICE_FUNC inline const CwisePowReturnType<ScalarExponent> cwisePow(const ScalarExponent& exponent) const {
109  return CwisePowReturnType<ScalarExponent>(derived(), internal::scalar_unary_pow_op<Scalar, ScalarExponent>(exponent));
110 }
#define EIGEN_DOC_UNARY_ADDONS(X, Y)
Definition: ArrayBase.h:93
const SignReturnType sign() const
const ArgReturnType arg() const
const SquareReturnType square() const
const InverseReturnType inverse() const
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > CwiseAbsReturnType
CwiseUnaryOp< internal::scalar_arg_op< Scalar >, const Derived > CwiseArgReturnType
CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > CwiseAbs2ReturnType
CwiseUnaryOp< internal::scalar_carg_op< Scalar >, const Derived > CwiseCArgReturnType
const CwiseArgReturnType cwiseArg() const
std::enable_if_t< internal::is_arithmetic< typename NumTraits< ScalarExponent >::Real >::value, CwiseUnaryOp< internal::scalar_unary_pow_op< Scalar, ScalarExponent >, const Derived > > CwisePowReturnType
CwiseUnaryOp< internal::scalar_sign_op< Scalar >, const Derived > CwiseSignReturnType
CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > CwiseSqrtReturnType
const CwiseAbs2ReturnType cwiseAbs2() const
CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > CwiseInverseReturnType
const CwiseSignReturnType cwiseSign() const
const CwisePowReturnType< ScalarExponent > cwisePow(const ScalarExponent &exponent) const
const CwiseInverseReturnType cwiseInverse() const
const CwiseSqrtReturnType cwiseSqrt() const
const CwiseAbsReturnType cwiseAbs() const
const CwiseCArgReturnType cwiseCArg() const