mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +08:00
Add missing log10 and random generator for half.
This commit is contained in:
parent
01d12d3e82
commit
87fbda812f
@ -410,6 +410,9 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half exp(const Eigen::half& a) {
|
|||||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half log(const Eigen::half& a) {
|
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half log(const Eigen::half& a) {
|
||||||
return Eigen::half(::logf(float(a)));
|
return Eigen::half(::logf(float(a)));
|
||||||
}
|
}
|
||||||
|
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half log10(const Eigen::half& a) {
|
||||||
|
return Eigen::half(::log10f(float(a)));
|
||||||
|
}
|
||||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrt(const Eigen::half& a) {
|
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half sqrt(const Eigen::half& a) {
|
||||||
return Eigen::half(::sqrtf(float(a)));
|
return Eigen::half(::sqrtf(float(a)));
|
||||||
}
|
}
|
||||||
@ -454,6 +457,24 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half (max)(const Eigen::half& a, co
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct random_default_impl<half, false, false>
|
||||||
|
{
|
||||||
|
static inline half run(const half& x, const half& y)
|
||||||
|
{
|
||||||
|
return x + (y-x) * half(float(std::rand()) / float(RAND_MAX));
|
||||||
|
}
|
||||||
|
static inline half run()
|
||||||
|
{
|
||||||
|
return run(half(-1.f), half(1.f));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // end namespace internal
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
// Standard mathematical functions and trancendentals.
|
// Standard mathematical functions and trancendentals.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user