Boost logo

Ublas :

Subject: [ublas] Patch: Modify definition of L-1 and L-\infty norm in complex_traits
From: Manoj Rajagopalan (rmanoj_at_[hidden])
Date: 2009-08-27 13:24:16

Hi everyone,

   The definitions of the functors vector_norm_1 and vector_norm_inf in
functional.hpp employ the following definitions for the corresponding norms
of the individual components defined in type_traits<> defined in traits.hpp:

For real or complex c:

norm_1(c) = |Re(c)| + |Im(c)|
norm_inf(c) = max(|Re(c)|, |Im(c)|)

whereas these type_traits should be defined as

norm_1(c) = |c|
norm_inf(c) = |c|

so that for a vector of real/complex numbers, the mathematical definition of
the vector-norm is correctly implemented:

To do this, only two simple changes need to be made in the complex_traits<>
class in traits.hpp and I am submitting the context-sensitive diff (diff -c)
between the original ublas file and this correction (attach).

The existing implementation results from considering a complex number to be a
2-vector of reals but I am not sure this is correct, conceptually.

I request one of the developers to apply this if there is a consensus.