Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61206 - in branches/release: boost/numeric/ublas libs/numeric/ublas libs/numeric/ublas/doc libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2010-04-11 16:11:14


Author: guwi17
Date: 2010-04-11 16:11:14 EDT (Sun, 11 Apr 2010)
New Revision: 61206
URL: http://svn.boost.org/trac/boost/changeset/61206

Log:
fix #3539: merged [61135], [61136], [61137] into release

boost/numeric/ublas/traits.hpp: fixed complex_traits

libs/numeric/ublas/test/Jamfile.v2: added testcase

libs/numeric/ublas/test/test_complex_norms.cpp: new testcase

libs/numeric/ublas/doc/release_notes.htm: updated release notes

Added:
   branches/release/libs/numeric/ublas/test/test_complex_norms.cpp
      - copied unchanged from r61135, /trunk/libs/numeric/ublas/test/test_complex_norms.cpp
Properties modified:
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
Text files modified:
   branches/release/boost/numeric/ublas/traits.hpp | 12 ++++++++----
   branches/release/libs/numeric/ublas/doc/release_notes.htm | 9 +++++++++
   branches/release/libs/numeric/ublas/test/Jamfile.v2 | 2 ++
   3 files changed, 19 insertions(+), 4 deletions(-)

Modified: branches/release/boost/numeric/ublas/traits.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/traits.hpp (original)
+++ branches/release/boost/numeric/ublas/traits.hpp 2010-04-11 16:11:14 EDT (Sun, 11 Apr 2010)
@@ -220,8 +220,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
@@ -231,8 +233,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

Modified: branches/release/libs/numeric/ublas/doc/release_notes.htm
==============================================================================
--- branches/release/libs/numeric/ublas/doc/release_notes.htm (original)
+++ branches/release/libs/numeric/ublas/doc/release_notes.htm 2010-04-11 16:11:14 EDT (Sun, 11 Apr 2010)
@@ -25,6 +25,15 @@
 <ul>
 <li>[3968] fixed coordinate_matrix sort problem on MSVC10
 </li>
+<li>[3539]
+ changed computation of <code>norm_inf</code> for complex types to match
+ mathematical definition. <br />
+ <b>Note:</b> This might cause a performance drop
+ because now <code>std::abs(z)</code> is called for each vector element.
+ The old implementation used <code>std::max(std::abs(real(z)),std::abs(imag(z))</code>.
+ Further <code>norm_inf</code> and <code>norm_1</code> will now return
+ the same values for complex vector.
+</li>
 <li>[3501] Moved free functions in <code>concepts.hpp</code> into anonymous namespace.
 </li>
 </ul>

Modified: branches/release/libs/numeric/ublas/test/Jamfile.v2
==============================================================================
--- branches/release/libs/numeric/ublas/test/Jamfile.v2 (original)
+++ branches/release/libs/numeric/ublas/test/Jamfile.v2 2010-04-11 16:11:14 EDT (Sun, 11 Apr 2010)
@@ -128,4 +128,6 @@
       ]
       [ run test_coordinate_matrix_sort.cpp
       ]
+ [ run test_complex_norms.cpp
+ ]
     ;


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