diff options
author | 2009-11-26 02:28:13 +0100 | |
---|---|---|
committer | 2009-11-26 02:28:13 +0100 | |
commit | f795681da0fec9cd8a56f6987c903ec9a530d509 (patch) | |
tree | 7efa234cf98ea6f1a37756c488a5816c7e2e439a /Eigen | |
parent | dca80b5f229cfb455a6beebbdaf2f6743beb71ed (diff) |
export stableNorm(), blueNorm() and hypotNorm() to colwise() and rowwise()
+ rudimentary test
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Array/VectorwiseOp.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Eigen/src/Array/VectorwiseOp.h b/Eigen/src/Array/VectorwiseOp.h index 880567212..7193e6f68 100644 --- a/Eigen/src/Array/VectorwiseOp.h +++ b/Eigen/src/Array/VectorwiseOp.h @@ -121,6 +121,9 @@ class PartialReduxExpr : ei_no_assignment_operator, EIGEN_MEMBER_FUNCTOR(squaredNorm, Size * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost); EIGEN_MEMBER_FUNCTOR(norm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost); +EIGEN_MEMBER_FUNCTOR(stableNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost); +EIGEN_MEMBER_FUNCTOR(blueNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost); +EIGEN_MEMBER_FUNCTOR(hypotNorm, (Size-1) * ei_functor_traits<ei_scalar_hypot_op<Scalar> >::Cost ); EIGEN_MEMBER_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost); EIGEN_MEMBER_FUNCTOR(mean, (Size-1)*NumTraits<Scalar>::AddCost + NumTraits<Scalar>::MulCost); EIGEN_MEMBER_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost); @@ -288,6 +291,33 @@ template<typename ExpressionType, int Direction> class VectorwiseOp const typename ReturnType<ei_member_norm>::Type norm() const { return _expression(); } + + /** \returns a row (or column) vector expression of the norm + * of each column (or row) of the referenced expression, using + * blue's algorithm. + * + * \sa MatrixBase::blueNorm() */ + const typename ReturnType<ei_member_blueNorm>::Type blueNorm() const + { return _expression(); } + + + /** \returns a row (or column) vector expression of the norm + * of each column (or row) of the referenced expression, avoiding + * underflow and overflow. + * + * \sa MatrixBase::stableNorm() */ + const typename ReturnType<ei_member_stableNorm>::Type stableNorm() const + { return _expression(); } + + + /** \returns a row (or column) vector expression of the norm + * of each column (or row) of the referenced expression, avoiding + * underflow and overflow using a concatenation of hypot() calls. + * + * \sa MatrixBase::hypotNorm() */ + const typename ReturnType<ei_member_hypotNorm>::Type hypotNorm() const + { return _expression(); } + /** \returns a row (or column) vector expression of the sum * of each column (or row) of the referenced expression. * |