diff options
author | 2016-06-01 17:08:47 +0200 | |
---|---|---|
committer | 2016-06-01 17:08:47 +0200 | |
commit | 3c69afca4cf88523b699cb51f7e746264eda1ab6 (patch) | |
tree | e7e8bd4a8cc1326f64876aab8544a5c3fab6a1d4 /Eigen/src/plugins/ArrayCwiseUnaryOps.h | |
parent | 89099b0cf7028eedf125bcef6a1daa30e4a7f6ec (diff) |
Add missing ArrayBase::log1p
Diffstat (limited to 'Eigen/src/plugins/ArrayCwiseUnaryOps.h')
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseUnaryOps.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index 502e3aa1c..775fa6ee0 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -11,6 +11,7 @@ typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> Boo typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType; typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; +typedef CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived> Log1pReturnType; 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; @@ -111,6 +112,20 @@ log() const return LogReturnType(derived()); } +/** \returns an expression of the coefficient-wise logarithm of 1 plus \c *this. + * + * In exact arithmetic, \c x.log() is equivalent to \c (x+1).log(), + * however, with finite precision, this function is much more accurate when \c x is close to zero. + * + * \sa log() + */ +EIGEN_DEVICE_FUNC +inline const Log1pReturnType +log1p() const +{ + return Log1pReturnType(derived()); +} + /** \returns an expression of the coefficient-wise base-10 logarithm of *this. * * This function computes the coefficient-wise base-10 logarithm. |