--- Begin Message ---
Subject: |
Re: Dot product (nx1).*(nxm) |
Date: |
Mon, 6 Dec 1999 08:49:23 +0100 |
On Sun, 05 Dec 1999, Joao Cardoso wrote:
>The first method scales as 1.4*N^2, obviously, and the last one seems to
>scale as 3.7*N*log(N), so I must learn the second method syntax!
>Contributions? I'm using Octave-2.1.14 on a 500MHz PIII.
>
>Joao
Here are my results:
Octave, version 2.0.13 (sparc-sun-solaris2.5.1).
Copyright (C) 1996, 1997, 1998 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.
octave:1> p=rand(100,1);
octave:2> q=ones(1,50);
octave:3> p2=p*q;
octave:4> t0=cputime; for i=1:1000, p2=p*q; end , cputime-t0
ans = 0.34773
octave:5> t0=cputime; for i=1:1000, p2=p(:,q); end , cputime-t0
ans = 2.5304
octave:6> p=rand(500,1);
octave:7> q=ones(1,250);
octave:8> p2=p*q;
octave:9> t0=cputime; for i=1:1000, p2=p*q; end , cputime-t0
ans = 12.381
octave:10> t0=cputime; for i=1:1000, p2=p(:,q); end , cputime-t0
ans = 57.984
octave:11> p=rand(1000,1);
octave:12> q=ones(1,500);
octave:13> p2=p*q;
octave:14> t0=cputime; for i=1:1000, p2=p*q; end , cputime-t0
ans = 58.200
octave:15> t0=cputime; for i=1:1000, p2=p(:,q); end , cputime-t0
ans = 236.52
They differe completely from the previously observed.
Hardware: Sun Ultra I, 170MHz, Solaris 2.5.1
Octave: The Fortran stuff is completely replaced by the Sun Performance Library
which is well tuned to the hardware. So the break-even appears at rather high
dimensions. Caching effects?
Regards,
Michael
--
+---------------------------------------------------------------+
| Michael Hanke Royal Institute of Technology |
| NADA |
| S-10044 Stockholm |
| Sweden |
+---------------------------------------------------------------+
| Visiting address: Lindstedtsvaegen 3 |
| Phone: + (46) (8) 790 6278 |
| Fax: + (46) (8) 790 0930 |
| Email: address@hidden |
| address@hidden |
+---------------------------------------------------------------+
--- End Message ---