diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-07-21 15:46:45 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-07-21 15:46:45 +0200 |
commit | 87fbda812ff458b1c9a2458b84ac89bf08e65fea (patch) | |
tree | c596507dc5f3916367191964a83a0c084d36f791 /Eigen/src/Core/arch/CUDA | |
parent | 01d12d3e825c47df205d73b47e62930f8201641d (diff) |
Add missing log10 and random generator for half.
Diffstat (limited to 'Eigen/src/Core/arch/CUDA')
-rw-r--r-- | Eigen/src/Core/arch/CUDA/Half.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/CUDA/Half.h b/Eigen/src/Core/arch/CUDA/Half.h index fc513fc7b..01423826c 100644 --- a/Eigen/src/Core/arch/CUDA/Half.h +++ b/Eigen/src/Core/arch/CUDA/Half.h @@ -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) { 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) { 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 } +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 // Standard mathematical functions and trancendentals. |