From fbd7ed6ff73eca76aa6e0691228d26098ad9c19e Mon Sep 17 00:00:00 2001 From: Igor Babuschkin Date: Thu, 2 Jun 2016 13:35:47 +0100 Subject: Add tensor scan op This is the initial implementation a generic scan operation. Based on this, cumsum and cumprod method have been added to TensorBase. --- unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorBase.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index 07dcfa556..1eaa8d4fc 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -453,6 +453,21 @@ class TensorBase return TensorFFTOp(derived(), fft); } + // Scan. + typedef TensorScanOp, const Derived> TensorScanSumOp; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TensorScanSumOp + cumsum(const Index& axis) const { + return TensorScanSumOp(derived(), axis); + } + + typedef TensorScanOp, const Derived> TensorScanProdOp; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TensorScanProdOp + cumprod(const Index& axis) const { + return TensorScanProdOp(derived(), axis); + } + // Reductions. template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorReductionOp, const Dims, const Derived> -- cgit v1.2.3