diff options
author | 2015-06-10 15:52:05 +0200 | |
---|---|---|
committer | 2015-06-10 15:52:05 +0200 | |
commit | 25a98be948095c1487936c45aec0b7717509dac5 (patch) | |
tree | 2d195462c9c55803c1a6b99dec884545e90577b1 /Eigen/src/plugins/ArrayCwiseUnaryOps.h | |
parent | 192bce2795bbfaa0d4e6fdcd270a95d59da82f66 (diff) | |
parent | e5048b5501a4c2cd86fa3f92ad214938eb3f9b3f (diff) |
bug #80: merge with d_hood branch on adding more coefficient-wise unary array functors
Diffstat (limited to 'Eigen/src/plugins/ArrayCwiseUnaryOps.h')
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseUnaryOps.h | 206 |
1 files changed, 190 insertions, 16 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index 3d4693fd1..c9f7c8f6e 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -1,21 +1,33 @@ typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> AbsReturnType; +typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> ArgReturnType; typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Abs2ReturnType; typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> SqrtReturnType; typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType; +typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType; typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType; typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; +typedef CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived> Log10ReturnType; typedef CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived> CosReturnType; typedef CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived> SinReturnType; +typedef CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived> TanReturnType; typedef CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> AcosReturnType; typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> AsinReturnType; -typedef CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived> TanReturnType; typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> AtanReturnType; +typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturnType; +typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType; +typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType; typedef CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived> PowReturnType; typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> SquareReturnType; typedef CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> CubeReturnType; +typedef CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived> RoundReturnType; +typedef CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived> FloorReturnType; +typedef CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived> CeilReturnType; +typedef CwiseUnaryOp<internal::scalar_isNaN_op<Scalar>, const Derived> IsNaNReturnType; +typedef CwiseUnaryOp<internal::scalar_isInf_op<Scalar>, const Derived> IsInfReturnType; +typedef CwiseUnaryOp<internal::scalar_isFinite_op<Scalar>, const Derived> IsFiniteReturnType; /** \returns an expression of the coefficient-wise absolute value of \c *this * @@ -31,6 +43,20 @@ abs() const return AbsReturnType(derived()); } +/** \returns an expression of the coefficient-wise phase angle of \c *this + * + * Example: \include Cwise_arg.cpp + * Output: \verbinclude Cwise_arg.out + * + * \sa abs() + */ +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE const ArgReturnType +arg() const +{ + return ArgReturnType(derived()); +} + /** \returns an expression of the coefficient-wise squared absolute value of \c *this * * Example: \include Cwise_abs2.cpp @@ -79,6 +105,22 @@ log() const return LogReturnType(derived()); } +/** \returns an expression of the coefficient-wise base-10 logarithm of *this. + * + * This function computes the coefficient-wise base-10 logarithm. + * + * Example: \include Cwise_log10.cpp + * Output: \verbinclude Cwise_log10.out + * + * \sa log() + */ +EIGEN_DEVICE_FUNC +inline const Log10ReturnType +log10() const +{ + return Log10ReturnType(derived()); +} + /** \returns an expression of the coefficient-wise square root of *this. * * This function computes the coefficient-wise square root. The function MatrixBase::sqrt() in the @@ -131,6 +173,33 @@ sin() const return SinReturnType(derived()); } +/** \returns an expression of the coefficient-wise tan of *this. + * + * Example: \include Cwise_tan.cpp + * Output: \verbinclude Cwise_tan.out + * + * \sa cos(), sin() + */ +EIGEN_DEVICE_FUNC +inline const TanReturnType +tan() const +{ + return TanReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise arc tan of *this. + * + * Example: \include Cwise_atan.cpp + * Output: \verbinclude Cwise_atan.out + * + * \sa tan(), asin(), acos() + */ +inline const AtanReturnType +atan() const +{ + return AtanReturnType(derived()); +} + /** \returns an expression of the coefficient-wise arc cosine of *this. * * Example: \include Cwise_acos.cpp @@ -159,31 +228,43 @@ asin() const return AsinReturnType(derived()); } -/** \returns an expression of the coefficient-wise tan of *this. +/** \returns an expression of the coefficient-wise hyperbolic tan of *this. * - * Example: \include Cwise_tan.cpp - * Output: \verbinclude Cwise_tan.out + * Example: \include Cwise_tanh.cpp + * Output: \verbinclude Cwise_tanh.out * - * \sa cos(), sin() + * \sa tan(), sinh(), cosh() */ -EIGEN_DEVICE_FUNC -inline const TanReturnType -tan() const +inline const TanhReturnType +tanh() const { - return TanReturnType(derived()); + return TanhReturnType(derived()); } -/** \returns an expression of the coefficient-wise arc tan of *this. +/** \returns an expression of the coefficient-wise hyperbolic sin of *this. * - * Example: \include Cwise_atan.cpp - * Output: \verbinclude Cwise_atan.out + * Example: \include Cwise_sinh.cpp + * Output: \verbinclude Cwise_sinh.out * - * \sa cos(), sin(), tan() + * \sa sin(), tanh(), cosh() */ -inline const AtanReturnType -atan() const +inline const SinhReturnType +sinh() const { - return AtanReturnType(derived()); + return SinhReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise hyperbolic cos of *this. + * + * Example: \include Cwise_cosh.cpp + * Output: \verbinclude Cwise_cosh.out + * + * \sa tan(), sinh(), cosh() + */ +inline const CoshReturnType +cosh() const +{ + return CoshReturnType(derived()); } /** \returns an expression of the coefficient-wise power of *this to the given exponent. @@ -246,5 +327,98 @@ cube() const return CubeReturnType(derived()); } +/** \returns an expression of the coefficient-wise round of *this. + * + * Example: \include Cwise_round.cpp + * Output: \verbinclude Cwise_round.out + * + * \sa ceil(), floor() + */ +inline const RoundReturnType +round() const +{ + return RoundReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise floor of *this. + * + * Example: \include Cwise_floor.cpp + * Output: \verbinclude Cwise_floor.out + * + * \sa ceil(), round() + */ +inline const FloorReturnType +floor() const +{ + return FloorReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise ceil of *this. + * + * Example: \include Cwise_ceil.cpp + * Output: \verbinclude Cwise_ceil.out + * + * \sa floor(), round() + */ +inline const CeilReturnType +ceil() const +{ + return CeilReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise isNaN of *this. + * + * Example: \include Cwise_isNaN.cpp + * Output: \verbinclude Cwise_isNaN.out + * + * \sa isFinite(), isInf() + */ +inline const IsNaNReturnType +isNaN() const +{ + return IsNaNReturnType(derived()); +} + +/** \returns an expression of the coefficient-wise isInf of *this. + * + * Example: \include Cwise_isInf.cpp + * Output: \verbinclude Cwise_isInf.out + * + * \sa isNaN(), isFinite() + */ +inline const IsInfReturnType +isInf() const +{ + return IsInfReturnType(derived()); +} +/** \returns an expression of the coefficient-wise isFinite of *this. + * + * Example: \include Cwise_isFinite.cpp + * Output: \verbinclude Cwise_isFinite.out + * + * \sa isNaN(), isInf() + */ +inline const IsFiniteReturnType +isFinite() const +{ + return IsFiniteReturnType(derived()); +} +/** \returns an expression of the coefficient-wise ! operator of *this + * + * \warning this operator is for expression of bool only. + * + * Example: \include Cwise_boolean_not.cpp + * Output: \verbinclude Cwise_boolean_not.out + * + * \sa operator!=() + */ +EIGEN_DEVICE_FUNC +inline const BooleanNotReturnType +operator!() const +{ + EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value), + THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); + return BooleanNotReturnType(derived()); +} |