|
Ublas : |
Subject: Re: [ublas] Patch: Modify definition of L-1 and L-\infty norm in complex_traits
From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2009-08-27 14:25:13
I have reported this in 2005 already. I suggested to change the names of
norm_1 and norm_inf.
The blas 1 have only one norm: 2-norm, whereas there is the function
asum which does precisely what norm_1 from ublas does. The reason why
asum is provided and not the 1-norm is performance: the 1-norm requires
a square root for each vector entry and this is expensive.
Best,
Karl
Manoj Rajagopalan wrote:
> 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:
>
> http://mathworld.wolfram.com/L1-Norm.html
> http://mathworld.wolfram.com/L-Infinity-Norm.html
>
> 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.
>
> Thanks,
> Manoj
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: karl.meerbergen_at_[hidden]
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm