From 421feea3b2ca7d1b4c8af567c282519f293ce38f Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Tue, 23 Sep 2014 18:55:42 +0200 Subject: [PATCH] member_redux constructor is explicit too. Renamed some typedefs for more consistency. --- Eigen/src/Core/VectorwiseOp.h | 16 ++++++++-------- Eigen/src/plugins/ArrayCwiseUnaryOps.h | 8 +++----- Eigen/src/plugins/MatrixCwiseUnaryOps.h | 18 +++++++++--------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index e340c1433..2815a16c9 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -128,7 +128,7 @@ struct member_redux { >::type result_type; template struct Cost { enum { value = (Size-1) * functor_traits::Cost }; }; - member_redux(const BinaryOp func) : m_functor(func) {} // FIXME this should actually be explicit, but lets not exaggerate + explicit member_redux(const BinaryOp func) : m_functor(func) {} template inline result_type operator()(const DenseBase& mat) const { return mat.redux(m_functor); } @@ -165,10 +165,10 @@ template class VectorwiseOp typedef typename internal::remove_all::type ExpressionTypeNestedCleaned; template class Functor, - typename Scalar=typename internal::traits::Scalar> struct ReturnType + typename Scalar_=Scalar> struct ReturnType { typedef PartialReduxExpr, + Functor, Direction > Type; }; @@ -176,7 +176,7 @@ template class VectorwiseOp template struct ReduxReturnType { typedef PartialReduxExpr::Scalar>, + internal::member_redux, Direction > Type; }; @@ -264,11 +264,11 @@ template class VectorwiseOp template const typename ReduxReturnType::Type redux(const BinaryOp& func = BinaryOp()) const - { return typename ReduxReturnType::Type(_expression(), func); } + { return typename ReduxReturnType::Type(_expression(), internal::member_redux(func)); } typedef typename ReturnType::Type MinCoeffReturnType; typedef typename ReturnType::Type MaxCoeffReturnType; - typedef typename ReturnType::Type SquareNormReturnType; + typedef typename ReturnType::Type SquaredNormReturnType; typedef typename ReturnType::Type NormReturnType; typedef typename ReturnType::Type BlueNormReturnType; typedef typename ReturnType::Type StableNormReturnType; @@ -313,8 +313,8 @@ template class VectorwiseOp * Output: \verbinclude PartialRedux_squaredNorm.out * * \sa DenseBase::squaredNorm() */ - const SquareNormReturnType squaredNorm() const - { return SquareNormReturnType(_expression()); } + const SquaredNormReturnType squaredNorm() const + { return SquaredNormReturnType(_expression()); } /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression. diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index bb1f96bdc..f6f526d2b 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -1,11 +1,9 @@ -// These are already defined in MatrixCwiseUnaryOps.h -//typedef CwiseUnaryOp, const Derived> AbsReturnType; -//typedef CwiseUnaryOp, const Derived> Abs2ReturnType; -//typedef CwiseUnaryOp, const Derived> SqrtReturnType; +typedef CwiseUnaryOp, const Derived> AbsReturnType; +typedef CwiseUnaryOp, const Derived> Abs2ReturnType; +typedef CwiseUnaryOp, const Derived> SqrtReturnType; typedef CwiseUnaryOp, const Derived> InverseReturnType; -//typedef CwiseUnaryOp >, const Derived> CwiseScalarEqualReturnType; typedef CwiseUnaryOp, const Derived> ExpReturnType; typedef CwiseUnaryOp, const Derived> LogReturnType; diff --git a/Eigen/src/plugins/MatrixCwiseUnaryOps.h b/Eigen/src/plugins/MatrixCwiseUnaryOps.h index 045a2ebb2..c99ee94ec 100644 --- a/Eigen/src/plugins/MatrixCwiseUnaryOps.h +++ b/Eigen/src/plugins/MatrixCwiseUnaryOps.h @@ -10,9 +10,9 @@ // This file is a base class plugin containing matrix specifics coefficient wise functions. -typedef CwiseUnaryOp, const Derived> AbsReturnType; -typedef CwiseUnaryOp, const Derived> Abs2ReturnType; -typedef CwiseUnaryOp, const Derived> SqrtReturnType; +typedef CwiseUnaryOp, const Derived> CwiseAbsReturnType; +typedef CwiseUnaryOp, const Derived> CwiseAbs2ReturnType; +typedef CwiseUnaryOp, const Derived> CwiseSqrtReturnType; typedef CwiseUnaryOp, const Derived> CwiseInverseReturnType; typedef CwiseUnaryOp >, const Derived> CwiseScalarEqualReturnType; /** \returns an expression of the coefficient-wise absolute value of \c *this @@ -23,8 +23,8 @@ typedef CwiseUnaryOp >, const Derived> Cwis * \sa cwiseAbs2() */ EIGEN_DEVICE_FUNC -EIGEN_STRONG_INLINE const AbsReturnType -cwiseAbs() const { return AbsReturnType(derived()); } +EIGEN_STRONG_INLINE const CwiseAbsReturnType +cwiseAbs() const { return CwiseAbsReturnType(derived()); } /** \returns an expression of the coefficient-wise squared absolute value of \c *this * @@ -34,8 +34,8 @@ cwiseAbs() const { return AbsReturnType(derived()); } * \sa cwiseAbs() */ EIGEN_DEVICE_FUNC -EIGEN_STRONG_INLINE const Abs2ReturnType -cwiseAbs2() const { return Abs2ReturnType(derived()); } +EIGEN_STRONG_INLINE const CwiseAbs2ReturnType +cwiseAbs2() const { return CwiseAbs2ReturnType(derived()); } /** \returns an expression of the coefficient-wise square root of *this. * @@ -45,8 +45,8 @@ cwiseAbs2() const { return Abs2ReturnType(derived()); } * \sa cwisePow(), cwiseSquare() */ EIGEN_DEVICE_FUNC -inline const SqrtReturnType -cwiseSqrt() const { return SqrtReturnType(derived()); } +inline const CwiseSqrtReturnType +cwiseSqrt() const { return CwiseSqrtReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse of *this. *