diff liboctave/boolSparse.cc @ 11571:0e414f837c58

Fix indexing error in the construction of sparse matrices
author David Bateman <dbateman@free.fr>
date Thu, 20 Jan 2011 02:46:51 +0100
parents 57632dea2446
children 12df7854fa7c
line wrap: on
line diff
--- a/liboctave/boolSparse.cc
+++ b/liboctave/boolSparse.cc
@@ -150,7 +150,8 @@
     {
       // Result is a row vector.
       retval = Sparse<bool> (1, nc);
-      for(octave_idx_type i = 0; i < nc; i++)
+      retval.xcidx(0) = 0;
+      for (octave_idx_type i = 0; i < nc; i++)
         retval.xcidx(i+1) = retval.xcidx(i) + (cidx(i+1) > cidx(i));
       octave_idx_type new_nz = retval.xcidx(nc);
       retval.change_capacity (new_nz);