help-octave
[Top][All Lists]
Advanced

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

Re: problem with the octave built-in function "kron"


From: c.
Subject: Re: problem with the octave built-in function "kron"
Date: Fri, 3 May 2013 18:33:13 +0200

On 3 May 2013, at 18:28, Stephen Montgomery-Smith <address@hidden> wrote:

> Use speye instead of eye.
Unlike Matlab, in Octave eye uses less memory than speye:

----------------------------------------------------------------
>> a = eye (7);
>> b = speye (7);
>> whos a b
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        a           7x7                         56  double
        b           7x7                        116  double

Total is 56 elements using 172 bytes
----------------------------------------------------------------

that's because Octave has a special class for diagonal matrices wich allows to 
only store the 
diagonal elements:

----------------------------------------------------------------
>> typeinfo (a)
ans = diagonal matrix
>> typeinfo (b)
ans = sparse matrix
>>
----------------------------------------------------------------

c.

reply via email to

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