diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-07-20 13:57:55 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-07-20 13:57:55 +0200 |
commit | 6544b49e59f6f43c9183bf0d15d74267f5070137 (patch) | |
tree | 140eff6e3e17fc7681dfefda759ec0a2f3591836 /Eigen/src/plugins/ArrayCwiseBinaryOps.h | |
parent | 2d93060291f3373a3325413159062a3b4d1e95e8 (diff) |
Generalize pow(x,e) such that x and e can be a different expression type or a scalar for either x or e. Add x.pow(e) with e an array expression.
Diffstat (limited to 'Eigen/src/plugins/ArrayCwiseBinaryOps.h')
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseBinaryOps.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/Eigen/src/plugins/ArrayCwiseBinaryOps.h index 58844800a..9422c40bc 100644 --- a/Eigen/src/plugins/ArrayCwiseBinaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseBinaryOps.h @@ -74,6 +74,24 @@ max return (max)(Derived::PlainObject::Constant(rows(), cols(), other)); } +/** \returns an expression of the coefficient-wise power of \c *this to the given array of \a exponents. + * + * This function computes the coefficient-wise power. + * + * Example: \include Cwise_array_power_array.cpp + * Output: \verbinclude Cwise_array_power_array.out + */ +template<typename ExponentDerived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const CwiseBinaryOp<internal::scalar_binary_pow_op<Scalar, typename ExponentDerived::Scalar>, const Derived, const ExponentDerived> +pow(const ArrayBase<ExponentDerived>& exponents) const +{ + return CwiseBinaryOp<internal::scalar_binary_pow_op<Scalar, typename ExponentDerived::Scalar>, const Derived, const ExponentDerived>( + this->derived(), + exponents.derived() + ); +} + // TODO code generating macros could be moved to Macros.h and could include generation of documentation #define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \ template<typename OtherDerived> \ |