[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accumarray
From: |
David Bateman |
Subject: |
Re: accumarray |
Date: |
Thu, 05 Jul 2007 11:57:37 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
address@hidden wrote:
> I would say that correct but slow code is better than no code at all.
>
> Cheers,
>
> Etienne
>
>
Well, I'm back in the office and tried the accumarray in matlab for
speed and got the following results
vals = 1:1e4;
subs = randint(1e4,2,1024) + 1;
t = 0;
for i=1:10,
t0 = cputime();
A = accumarray (subs, vals, [1024,1024]);
t = t + cputime() - t0;
end;
fprintf('Time %g s\n', t / 10);
MatlabR2007a
Time 0.016 s
Octave 2.9.12
Time 1.21592 s
So there is a factor of 76 difference in speed for this example. So
Etienne how useful is this function, and what portion of your simulation
time will be spent in it?
Cheers
David
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary