1 2 3typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> AbsReturnType; 4typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> ArgReturnType; 5typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Abs2ReturnType; 6typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> SqrtReturnType; 7typedef CwiseUnaryOp<internal::scalar_rsqrt_op<Scalar>, const Derived> RsqrtReturnType; 8typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> SignReturnType; 9typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType; 10typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType; 11 12typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType; 13typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; 14typedef CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived> Log1pReturnType; 15typedef CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived> Log10ReturnType; 16typedef CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived> CosReturnType; 17typedef CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived> SinReturnType; 18typedef CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived> TanReturnType; 19typedef CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> AcosReturnType; 20typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> AsinReturnType; 21typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> AtanReturnType; 22typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturnType; 23typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType; 24typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType; 25typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> SquareReturnType; 26typedef CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> CubeReturnType; 27typedef CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived> RoundReturnType; 28typedef CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived> FloorReturnType; 29typedef CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived> CeilReturnType; 30typedef CwiseUnaryOp<internal::scalar_isnan_op<Scalar>, const Derived> IsNaNReturnType; 31typedef CwiseUnaryOp<internal::scalar_isinf_op<Scalar>, const Derived> IsInfReturnType; 32typedef CwiseUnaryOp<internal::scalar_isfinite_op<Scalar>, const Derived> IsFiniteReturnType; 33 34/** \returns an expression of the coefficient-wise absolute value of \c *this 35 * 36 * Example: \include Cwise_abs.cpp 37 * Output: \verbinclude Cwise_abs.out 38 * 39 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_abs">Math functions</a>, abs2() 40 */ 41EIGEN_DEVICE_FUNC 42EIGEN_STRONG_INLINE const AbsReturnType 43abs() const 44{ 45 return AbsReturnType(derived()); 46} 47 48/** \returns an expression of the coefficient-wise phase angle of \c *this 49 * 50 * Example: \include Cwise_arg.cpp 51 * Output: \verbinclude Cwise_arg.out 52 * 53 * \sa abs() 54 */ 55EIGEN_DEVICE_FUNC 56EIGEN_STRONG_INLINE const ArgReturnType 57arg() const 58{ 59 return ArgReturnType(derived()); 60} 61 62/** \returns an expression of the coefficient-wise squared absolute value of \c *this 63 * 64 * Example: \include Cwise_abs2.cpp 65 * Output: \verbinclude Cwise_abs2.out 66 * 67 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_abs2">Math functions</a>, abs(), square() 68 */ 69EIGEN_DEVICE_FUNC 70EIGEN_STRONG_INLINE const Abs2ReturnType 71abs2() const 72{ 73 return Abs2ReturnType(derived()); 74} 75 76/** \returns an expression of the coefficient-wise exponential of *this. 77 * 78 * This function computes the coefficient-wise exponential. The function MatrixBase::exp() in the 79 * unsupported module MatrixFunctions computes the matrix exponential. 80 * 81 * Example: \include Cwise_exp.cpp 82 * Output: \verbinclude Cwise_exp.out 83 * 84 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_exp">Math functions</a>, pow(), log(), sin(), cos() 85 */ 86EIGEN_DEVICE_FUNC 87inline const ExpReturnType 88exp() const 89{ 90 return ExpReturnType(derived()); 91} 92 93/** \returns an expression of the coefficient-wise logarithm of *this. 94 * 95 * This function computes the coefficient-wise logarithm. The function MatrixBase::log() in the 96 * unsupported module MatrixFunctions computes the matrix logarithm. 97 * 98 * Example: \include Cwise_log.cpp 99 * Output: \verbinclude Cwise_log.out 100 * 101 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log">Math functions</a>, exp() 102 */ 103EIGEN_DEVICE_FUNC 104inline const LogReturnType 105log() const 106{ 107 return LogReturnType(derived()); 108} 109 110/** \returns an expression of the coefficient-wise logarithm of 1 plus \c *this. 111 * 112 * In exact arithmetic, \c x.log() is equivalent to \c (x+1).log(), 113 * however, with finite precision, this function is much more accurate when \c x is close to zero. 114 * 115 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log1p">Math functions</a>, log() 116 */ 117EIGEN_DEVICE_FUNC 118inline const Log1pReturnType 119log1p() const 120{ 121 return Log1pReturnType(derived()); 122} 123 124/** \returns an expression of the coefficient-wise base-10 logarithm of *this. 125 * 126 * This function computes the coefficient-wise base-10 logarithm. 127 * 128 * Example: \include Cwise_log10.cpp 129 * Output: \verbinclude Cwise_log10.out 130 * 131 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log10">Math functions</a>, log() 132 */ 133EIGEN_DEVICE_FUNC 134inline const Log10ReturnType 135log10() const 136{ 137 return Log10ReturnType(derived()); 138} 139 140/** \returns an expression of the coefficient-wise square root of *this. 141 * 142 * This function computes the coefficient-wise square root. The function MatrixBase::sqrt() in the 143 * unsupported module MatrixFunctions computes the matrix square root. 144 * 145 * Example: \include Cwise_sqrt.cpp 146 * Output: \verbinclude Cwise_sqrt.out 147 * 148 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sqrt">Math functions</a>, pow(), square() 149 */ 150EIGEN_DEVICE_FUNC 151inline const SqrtReturnType 152sqrt() const 153{ 154 return SqrtReturnType(derived()); 155} 156 157/** \returns an expression of the coefficient-wise inverse square root of *this. 158 * 159 * This function computes the coefficient-wise inverse square root. 160 * 161 * Example: \include Cwise_sqrt.cpp 162 * Output: \verbinclude Cwise_sqrt.out 163 * 164 * \sa pow(), square() 165 */ 166EIGEN_DEVICE_FUNC 167inline const RsqrtReturnType 168rsqrt() const 169{ 170 return RsqrtReturnType(derived()); 171} 172 173/** \returns an expression of the coefficient-wise signum of *this. 174 * 175 * This function computes the coefficient-wise signum. 176 * 177 * Example: \include Cwise_sign.cpp 178 * Output: \verbinclude Cwise_sign.out 179 * 180 * \sa pow(), square() 181 */ 182EIGEN_DEVICE_FUNC 183inline const SignReturnType 184sign() const 185{ 186 return SignReturnType(derived()); 187} 188 189 190/** \returns an expression of the coefficient-wise cosine of *this. 191 * 192 * This function computes the coefficient-wise cosine. The function MatrixBase::cos() in the 193 * unsupported module MatrixFunctions computes the matrix cosine. 194 * 195 * Example: \include Cwise_cos.cpp 196 * Output: \verbinclude Cwise_cos.out 197 * 198 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cos">Math functions</a>, sin(), acos() 199 */ 200EIGEN_DEVICE_FUNC 201inline const CosReturnType 202cos() const 203{ 204 return CosReturnType(derived()); 205} 206 207 208/** \returns an expression of the coefficient-wise sine of *this. 209 * 210 * This function computes the coefficient-wise sine. The function MatrixBase::sin() in the 211 * unsupported module MatrixFunctions computes the matrix sine. 212 * 213 * Example: \include Cwise_sin.cpp 214 * Output: \verbinclude Cwise_sin.out 215 * 216 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sin">Math functions</a>, cos(), asin() 217 */ 218EIGEN_DEVICE_FUNC 219inline const SinReturnType 220sin() const 221{ 222 return SinReturnType(derived()); 223} 224 225/** \returns an expression of the coefficient-wise tan of *this. 226 * 227 * Example: \include Cwise_tan.cpp 228 * Output: \verbinclude Cwise_tan.out 229 * 230 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_tan">Math functions</a>, cos(), sin() 231 */ 232EIGEN_DEVICE_FUNC 233inline const TanReturnType 234tan() const 235{ 236 return TanReturnType(derived()); 237} 238 239/** \returns an expression of the coefficient-wise arc tan of *this. 240 * 241 * Example: \include Cwise_atan.cpp 242 * Output: \verbinclude Cwise_atan.out 243 * 244 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_atan">Math functions</a>, tan(), asin(), acos() 245 */ 246EIGEN_DEVICE_FUNC 247inline const AtanReturnType 248atan() const 249{ 250 return AtanReturnType(derived()); 251} 252 253/** \returns an expression of the coefficient-wise arc cosine of *this. 254 * 255 * Example: \include Cwise_acos.cpp 256 * Output: \verbinclude Cwise_acos.out 257 * 258 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_acos">Math functions</a>, cos(), asin() 259 */ 260EIGEN_DEVICE_FUNC 261inline const AcosReturnType 262acos() const 263{ 264 return AcosReturnType(derived()); 265} 266 267/** \returns an expression of the coefficient-wise arc sine of *this. 268 * 269 * Example: \include Cwise_asin.cpp 270 * Output: \verbinclude Cwise_asin.out 271 * 272 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_asin">Math functions</a>, sin(), acos() 273 */ 274EIGEN_DEVICE_FUNC 275inline const AsinReturnType 276asin() const 277{ 278 return AsinReturnType(derived()); 279} 280 281/** \returns an expression of the coefficient-wise hyperbolic tan of *this. 282 * 283 * Example: \include Cwise_tanh.cpp 284 * Output: \verbinclude Cwise_tanh.out 285 * 286 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_tanh">Math functions</a>, tan(), sinh(), cosh() 287 */ 288EIGEN_DEVICE_FUNC 289inline const TanhReturnType 290tanh() const 291{ 292 return TanhReturnType(derived()); 293} 294 295/** \returns an expression of the coefficient-wise hyperbolic sin of *this. 296 * 297 * Example: \include Cwise_sinh.cpp 298 * Output: \verbinclude Cwise_sinh.out 299 * 300 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sinh">Math functions</a>, sin(), tanh(), cosh() 301 */ 302EIGEN_DEVICE_FUNC 303inline const SinhReturnType 304sinh() const 305{ 306 return SinhReturnType(derived()); 307} 308 309/** \returns an expression of the coefficient-wise hyperbolic cos of *this. 310 * 311 * Example: \include Cwise_cosh.cpp 312 * Output: \verbinclude Cwise_cosh.out 313 * 314 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cosh">Math functions</a>, tan(), sinh(), cosh() 315 */ 316EIGEN_DEVICE_FUNC 317inline const CoshReturnType 318cosh() const 319{ 320 return CoshReturnType(derived()); 321} 322 323/** \returns an expression of the coefficient-wise inverse of *this. 324 * 325 * Example: \include Cwise_inverse.cpp 326 * Output: \verbinclude Cwise_inverse.out 327 * 328 * \sa operator/(), operator*() 329 */ 330EIGEN_DEVICE_FUNC 331inline const InverseReturnType 332inverse() const 333{ 334 return InverseReturnType(derived()); 335} 336 337/** \returns an expression of the coefficient-wise square of *this. 338 * 339 * Example: \include Cwise_square.cpp 340 * Output: \verbinclude Cwise_square.out 341 * 342 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_squareE">Math functions</a>, abs2(), cube(), pow() 343 */ 344EIGEN_DEVICE_FUNC 345inline const SquareReturnType 346square() const 347{ 348 return SquareReturnType(derived()); 349} 350 351/** \returns an expression of the coefficient-wise cube of *this. 352 * 353 * Example: \include Cwise_cube.cpp 354 * Output: \verbinclude Cwise_cube.out 355 * 356 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cube">Math functions</a>, square(), pow() 357 */ 358EIGEN_DEVICE_FUNC 359inline const CubeReturnType 360cube() const 361{ 362 return CubeReturnType(derived()); 363} 364 365/** \returns an expression of the coefficient-wise round of *this. 366 * 367 * Example: \include Cwise_round.cpp 368 * Output: \verbinclude Cwise_round.out 369 * 370 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_round">Math functions</a>, ceil(), floor() 371 */ 372EIGEN_DEVICE_FUNC 373inline const RoundReturnType 374round() const 375{ 376 return RoundReturnType(derived()); 377} 378 379/** \returns an expression of the coefficient-wise floor of *this. 380 * 381 * Example: \include Cwise_floor.cpp 382 * Output: \verbinclude Cwise_floor.out 383 * 384 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_floor">Math functions</a>, ceil(), round() 385 */ 386EIGEN_DEVICE_FUNC 387inline const FloorReturnType 388floor() const 389{ 390 return FloorReturnType(derived()); 391} 392 393/** \returns an expression of the coefficient-wise ceil of *this. 394 * 395 * Example: \include Cwise_ceil.cpp 396 * Output: \verbinclude Cwise_ceil.out 397 * 398 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_ceil">Math functions</a>, floor(), round() 399 */ 400EIGEN_DEVICE_FUNC 401inline const CeilReturnType 402ceil() const 403{ 404 return CeilReturnType(derived()); 405} 406 407/** \returns an expression of the coefficient-wise isnan of *this. 408 * 409 * Example: \include Cwise_isNaN.cpp 410 * Output: \verbinclude Cwise_isNaN.out 411 * 412 * \sa isfinite(), isinf() 413 */ 414EIGEN_DEVICE_FUNC 415inline const IsNaNReturnType 416isNaN() const 417{ 418 return IsNaNReturnType(derived()); 419} 420 421/** \returns an expression of the coefficient-wise isinf of *this. 422 * 423 * Example: \include Cwise_isInf.cpp 424 * Output: \verbinclude Cwise_isInf.out 425 * 426 * \sa isnan(), isfinite() 427 */ 428EIGEN_DEVICE_FUNC 429inline const IsInfReturnType 430isInf() const 431{ 432 return IsInfReturnType(derived()); 433} 434 435/** \returns an expression of the coefficient-wise isfinite of *this. 436 * 437 * Example: \include Cwise_isFinite.cpp 438 * Output: \verbinclude Cwise_isFinite.out 439 * 440 * \sa isnan(), isinf() 441 */ 442EIGEN_DEVICE_FUNC 443inline const IsFiniteReturnType 444isFinite() const 445{ 446 return IsFiniteReturnType(derived()); 447} 448 449/** \returns an expression of the coefficient-wise ! operator of *this 450 * 451 * \warning this operator is for expression of bool only. 452 * 453 * Example: \include Cwise_boolean_not.cpp 454 * Output: \verbinclude Cwise_boolean_not.out 455 * 456 * \sa operator!=() 457 */ 458EIGEN_DEVICE_FUNC 459inline const BooleanNotReturnType 460operator!() const 461{ 462 EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value), 463 THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); 464 return BooleanNotReturnType(derived()); 465} 466 467 468// --- SpecialFunctions module --- 469 470typedef CwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived> LgammaReturnType; 471typedef CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived> DigammaReturnType; 472typedef CwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived> ErfReturnType; 473typedef CwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived> ErfcReturnType; 474 475/** \cpp11 \returns an expression of the coefficient-wise ln(|gamma(*this)|). 476 * 477 * \specialfunctions_module 478 * 479 * Example: \include Cwise_lgamma.cpp 480 * Output: \verbinclude Cwise_lgamma.out 481 * 482 * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, 483 * or float/double in non c++11 mode, the user has to provide implementations of lgamma(T) for any scalar 484 * type T to be supported. 485 * 486 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_lgamma">Math functions</a>, digamma() 487 */ 488EIGEN_DEVICE_FUNC 489inline const LgammaReturnType 490lgamma() const 491{ 492 return LgammaReturnType(derived()); 493} 494 495/** \returns an expression of the coefficient-wise digamma (psi, derivative of lgamma). 496 * 497 * \specialfunctions_module 498 * 499 * \note This function supports only float and double scalar types. To support other scalar types, 500 * the user has to provide implementations of digamma(T) for any scalar 501 * type T to be supported. 502 * 503 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_digamma">Math functions</a>, Eigen::digamma(), Eigen::polygamma(), lgamma() 504 */ 505EIGEN_DEVICE_FUNC 506inline const DigammaReturnType 507digamma() const 508{ 509 return DigammaReturnType(derived()); 510} 511 512/** \cpp11 \returns an expression of the coefficient-wise Gauss error 513 * function of *this. 514 * 515 * \specialfunctions_module 516 * 517 * Example: \include Cwise_erf.cpp 518 * Output: \verbinclude Cwise_erf.out 519 * 520 * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, 521 * or float/double in non c++11 mode, the user has to provide implementations of erf(T) for any scalar 522 * type T to be supported. 523 * 524 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_erf">Math functions</a>, erfc() 525 */ 526EIGEN_DEVICE_FUNC 527inline const ErfReturnType 528erf() const 529{ 530 return ErfReturnType(derived()); 531} 532 533/** \cpp11 \returns an expression of the coefficient-wise Complementary error 534 * function of *this. 535 * 536 * \specialfunctions_module 537 * 538 * Example: \include Cwise_erfc.cpp 539 * Output: \verbinclude Cwise_erfc.out 540 * 541 * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, 542 * or float/double in non c++11 mode, the user has to provide implementations of erfc(T) for any scalar 543 * type T to be supported. 544 * 545 * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_erfc">Math functions</a>, erf() 546 */ 547EIGEN_DEVICE_FUNC 548inline const ErfcReturnType 549erfc() const 550{ 551 return ErfcReturnType(derived()); 552} 553