Bug#394982: [Pkg-octave-devel] Bug#394982: octave2.9: Crashes on "x(:,
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Oct 26 01:45:31 CEST 2006
On 25-Oct-2006, John W. Eaton wrote:
| 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?
Never mind, I found the problem. The indices for the LHS were not
being cleared. I fixed it. with the following change. I checked in
your previous change and this one.
Thanks,
jwe
-------------- next part --------------
liboctave/ChangeLog:
2006-10-25 John W. Eaton <jwe at octave.org>
* Sparse.cc (assign): Clear lhs index after error.
Index: liboctave/Sparse.cc
===================================================================
RCS file: /cvs/octave/liboctave/Sparse.cc,v
retrieving revision 1.19
diff -u -u -r1.19 Sparse.cc
--- liboctave/Sparse.cc 25 Oct 2006 01:40:26 -0000 1.19
+++ liboctave/Sparse.cc 25 Oct 2006 23:44:11 -0000
@@ -2387,6 +2387,8 @@
{
(*current_liboctave_error_handler)
("A(I, J) = X: can only have 1 or 2 indexes for sparse matrices");
+
+ lhs.clear_index ();
return 0;
}
More information about the Pkg-octave-devel
mailing list