[SciPy-dev] Bug in blas test

Uwe Schmitt uschmitt@mineway...
Tue Sep 16 14:36:16 CDT 2008


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



More information about the Scipy-dev mailing list