[SciPy-dev] Bug in blas test

Ilan Schnell ilanschnell@gmail....
Tue Sep 16 16:23:06 CDT 2008


Thank you very much Uwe, I forgot completely.
And the reason for having the comlpex dot product is
that things need to be normalized, so that for example the
vector with the element [1j] dot [1j] results to 1 (and not -1).
- Ilan

On Tue, Sep 16, 2008 at 2:36 PM, Uwe Schmitt <uschmitt@mineway.de> wrote:
>
> Am 16.09.2008 um 20:51 schrieb Ilan Schnell:
>
>> Hello,
>> I just found a bug in tests for blas.
>> Line 74 and 75 of scipy/lib/blas/tests/test_blas.py (current trunk):
>>    f = getattr(fblas,p+'dotc')
>>    assert_almost_equal(f([3j,-4,3-4j],[2,3j,1]),3-14j)
>>
>> The result of the dot product of these two vectors is 3-10j,
>> as can be easily veryfied:
>>>>> def f(a, b):
>> ...     return sum(x*y for x, y in zip(a, b))
>
> You implemented  the *real* dot product, not the complex one !
> I made this mistake sometime ago too.
>
> According to http://orion.math.iastate.edu/docs/cmlib/blas/cdotc
> the test is ok.
>
> The right implementation would be
>
>    def f(a,b):
>        return sum(complex(x).conjugate()*y for x,y in zip(a,b))
>
> Greetings, Uwe
>
>>
>> ...
>>>>> f([3j,-4,3-4j],[2,3j,1])
>> (3-10j)
>>
>> Is it OK if I fix this in the current trunk?
>>
>> - Ilan
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>


More information about the Scipy-dev mailing list