diff liboctave/Sparse.cc @ 14446:12ccdce2c216

maint: periodic merge of stable to default
author John W. Eaton <jwe@octave.org>
date Fri, 09 Mar 2012 16:39:24 -0500
parents d07e989686b0 ec660526ae50
children 8d2ce821e38a
line wrap: on
line diff
--- a/liboctave/Sparse.cc
+++ b/liboctave/Sparse.cc
@@ -1404,7 +1404,11 @@
           if (idx.is_range () && idx.increment () == -1)
             {
               retval = Sparse<T> (nr, 1, nz);
-              std::reverse_copy (ridx (), ridx () + nz, retval.ridx ());
+
+              for (octave_idx_type j = 0; j < nz; j++)
+                retval.ridx (j) = nr - ridx (nz - j - 1) - 1;
+
+              copy_or_memcpy (2, cidx (), retval.cidx ());
               std::reverse_copy (data (), data () + nz, retval.data ());
             }
           else
@@ -2726,6 +2730,10 @@
 %!test test_sparse_slice ([2 2], 22, 3);
 %!test test_sparse_slice ([2 2], 22, 4);
 
+bug #35570:
+
+%!assert (speye (3,1)(3:-1:1), sparse ([0; 0; 1]))
+
 */
 
 template <class T>