mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added support for expm1 in Eigen.
This commit is contained in:
@@ -262,6 +262,26 @@ struct functor_traits<scalar_exp_op<Scalar> > {
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
*
|
||||
* \brief Template functor to compute the exponential of a scalar - 1.
|
||||
*
|
||||
* \sa class CwiseUnaryOp, ArrayBase::expm1()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_expm1_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_expm1_op)
|
||||
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::expm1(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pexpm1(a); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_expm1_op<Scalar> > {
|
||||
enum {
|
||||
PacketAccess = packet_traits<Scalar>::HasExpm1,
|
||||
Cost = functor_traits<scalar_exp_op<Scalar> >::Cost // TODO measure cost of expm1
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
*
|
||||
* \brief Template functor to compute the logarithm of a scalar
|
||||
|
||||
Reference in New Issue
Block a user