Narayan Kamath | c981c48 | 2012-11-02 10:59:05 +0000 | [diff] [blame] | 1 | |
| 2 | |
| 3 | /** \returns an expression of the coefficient-wise absolute value of \c *this |
| 4 | * |
| 5 | * Example: \include Cwise_abs.cpp |
| 6 | * Output: \verbinclude Cwise_abs.out |
| 7 | * |
| 8 | * \sa abs2() |
| 9 | */ |
| 10 | EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> |
| 11 | abs() const |
| 12 | { |
| 13 | return derived(); |
| 14 | } |
| 15 | |
| 16 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this |
| 17 | * |
| 18 | * Example: \include Cwise_abs2.cpp |
| 19 | * Output: \verbinclude Cwise_abs2.out |
| 20 | * |
| 21 | * \sa abs(), square() |
| 22 | */ |
| 23 | EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> |
| 24 | abs2() const |
| 25 | { |
| 26 | return derived(); |
| 27 | } |
| 28 | |
| 29 | /** \returns an expression of the coefficient-wise exponential of *this. |
| 30 | * |
| 31 | * Example: \include Cwise_exp.cpp |
| 32 | * Output: \verbinclude Cwise_exp.out |
| 33 | * |
| 34 | * \sa pow(), log(), sin(), cos() |
| 35 | */ |
| 36 | inline const CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> |
| 37 | exp() const |
| 38 | { |
| 39 | return derived(); |
| 40 | } |
| 41 | |
| 42 | /** \returns an expression of the coefficient-wise logarithm of *this. |
| 43 | * |
| 44 | * Example: \include Cwise_log.cpp |
| 45 | * Output: \verbinclude Cwise_log.out |
| 46 | * |
| 47 | * \sa exp() |
| 48 | */ |
| 49 | inline const CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> |
| 50 | log() const |
| 51 | { |
| 52 | return derived(); |
| 53 | } |
| 54 | |
| 55 | /** \returns an expression of the coefficient-wise square root of *this. |
| 56 | * |
| 57 | * Example: \include Cwise_sqrt.cpp |
| 58 | * Output: \verbinclude Cwise_sqrt.out |
| 59 | * |
| 60 | * \sa pow(), square() |
| 61 | */ |
| 62 | inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> |
| 63 | sqrt() const |
| 64 | { |
| 65 | return derived(); |
| 66 | } |
| 67 | |
| 68 | /** \returns an expression of the coefficient-wise cosine of *this. |
| 69 | * |
| 70 | * Example: \include Cwise_cos.cpp |
| 71 | * Output: \verbinclude Cwise_cos.out |
| 72 | * |
| 73 | * \sa sin(), acos() |
| 74 | */ |
| 75 | inline const CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived> |
| 76 | cos() const |
| 77 | { |
| 78 | return derived(); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | /** \returns an expression of the coefficient-wise sine of *this. |
| 83 | * |
| 84 | * Example: \include Cwise_sin.cpp |
| 85 | * Output: \verbinclude Cwise_sin.out |
| 86 | * |
| 87 | * \sa cos(), asin() |
| 88 | */ |
| 89 | inline const CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived> |
| 90 | sin() const |
| 91 | { |
| 92 | return derived(); |
| 93 | } |
| 94 | |
| 95 | /** \returns an expression of the coefficient-wise arc cosine of *this. |
| 96 | * |
| 97 | * Example: \include Cwise_acos.cpp |
| 98 | * Output: \verbinclude Cwise_acos.out |
| 99 | * |
| 100 | * \sa cos(), asin() |
| 101 | */ |
| 102 | inline const CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> |
| 103 | acos() const |
| 104 | { |
| 105 | return derived(); |
| 106 | } |
| 107 | |
| 108 | /** \returns an expression of the coefficient-wise arc sine of *this. |
| 109 | * |
| 110 | * Example: \include Cwise_asin.cpp |
| 111 | * Output: \verbinclude Cwise_asin.out |
| 112 | * |
| 113 | * \sa sin(), acos() |
| 114 | */ |
| 115 | inline const CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> |
| 116 | asin() const |
| 117 | { |
| 118 | return derived(); |
| 119 | } |
| 120 | |
| 121 | /** \returns an expression of the coefficient-wise tan of *this. |
| 122 | * |
| 123 | * Example: \include Cwise_tan.cpp |
| 124 | * Output: \verbinclude Cwise_tan.out |
| 125 | * |
| 126 | * \sa cos(), sin() |
| 127 | */ |
| 128 | inline const CwiseUnaryOp<internal::scalar_tan_op<Scalar>, Derived> |
| 129 | tan() const |
| 130 | { |
| 131 | return derived(); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | /** \returns an expression of the coefficient-wise power of *this to the given exponent. |
| 136 | * |
| 137 | * Example: \include Cwise_pow.cpp |
| 138 | * Output: \verbinclude Cwise_pow.out |
| 139 | * |
| 140 | * \sa exp(), log() |
| 141 | */ |
| 142 | inline const CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived> |
| 143 | pow(const Scalar& exponent) const |
| 144 | { |
| 145 | return CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived> |
| 146 | (derived(), internal::scalar_pow_op<Scalar>(exponent)); |
| 147 | } |
| 148 | |
| 149 | |
| 150 | /** \returns an expression of the coefficient-wise inverse of *this. |
| 151 | * |
| 152 | * Example: \include Cwise_inverse.cpp |
| 153 | * Output: \verbinclude Cwise_inverse.out |
| 154 | * |
| 155 | * \sa operator/(), operator*() |
| 156 | */ |
| 157 | inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> |
| 158 | inverse() const |
| 159 | { |
| 160 | return derived(); |
| 161 | } |
| 162 | |
| 163 | /** \returns an expression of the coefficient-wise square of *this. |
| 164 | * |
| 165 | * Example: \include Cwise_square.cpp |
| 166 | * Output: \verbinclude Cwise_square.out |
| 167 | * |
| 168 | * \sa operator/(), operator*(), abs2() |
| 169 | */ |
| 170 | inline const CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> |
| 171 | square() const |
| 172 | { |
| 173 | return derived(); |
| 174 | } |
| 175 | |
| 176 | /** \returns an expression of the coefficient-wise cube of *this. |
| 177 | * |
| 178 | * Example: \include Cwise_cube.cpp |
| 179 | * Output: \verbinclude Cwise_cube.out |
| 180 | * |
| 181 | * \sa square(), pow() |
| 182 | */ |
| 183 | inline const CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> |
| 184 | cube() const |
| 185 | { |
| 186 | return derived(); |
| 187 | } |
| 188 | |
| 189 | #define EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(METHOD_NAME,FUNCTOR) \ |
| 190 | inline const CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \ |
| 191 | METHOD_NAME(const Scalar& s) const { \ |
| 192 | return CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \ |
| 193 | (derived(), std::bind2nd(FUNCTOR<Scalar>(), s)); \ |
| 194 | } |
| 195 | |
| 196 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator==, std::equal_to) |
| 197 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator!=, std::not_equal_to) |
| 198 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<, std::less) |
| 199 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<=, std::less_equal) |
| 200 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>, std::greater) |
| 201 | EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>=, std::greater_equal) |
| 202 | |
Carlos Hernandez | 7faaa9f | 2014-08-05 17:53:32 -0700 | [diff] [blame] | 203 | |