help-octave
[Top][All Lists]
Advanced

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

Re: Slow sparse matrix multiplication


From: Andy Adler
Subject: Re: Slow sparse matrix multiplication
Date: Wed, 9 Mar 2005 23:02:57 -0500 (EST)

On Wed, 9 Mar 2005, John W. Eaton wrote:
> 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-5,3e-5,1e-4,3e-5,1e-3,2e-3,3e-3,5e-3,7e-3,1e-2];
     a=sprand(1e4,1e4,d);
     t=cputime; a*a; t1=cputime-t;
     t=cputime; a+a; t2=cputime-t;
     fprintf('%f %f %f\n',d,t1,t2);
 end

Octave (cvs):
    0.000010  0.720000 0.000000
    0.000030  0.680000 0.000000
    0.000100  0.680000 0.000000
    0.000030  0.670000 0.000000
    0.001000  0.750000 0.010000
    0.002000  0.940000 0.020000
    0.003000  1.250000 0.030000
    0.005000  2.100000 0.090000
    0.007000  3.250000 0.140000
    0.010000  4.920000 0.170000

Matlab (7.0.1):
    0.000010  0.000000 0.000000
    0.000030  0.000000 0.000000
    0.000100  0.010000 0.000000
    0.000030  0.000000 0.000000
    0.001000  0.270000 0.030000
    0.002000  1.110000 0.060000
    0.003000  2.560000 0.080000
    0.005000  6.560000 0.160000
    0.007000 12.060000 0.240000
    0.010000 20.110000 0.350000


As an aside, to get more precision I tried
    t=cputime; for i=1:10; a+a; end; t2=cputime-t;

This always gives an out of memory error in Matlab (but not octave)
  >> for i=1:10;a*a;end
??? Error using ==> mtimes
Out of memory. Type HELP MEMORY for your options.

while
  >> a*a
is ok.  No idea why.

--
Andy Adler




-------------------------------------------------------------
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]