tril/triu not preserving sparseness

David Bateman David.Bateman at motorola.com
Fri Jan 25 05:28:14 CST 2008


Martijn van Oosterhout wrote:
> Hi,
>
> I'm working with matrices 6380x6380 and building them sparse. However,
> if I do tril/triu on them it tries to build a full matrix and
> immediately runs out of memory..
> I'm on Octave 2.9.9 and the code for these functions contains the line:
>
>     retval = resize (resize (x, 0), nr, nc);
>
> This returns a full matrix even if x is sparse. If I comment that line
> out it runs fine, but the final matrix is not of the right dimensions
> (depending on the value of k). So at the end of the function I put the
> line:
>
>   retval = resize (retval, nr, nc);
>
> And now octave segfaults. I just need a version of tril/triu that
> works with sparse matrices, anyone have any tips?
>
> Have a nice day,
>
>   
Fixed in a later version of Octave... The relevant changelog entry is

2006-04-02  David Bateman  <dbateman at free.fr>

        * general/tril.m, general.triu.m:
        Use resize (resize (x, 0), nr, nc) rather than zeros (nr, nc)
        to allow user types to work correctly.
        * special-matrix/hankel.m, special-matrix/toeplitz.m: Ditto.

and as you can see the issue was addressed 21 months ago, so please
upgrade your version of Octave.


D.


-- 
David Bateman                                David.Bateman at motorola.com
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



More information about the Help-octave mailing list