2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-22 03:42:19 +00:00
changed implementation of norm_inf and norm_1 for complex types to use abs(z) instead of max(abs(real(z)),abs(imag(z))).

svn path=/trunk/boost/numeric/ublas/; revision=61136
This commit is contained in:
Gunter Winkler
2010-04-07 19:32:59 +00:00
parent e6ae79be8b
commit eade17a036

View File

@@ -306,8 +306,10 @@ namespace boost { namespace numeric { namespace ublas {
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 @@ namespace boost { namespace numeric { namespace ublas {
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