Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61136 - trunk/boost/numeric/ublas
From: guwi17_at_[hidden]
Date: 2010-04-07 15:33:00


Author: guwi17
Date: 2010-04-07 15:32:59 EDT (Wed, 07 Apr 2010)
New Revision: 61136
URL: http://svn.boost.org/trac/boost/changeset/61136

Log:
see #3539:

changed implementation of norm_inf and norm_1 for complex types to use abs(z) instead of max(abs(real(z)),abs(imag(z))).

Text files modified:
   trunk/boost/numeric/ublas/traits.hpp | 12 ++++++++----
   1 files changed, 8 insertions(+), 4 deletions(-)

Modified: trunk/boost/numeric/ublas/traits.hpp
==============================================================================
--- trunk/boost/numeric/ublas/traits.hpp (original)
+++ trunk/boost/numeric/ublas/traits.hpp 2010-04-07 15:32:59 EDT (Wed, 07 Apr 2010)
@@ -306,8 +306,10 @@
         static
         BOOST_UBLAS_INLINE
         real_type norm_1 (const_reference t) {
- return type_traits<real_type>::type_abs (self_type::real (t)) +
- type_traits<real_type>::type_abs (self_type::imag (t));
+ return self_type::type_abs (t);
+ // original computation has been replaced because a complex number should behave like a scalar type
+ // return type_traits<real_type>::type_abs (self_type::real (t)) +
+ // type_traits<real_type>::type_abs (self_type::imag (t));
         }
         static
         BOOST_UBLAS_INLINE
@@ -317,8 +319,10 @@
         static
         BOOST_UBLAS_INLINE
         real_type norm_inf (const_reference t) {
- return (std::max) (type_traits<real_type>::type_abs (self_type::real (t)),
- type_traits<real_type>::type_abs (self_type::imag (t)));
+ return self_type::type_abs (t);
+ // original computation has been replaced because a complex number should behave like a scalar type
+ // return (std::max) (type_traits<real_type>::type_abs (self_type::real (t)),
+ // type_traits<real_type>::type_abs (self_type::imag (t)));
         }
 
         static


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk