diff options
author | 2015-12-03 18:16:35 -0800 | |
---|---|---|
committer | 2015-12-03 18:16:35 -0800 | |
commit | e25e3a041bc41266df31f48a441d95b38fc5a6fc (patch) | |
tree | 98f47b0944ef3b97beffb61531c79c5f18dfde58 /Eigen | |
parent | 029052d276edab49f6e8c274972d51f4188b5a09 (diff) |
Added rsqrt() method to the Array class: this method computes the coefficient-wise inverse square root much more efficiently than calling sqrt().inverse().
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseUnaryOps.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index a9310f12d..45e826b0c 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -4,6 +4,7 @@ typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> AbsReturnTy 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_rsqrt_op<Scalar>, const Derived> RsqrtReturnType; typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> SignReturnType; typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType; typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType; @@ -139,6 +140,22 @@ sqrt() const return SqrtReturnType(derived()); } +/** \returns an expression of the coefficient-wise inverse square root of *this. + * + * This function computes the coefficient-wise inverse square root. + * + * Example: \include Cwise_sqrt.cpp + * Output: \verbinclude Cwise_sqrt.out + * + * \sa pow(), square() + */ +EIGEN_DEVICE_FUNC +inline const RsqrtReturnType +rsqrt() const +{ + return RsqrtReturnType(derived()); +} + /** \returns an expression of the coefficient-wise signum of *this. * * This function computes the coefficient-wise signum. |