aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-23 09:46:42 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-23 09:46:42 -0700
commit0e6888260459b31dac1bd3411b0e8f688f6d22a2 (patch)
treeed3a44810d12a5727e00a3aab7a4df4a4778bd9a /Eigen/src
parent6971146ca9e4b5870404974397a81d125b2418d4 (diff)
Added the ability to divide a half float by an index
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/arch/CUDA/Half.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/CUDA/Half.h b/Eigen/src/Core/arch/CUDA/Half.h
index f997735aa..08f6005e4 100644
--- a/Eigen/src/Core/arch/CUDA/Half.h
+++ b/Eigen/src/Core/arch/CUDA/Half.h
@@ -234,6 +234,12 @@ static inline EIGEN_DEVICE_FUNC bool operator > (const half& a, const half& b) {
#endif // Emulate support for half floats
+// Division by an index. Do it in full float precision to avoid accuracy
+// issues in converting the denominator to half.
+static inline EIGEN_DEVICE_FUNC half operator / (const half& a, Index b) {
+ return Eigen::half(static_cast<float>(a) / static_cast<float>(b));
+}
+
// Conversion routines, including fallbacks for the host or older CUDA.
// Note that newer Intel CPUs (Haswell or newer) have vectorized versions of
// these in hardware. If we need more performance on older/other CPUs, they are