Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2001-11-01 15:28:44


>>>>> "lums" == lums <lums_at_[hidden]> writes:

    lums> --- In boost_at_y..., nbecker_at_f... wrote:
>> In the current gcc, norm of complex is defined in terms of abs. I
>> believe the definition should be changed to:
>>
>> norm(z) = sqr(real(z)) + sqr (imag (z))
>>
>> My reasons are:
>>
>> 1. More efficient
>> 2. Works for complex<int> (important in DSP)
>> 3. Possibly more accurate
>>
>> I have started a discussion on gcc_at_g... on this subject. I'm
>> wondering if any of you have an opinion.

    lums> This definition doesn't look correct (and has accuracy problems).

    lums> Mathematically, the norm of a complex number should be

    lums> norm(z) = sqrt( sqr(real(z)) + sqr(imag(z)) )

Mathematically, you're correct. Unfortunately, since day 1 the C++
library has used abs() to mean sqrt(sum of squares), and has used
norm() to mean (sum of squares).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk