diff options
author | Igor Babuschkin <igor@babuschk.in> | 2016-06-02 13:35:47 +0100 |
---|---|---|
committer | Igor Babuschkin <igor@babuschk.in> | 2016-06-02 13:35:47 +0100 |
commit | fbd7ed6ff73eca76aa6e0691228d26098ad9c19e (patch) | |
tree | 4f860fb483ceb58cf6cbc7f4d834f923ca50d358 /unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | |
parent | 0ed08fd28180e41838fbe40f8e96c888220895ed (diff) |
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.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorBase.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | 15 |
1 files changed, 15 insertions, 0 deletions
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<Derived, ReadOnlyAccessors> return TensorFFTOp<const FFT, const Derived, FFTDataType, FFTDirection>(derived(), fft); } + // Scan. + typedef TensorScanOp<internal::SumReducer<CoeffReturnType>, const Derived> TensorScanSumOp; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TensorScanSumOp + cumsum(const Index& axis) const { + return TensorScanSumOp(derived(), axis); + } + + typedef TensorScanOp<internal::ProdReducer<CoeffReturnType>, const Derived> TensorScanProdOp; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TensorScanProdOp + cumprod(const Index& axis) const { + return TensorScanProdOp(derived(), axis); + } + // Reductions. template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorReductionOp<internal::SumReducer<CoeffReturnType>, const Dims, const Derived> |