Boost logo

Ublas :

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2005-10-01 09:01:06


On Saturday 01 October 2005 12:08, Ian McCulloch wrote:
> 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.

BLAS do have a function DZNRM2, which is the two norm. It do not think they
have a 1-norm, but a function DZASUM, which corresponds to uBLAS norm_1.
So, in my opinion, BLAS is not breaking anything, they just do not call it a
norm.

>
> > 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.

In GLAS, we have both the norm_1() and abs_sum() functions and similarly,
norm_inf() and abs_max(). If you do not care about the third property of a
norm, the more efficient functions are ok.

Cheers,

Karl

>
> Cheers,
> ian
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas

-- 
==============================================
Look at our unique training program and
Register on-line at http://www.fft.be/?id=35
----------------------------------------------
Karl Meerbergen
Free Field Technologies
16 place de l'Université
B-1348 Louvain-la-Neuve - BELGIUM
Company Phone:  +32 10 45 12 26
Company Fax:    +32 10 45 46 26
Mobile Phone:   +32 474 26 66 59
Home Phone:     +32 2 306 38 10
mailto:Karl.Meerbergen_at_[hidden]
http://www.fft.be
==============================================