mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Expose log1p to Array.
This commit is contained in:
@@ -266,7 +266,7 @@ struct functor_traits<scalar_exp_op<Scalar> > {
|
||||
*
|
||||
* \brief Template functor to compute the logarithm of a scalar
|
||||
*
|
||||
* \sa class CwiseUnaryOp, Cwise::log()
|
||||
* \sa class CwiseUnaryOp, ArrayBase::log()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_log_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op)
|
||||
@@ -293,6 +293,26 @@ struct functor_traits<scalar_log_op<Scalar> > {
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
*
|
||||
* \brief Template functor to compute the logarithm of 1 plus a scalar value
|
||||
*
|
||||
* \sa class CwiseUnaryOp, ArrayBase::log1p()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_log1p_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_log1p_op)
|
||||
EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::log1p(a); }
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog1p(a); }
|
||||
};
|
||||
template <typename Scalar>
|
||||
struct functor_traits<scalar_log1p_op<Scalar> > {
|
||||
enum {
|
||||
PacketAccess = packet_traits<Scalar>::HasLog1p,
|
||||
Cost = functor_traits<scalar_log_op<Scalar> >::Cost // TODO measure cost of log1p
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
*
|
||||
* \brief Template functor to compute the base-10 logarithm of a scalar
|
||||
|
||||
Reference in New Issue
Block a user