Fixes #2735: Component-wise cbrt

This commit is contained in:
Kyle Macfarlan
2023-10-25 03:06:13 +00:00
committed by Charles Schlosser
parent 48b254a4bc
commit 5de0f2f89e
14 changed files with 87 additions and 2 deletions

View File

@@ -471,6 +471,20 @@ struct functor_traits<scalar_sqrt_op<bool> > {
enum { Cost = 1, PacketAccess = packet_traits<bool>::Vectorizable };
};
/** \internal
* \brief Template functor to compute the cube root of a scalar
* \sa class CwiseUnaryOp, Cwise::sqrt()
*/
template <typename Scalar>
struct scalar_cbrt_op {
EIGEN_DEVICE_FUNC inline const Scalar operator()(const Scalar& a) const { return numext::cbrt(a); }
};
template <typename Scalar>
struct functor_traits<scalar_cbrt_op<Scalar> > {
enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false };
};
/** \internal
* \brief Template functor to compute the reciprocal square root of a scalar
* \sa class CwiseUnaryOp, Cwise::rsqrt()