From 2bda1b0d93fb627d0c500ec48b20302d44c32cb7 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 28 Sep 2016 17:08:41 -0700 Subject: Updated the tensor sum and mean reducer to enable them to process complex numbers on cuda gpus. --- unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h index 760074622..eddb86597 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h @@ -99,7 +99,8 @@ template struct SumReducer static const bool IsStateful = false; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const { - (*accum) += t; + internal::scalar_sum_op sum_op; + *accum = sum_op(*accum, t); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const { @@ -145,7 +146,8 @@ template struct MeanReducer MeanReducer() : scalarCount_(0), packetCount_(0) { } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) { - (*accum) += t; + internal::scalar_sum_op sum_op; + *accum = sum_op(*accum, t); scalarCount_++; } template -- cgit v1.2.3