Added support for rounding, flooring, and ceiling to the tensor api

This commit is contained in:
Benoit Steiner 2016-03-03 12:36:55 -08:00
parent dac58d7c35
commit 5cf4558c0a

View File

@ -232,6 +232,25 @@ class TensorBase<Derived, ReadOnlyAccessors>
return TensorConversionOp<NewType, const Derived>(derived()); return TensorConversionOp<NewType, const Derived>(derived());
} }
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived>
round() const {
return unaryExpr(internal::scalar_round_op<Scalar>());
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived>
ceil() const {
return unaryExpr(internal::scalar_ceil_op<Scalar>());
}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived>
floor() const {
return unaryExpr(internal::scalar_floor_op<Scalar>());
}
// Generic binary operation support. // Generic binary operation support.
template <typename CustomBinaryOp, typename OtherDerived> EIGEN_DEVICE_FUNC template <typename CustomBinaryOp, typename OtherDerived> EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> EIGEN_STRONG_INLINE const TensorCwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>