help-octave
[Top][All Lists]
Advanced

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

Re: Slow sparse matrix multiplication


From: John W. Eaton
Subject: Re: Slow sparse matrix multiplication
Date: Wed, 9 Mar 2005 22:14:18 -0500

On  9-Mar-2005, Andy Adler <address@hidden> wrote:

| Here is a comparison with matlab (on 2.8GHz debian linux)
| 
| CODE:
|     for d=[1e-6,1e-5,1e-4,1e-3,1e-2]; % sparse densities
|         a=sprand(1e4,1e4,d);
|         tic;a*a;   t1=toc;
|         tic;a+a;   t2=toc;
|         fprintf('%f %f %f\n',d,t1,t2);
|     end
| 
| Octave (latest cvs)
|     0.000001  0.198402  0.000817
|     0.000010  0.666243  0.000765
|     0.000100  0.653231  0.001149
|     0.001000  0.733525  0.008373
|     0.010000  4.891503  0.173296
| 
| 
| Matlab 7.0.1
|     0.000001  0.001259  0.000932
|     0.000010  0.000940  0.000970
|     0.000100  0.002911  0.002459
|     0.001000  0.277165  0.023974
|     0.010000 20.477461  0.549163
| 
| This seems to indicate that my algorithm beats Matlab's for sparse densities
|  > .001. I definitely designed it with this in mind.

Those are excellent numbers, but I don't trust tic/toc because they
also measure time spent working on other processes.  So can you run

     for d=[1e-6,1e-5,1e-4,1e-3,1e-2]; % sparse densities
         a=sprand(1e4,1e4,d);
         t=cputime; a*a; t1=cputime-t;
         t=cputime; a+a; t2=cputime-t;
         fprintf('%f %f\n',d,t1,t2);
     end

and see what the results are for both Octave and Matlab?

Thanks,

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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