On 26-Oct-2006, David Bateman wrote: | Ok then use the attached patch in addition to the previous patch... It | essentially removes the previous patch and does it differently. | | Note that this is still a very bad idea as it reallocates the memory to | the sparse matrix and every assignment, even if you size the initial | matrix correctly. This is due to the fact that only enough space for the | nonzeros is ever created... I'd therefore highly recommended forming | vectors of row, col and value and use the sparse function instead. This | is discussed in the sparse section of the manual....
I applied the patch and now I see octave:5> x = sparse (2,0) x = Compressed Column Sparse (rows = 2, cols = 0, nnz = 0) octave:6> x(:,1:2) = speye (2) x = 1 0 0 1 octave:7> x(:,3:4) = speye (2) x = 1 0 1 0 0 1 0 1 so it seems OK, but what is happening here: octave:1> x = sparse (2,0) x = Compressed Column Sparse (rows = 2, cols = 0, nnz = 0) octave:2> x(:,2,3) = speye (2) error: A(I, J) = X: can only have 1 or 2 indexes for sparse matrices error: assignment failed, or no method for `sparse matrix = sparse matrix' error: evaluating assignment expression near line 2, column 10 octave:2> x x = Compressed Column Sparse (rows = 2, cols = 0, nnz = 0) octave:3> x(:,1:2) = speye (2) error: A(I, J) = X: can only have 1 or 2 indexes for sparse matrices error: assignment failed, or no method for `sparse matrix = sparse matrix' error: evaluating assignment expression near line 3, column 10 The command on line 2 was a mistake, but it seems to have a persistent effect. Even though x still seems to be a 2x0 sparse matrix, subsequent assignments fail after the first failure. Clearing x allows it to work again, but how is it that the error is causing the later failures? jwe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]