help-octave
[Top][All Lists]
Advanced

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

Re: Multiply diagonal matrix and full matrix


From: José Luis García Pallero
Subject: Re: Multiply diagonal matrix and full matrix
Date: Fri, 20 Feb 2009 12:46:57 +0100

Can I think, therefore, that in new versions of GNU Octave when I use diag(A)*B, the diag(A) statement do not create a diagonal matrix in memory before the * operation?

2009/2/20 Jaroslav Hajek <address@hidden>
On Fri, Feb 20, 2009 at 12:23 PM, José Luis García Pallero
<address@hidden> wrote:
> Exist any trick in GNU Octave for multiply two matrices, one diagonal and
> other full, without the use of command diag() nor for loop?
>

Octave 3.0 has "dmult" which essentially does something like repmat
(A(:), 1, columns (B)) .* B.

In Octave 3.2, there will be no need for such tricks, because diag(A)
* B will be the most efficient as well as the most readable syntax
(even more efficient than the above), so dmult is deprecated (by a
funny coincidence I deprecated it a couple of minutes ago).

3.2 will be out soon so unless you expect to be stuck with an older
series, I suggest you just use diag () *,
and you'll soon get your code boosted ;)

cheers


--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



--
*****************************************
José Luis García Pallero
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************

reply via email to

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