Boost logo

Ublas :

Subject: Re: [ublas] std::complex norm_inf wrong
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2010-04-07 15:37:42


Hello,

Am Wednesday 07 April 2010 schrieben Sie:
> Hi,
> the culprit is in traits.hpp lines 306ff:
> 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)); }
> [...]
> 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))); }
> I am unsure whether these definitions make sense. This treats complex
> numbers as two-dimensional vectors and not as scalars. Changing it to

You are right. This makes no sense. I added a testcase to trunk and
patched the traits.hpp. Now the complex types are handled like scalars.
Hopefully this does not break anyones code because the values return by
norm_inf and norm_1 of complex vectors will change.

https://svn.boost.org/trac/boost/ticket/3539

mfg
Gunter