help-octave
[Top][All Lists]
Advanced

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

Re: fastest way to element-by-element multiply matix by vector?


From: David Bateman
Subject: Re: fastest way to element-by-element multiply matix by vector?
Date: Wed, 20 Jun 2007 09:47:36 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Michael Creel wrote:
>
> Thanks for the script! The results (second run), with Octave 2.9.12 on
> AMD 64 X2 CPU @2000MHz running 64 bit Kubuntu 7.04 are:
> (   n,   k)     A.*repmat(b,1,k)     diag(b)*A      spdiag(b)*A
> ( 100, 100)         0.0180 s         0.0010 s         0.0060 s
> ( 100, 200)         0.0010 s         0.0020 s         0.0010 s
> ( 100, 500)         0.0030 s         0.0040 s         0.0020 s
> ( 100,1000)         0.0030 s         0.0080 s         0.0040 s
> ( 100,2000)         0.0060 s         0.0150 s         0.0080 s
> ( 200, 100)         0.0010 s         0.0040 s         0.0010 s
> ( 200, 200)         0.0020 s         0.0060 s         0.0020 s
> ( 200, 500)         0.0030 s         0.0140 s         0.0040 s
> ( 200,1000)         0.0060 s         0.0260 s         0.0070 s
> ( 200,2000)         0.0120 s         0.0520 s         0.0150 s
> ( 500, 100)         0.0010 s         0.0200 s         0.0020 s
> ( 500, 200)         0.0030 s         0.0360 s         0.0040 s
> ( 500, 500)         0.0070 s         0.0830 s         0.0110 s
> ( 500,1000)         0.0140 s         0.1620 s         0.0190 s
> ( 500,2000)         0.0290 s         0.3160 s         0.0410 s
> (1000, 100)         0.0030 s         0.0760 s         0.0030 s
> (1000, 200)         0.0060 s         0.1350 s         0.0080 s
> (1000, 500)         0.0130 s         0.3150 s         0.0180 s
> (1000,1000)         0.0240 s         0.6129 s         0.0370 s
> (1000,2000)         0.0570 s         1.1948 s         0.0820 s
> (2000, 100)         0.0060 s         0.3080 s         0.0090 s
> (2000, 200)         0.0120 s         0.5599 s         0.0160 s
> (2000, 500)         0.0240 s         1.2648 s         0.0370 s
> (2000,1000)         0.0460 s         2.4296 s         0.0750 s
> (2000,2000)         0.1090 s         4.8293 s         0.1670 s
> octave:3>
>
> To my taste, the first option wins, though the third is competitive.
> Thanks again, M.
>

I get the reverse and the third option wins.. The third option also has
a big memory advantage for large matrices..

D.

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



reply via email to

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