octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More efficient MEX or MEX-like interface


From: Fredrik Lingvall
Subject: Re: More efficient MEX or MEX-like interface
Date: Tue, 30 Sep 2008 13:38:35 +0200
User-agent: Thunderbird 2.0.0.17 (X11/20080930)

David Bateman wrote:
> Fredrik Lingvall wrote:
>> Does this mean that BLAS/LAPACK expects complex data stored in the same
>> way as complex data is currently stored in Octave?
>>   
> Yes, Octave calls lapack/blas functions like [cz]GEMM, for complex
> arguments. Greping the matlab libraries with
>
> nm -C --dynamic  libmwnumerics.so | grep [gG][eE][mM][mM]
>
> gives
>
>                 U dgemm_
>                 U sgemm_
>                 U zgemm_
>
> So it appears that the double precision complex matrix multiple is
> linked in but the single precision version isn't. I'd think this means
> that in fact ZGEMM is used by the SuiteSparse code (which doesn't have
> single precision), and that in fact matlab internally uses four calls
> to DGEMM on the real and imaginary parts of the matrix to simulate
> ZGEMM as that means that they never explicitly have to form the
> complex matrix. Given the speed differences (or lack thereof) for such
> operations between Octave and Matlab I believe that pretty much
> confirms what they do.
How did you test this?

I did a quick test (Pentium-M laptop):

1) Octave 3.0.2

octave:1> n=2000; B = randn(n,n) + i*randn(n,n);
octave:2> n=2000; A = randn(n,n) + i*randn(n,n);
octave:3> tic, C=A*B;toc
Elapsed time is 37.4009 seconds.
octave:4> tic, C=A*B;toc
Elapsed time is 37.3448 seconds.
octave:5>

2) Matlab 7.3

>> n=2000; A = randn(n,n) + i*randn(n,n);
>> n=2000; B = randn(n,n) + i*randn(n,n);
>> tic, C=A*B;toc
Elapsed time is 36.725418 seconds.
>> tic, C=A*B;toc
Elapsed time is 36.786914 seconds.

Both Matlab and Octave use Goto BLAS v. 1.19

It looks like there is no speed penalty  for storing real and imag
parts  separated (at least not for the size of the problem that I tested).

/F




reply via email to

[Prev in Thread] Current Thread [Next in Thread]