add fixed power unary operation

This commit is contained in:
Charles Schlosser
2022-08-16 21:32:36 +00:00
committed by Rasmus Munk Larsen
parent 39fcc89798
commit 76a669fb45
9 changed files with 391 additions and 39 deletions

View File

@@ -331,10 +331,12 @@ class TensorBase<Derived, ReadOnlyAccessors>
return choose(Cond<NumTraits<CoeffReturnType>::IsComplex>(), unaryExpr(internal::scalar_conjugate_op<Scalar>()), derived());
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_pow_op<Scalar,Scalar> >, const Derived>
pow(Scalar exponent) const {
return unaryExpr(internal::bind2nd_op<internal::scalar_pow_op<Scalar,Scalar> >(exponent));
template<typename ScalarExponent>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const std::enable_if_t<internal::is_arithmetic<ScalarExponent>::value,
TensorCwiseUnaryOp<internal::scalar_unary_pow_op<Scalar, ScalarExponent>, const Derived>>
pow(ScalarExponent exponent) const
{
return unaryExpr(internal::scalar_unary_pow_op<Scalar, ScalarExponent>(exponent));
}
EIGEN_DEVICE_FUNC