aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-05-31 22:46:18 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-05-31 22:46:18 +0200
commite2097c55f8b130cac62d52af2cd7d8717ec0d5c1 (patch)
tree887ddde7f49857c89b3fbec1320d91bf7e4318ea
parent8dc947821b3b64f754cdce1b7d8141885ed5ecd0 (diff)
fix issue #125 - *norm() return RealScalar and not Scalar
-rw-r--r--Eigen/src/Array/VectorwiseOp.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/Eigen/src/Array/VectorwiseOp.h b/Eigen/src/Array/VectorwiseOp.h
index b809283a7..f495aae40 100644
--- a/Eigen/src/Array/VectorwiseOp.h
+++ b/Eigen/src/Array/VectorwiseOp.h
@@ -178,14 +178,16 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
public:
typedef typename ExpressionType::Scalar Scalar;
+ typedef typename ExpressionType::RealScalar RealScalar;
typedef typename ExpressionType::Index Index;
typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
- template<template<typename _Scalar> class Functor> struct ReturnType
+ template<template<typename _Scalar> class Functor,
+ typename Scalar=typename ei_traits<ExpressionType>::Scalar> struct ReturnType
{
typedef PartialReduxExpr<ExpressionType,
- Functor<typename ei_traits<ExpressionType>::Scalar>,
+ Functor<Scalar>,
Direction
> Type;
};
@@ -285,7 +287,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_squaredNorm.out
*
* \sa DenseBase::squaredNorm() */
- const typename ReturnType<ei_member_squaredNorm>::Type squaredNorm() const
+ const typename ReturnType<ei_member_squaredNorm,RealScalar>::Type squaredNorm() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the norm
@@ -295,7 +297,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* Output: \verbinclude PartialRedux_norm.out
*
* \sa DenseBase::norm() */
- const typename ReturnType<ei_member_norm>::Type norm() const
+ const typename ReturnType<ei_member_norm,RealScalar>::Type norm() const
{ return _expression(); }
@@ -304,7 +306,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* blue's algorithm.
*
* \sa DenseBase::blueNorm() */
- const typename ReturnType<ei_member_blueNorm>::Type blueNorm() const
+ const typename ReturnType<ei_member_blueNorm,RealScalar>::Type blueNorm() const
{ return _expression(); }
@@ -313,7 +315,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* underflow and overflow.
*
* \sa DenseBase::stableNorm() */
- const typename ReturnType<ei_member_stableNorm>::Type stableNorm() const
+ const typename ReturnType<ei_member_stableNorm,RealScalar>::Type stableNorm() const
{ return _expression(); }
@@ -322,7 +324,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* underflow and overflow using a concatenation of hypot() calls.
*
* \sa DenseBase::hypotNorm() */
- const typename ReturnType<ei_member_hypotNorm>::Type hypotNorm() const
+ const typename ReturnType<ei_member_hypotNorm,RealScalar>::Type hypotNorm() const
{ return _expression(); }
/** \returns a row (or column) vector expression of the sum