help-octave
[Top][All Lists]
Advanced

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

Re: indexed assignment for sparse matrices in ov-2.9.4


From: David Bateman
Subject: Re: indexed assignment for sparse matrices in ov-2.9.4
Date: Thu, 19 Jan 2006 17:29:00 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Thomas Kasper a écrit :

Hi,

I have a problem with indexed assignment for sparse matrices in
octave-2.9.4. See below for an example:

octave:1> version
ans = 2.9.4
octave:2> a = sparse(eye(3))
a =

Compressed Column Sparse (rows = 3, cols = 3, nnz = 3)

  (1, 1) -> 1
  (2, 2) -> 1
  (3, 3) -> 1

octave:3> a(:,[3,2,1]) = a
a =

Compressed Column Sparse (rows = 3, cols = 3, nnz = 3)

  (1, 1) -> 1
  (2, 2) -> 1
  (3, 3) -> 1

Firstly, you should use speye(n) rather than sparse(eye(n)) as the full n-by-n matrix is created and then destroyed with the second form and this poses memory issues with large sparse matrices..

Yes this is a bug, and it has already been fixed in the CVS. With the current CVS I get

octave:4> a = speye(3)
a =

Compressed Column Sparse (rows = 3, cols = 3, nnz = 3)

 (1, 1) -> 1
 (2, 2) -> 1
 (3, 3) -> 1

octave:5> a(:,[3,2,1])
ans =

Compressed Column Sparse (rows = 3, cols = 3, nnz = 3)

 (3, 1) -> 1
 (2, 2) -> 1
 (1, 3) -> 1

Cheers
David



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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