changeset 12355:1c4cad056b79 release-3-4-x

sparse matrix indexed assignment bug
author John W. Eaton <jwe@octave.org>
date Mon, 31 Jan 2011 17:09:24 -0500
parents a85d14454adc
children a3c6d0480c7c
files liboctave/ChangeLog liboctave/Sparse.cc
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-31  John W. Eaton  <jwe@octave.org>
+
+	* Sparse.cc (Sparse<T>::assign (const idx_vector&, const idx_vector&,
+	const Sparse<T>&)): Handle case of LHS originally empty, and
+	with non-colon indices.  Fix typo in previous change.  Bug #32263.
+
 2011-01-30  Pascal Dupuis  <Pascal.Dupuis@worldonline.be>
 
 	* lo-sysdep.cc (opendir): On error, free allocated DIR object
--- a/liboctave/Sparse.cc
+++ b/liboctave/Sparse.cc
@@ -1875,7 +1875,7 @@
               nrx = n;
 
               if (idx_j.is_colon ())
-                ncx = n;
+                ncx = m;
               else
                 ncx = idx_j.extent (nc);
             }
@@ -1884,6 +1884,11 @@
               nrx = idx_i.extent (nr);
               ncx = m;
             }
+          else
+            {
+              nrx = idx_i.extent (nr);
+              ncx = idx_j.extent (nc);
+            }
         }
       else
         {