From 842881cfb1b8ece6e41c58f0466ae979e514d001 Mon Sep 17 00:00:00 2001 From: Andy Somerville Date: Wed, 15 Jun 2011 00:30:11 -0400 Subject: [PATCH] bug #298 - let normalize() return a reference to *this --- Eigen/src/Core/Dot.h | 3 ++- Eigen/src/Core/MatrixBase.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index 6e83191c5..f4aa76690 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -159,9 +159,10 @@ MatrixBase::normalized() const * \sa norm(), normalized() */ template -inline void MatrixBase::normalize() +inline Derived& MatrixBase::normalize() { *this /= norm(); + return derived(); } //---------- implementation of other norms ---------- diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index e2d34d257..b75231057 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -218,7 +218,7 @@ template class MatrixBase RealScalar blueNorm() const; RealScalar hypotNorm() const; const PlainObject normalized() const; - void normalize(); + Derived& normalize(); const AdjointReturnType adjoint() const; void adjointInPlace();