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: Jaroslav Hajek
Subject: Re: Multiply diagonal matrix and full matrix
Date: Fri, 20 Feb 2009 12:55:24 +0100

On Fri, Feb 20, 2009 at 12:46 PM, José Luis García Pallero
<address@hidden> wrote:
> 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?

It will create a special matrix object. Watch this in 3.1.52+:

octave:1> a = diag(1:100);
octave:2> typeinfo (a)
ans = diagonal matrix

3.0.x gives you just "matrix".

The diagonal matrix object keeps just the diagonal in memory, and will
use fast algorithms when used in multiplication, division, addition,
subtraction, inverse, determinant etc. Similar optimizations apply for
permutation matrices.
This enables users to write more straightforward linear algebra code.

regards

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



reply via email to

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