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: Ozzy Lash
Subject: Re: fastest way to element-by-element multiply matix by vector?
Date: Tue, 19 Jun 2007 10:16:42 -0500

On 6/19/07, Michael Creel <address@hidden> wrote:
Hello all,
I need to element-by-element multiply an nXk matrix A by an nX1 vector b, so
that the result is that each row of A is multiplied by the corresponding row of
b. This is on the inside loop of some intense calculations, so I'd like the best
performance. Is C = A .* repmat(b,1,k) the best way to do this?
Thanks, Michael

The only other way I can think of is:

C = diag(b) * A

Not sure which would be faster, replication and element by element
multiply or diagonalization and matrix multiply.

Bill


reply via email to

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