Boost logo

Ublas :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2005-10-01 05:08:11


On Fri, 30 Sep 2005, Karl Meerbergen wrote:

> Hi all,
>
>
> I have a question about norms for complex values.
>
> I have the impression that norm_1 and norm_inf are not correctly
> computed for complex vectors.
> It looks like norm_1 makes the sum of the absolute values of the real
> and imaginary parts, and norm_inf is the maximum of the absolute values
> of the real and the imaginary parts.

BLAS implements norm_1 for complex in this fashion, out of
efficency considerations. (ie. avoid a sqrt() in the inner loop). it was
probably a mistake, and I think there are some comments by jack Dongarra
to that effect.

>
> Most textbooks only talk about real valued vectors. I would expect that
> norm_1 is the sum of the moduli of the vector's elements. Norm_inf is
> the maximum modulus. One of the definitions of norm is that for any
> scalar a and vector v, we have
>
> norm_1(a*v) = |a| * norm_1(v)
>
> What is |a| for a complex value? If it is std::abs(), norm_1 and
> norm_inf are definitely not correct.
> If |a| = std::abs(a.real())+std::abs(a.imag)), this is not correct
> either, I think. Correct me if I am wrong.

You are not wrong. uBLAS just follows the broken way BLAS does it. My
vote is to fix it and document that it differs from BLAS.

Cheers,
ian