From 5cf4558c0a139b4f0b6fc0c778fe596def93dd94 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 3 Mar 2016 12:36:55 -0800 Subject: [PATCH] Added support for rounding, flooring, and ceiling to the tensor api --- .../Eigen/CXX11/src/Tensor/TensorBase.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index 4dea1d3a0..5679e58cf 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -232,6 +232,25 @@ class TensorBase return TensorConversionOp(derived()); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const TensorCwiseUnaryOp, const Derived> + round() const { + return unaryExpr(internal::scalar_round_op()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const TensorCwiseUnaryOp, const Derived> + ceil() const { + return unaryExpr(internal::scalar_ceil_op()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const TensorCwiseUnaryOp, const Derived> + floor() const { + return unaryExpr(internal::scalar_floor_op()); + } + + // Generic binary operation support. template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorCwiseBinaryOp