changeset 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 b50654a09ba7 (current diff) 245963d3d628 (diff)
children c97416a0f657 ab4676288414
files NEWS liboctave/Array.cc liboctave/Sparse.cc scripts/pkg/pkg.m scripts/statistics/base/median.m
diffstat 5 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Mar 09 16:17:41 2012 -0500
+++ b/NEWS	Fri Mar 09 16:39:24 2012 -0500
@@ -79,7 +79,7 @@
       rem
       xor
 
-    additionally, since the A op= B assginment operators are equivalent
+    additionally, since the A op= B assignment operators are equivalent
     to A = A op B, the following operators are also affected:
 
       +=  -=  .+=  .-=  .*=  ./=  .\=  .^=  .**=  &=  |=
@@ -107,8 +107,8 @@
     scripts.
 
     negative binomial function has been extended to real, non-integer
-    inputs.  The discrete_inv fucntion now returns v(1) for 0 instead of
-    NaN.  The nbincdf fucntion has been recoded to use a closed form
+    inputs.  The discrete_inv function now returns v(1) for 0 instead of
+    NaN.  The nbincdf function has been recoded to use a closed form
     solution with betainc.
 
  ** strread, textscan, and textread have been completely revamped.
@@ -170,7 +170,7 @@
     string now supported.
 
     datestr: Numerical formats 21, 22, 29 changed to match Matlab.
-             Now accepts cellstr inputs.
+             Now accepts cellstr input.
 
  ** The following warning IDs have been removed:
 
@@ -199,7 +199,7 @@
     The uiXXX functions above are experimental.
 
     Except for uiwait and uiresume, the uiXXX functions are not
-    supported with the the FLTK+OpenGL graphics toolkit.
+    supported with the FLTK+OpenGL graphics toolkit.
 
     The gnuplot graphics toolkit does not support any of the uiXXX
     functions nor the waitfor function.
@@ -243,6 +243,10 @@
       __error_text__     studentize
       error_text         sylvester_matrix
 
+ ** The following functions have been modified for Matlab compatibility:
+
+      randperm
+
 Summary of important user-visible changes for version 3.4.3:
 -----------------------------------------------------------
 
--- a/liboctave/Array.cc	Fri Mar 09 16:17:41 2012 -0500
+++ b/liboctave/Array.cc	Fri Mar 09 16:39:24 2012 -0500
@@ -2253,6 +2253,7 @@
 
   dv(dim) = std::min (nn, ns);
   dv.chop_trailing_singletons ();
+  dim = std::min (dv.length (), dim);
 
   Array<T> m (dv);
 
--- a/liboctave/Sparse.cc	Fri Mar 09 16:17:41 2012 -0500
+++ b/liboctave/Sparse.cc	Fri Mar 09 16:39:24 2012 -0500
@@ -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>
--- a/scripts/pkg/pkg.m	Fri Mar 09 16:17:41 2012 -0500
+++ b/scripts/pkg/pkg.m	Fri Mar 09 16:39:24 2012 -0500
@@ -1751,7 +1751,8 @@
         value = strip (line (colon+1:end));
         if (length (value) == 0)
             fclose (fid);
-            error ("the keyword %s has an empty value", desc.keywords{end});
+            error ("The keyword `%s' of the package `%s' has an empty value",
+                    keyword, desc.name);
         endif
         desc.(keyword) = value;
       endif
--- a/scripts/statistics/base/median.m	Fri Mar 09 16:17:41 2012 -0500
+++ b/scripts/statistics/base/median.m	Fri Mar 09 16:39:24 2012 -0500
@@ -102,6 +102,16 @@
 %!assert (median (single ([1,2,3])), single (2))
 %!assert (median ([1,2,NaN;4,5,6;NaN,8,9]), [NaN, 5, NaN])
 
+%% Test multidimensional arrays (bug #35679)
+%!shared a, b, x, y
+%! rand ("seed", 2);
+%! a = rand (2,3,4,5);
+%! b = rand (3,4,6,5);
+%! x = sort (a, 4);
+%! y = sort (b, 3);
+%!assert (median (a, 4), x(:, :, :, 3));
+%!assert (median (b, 3), (y(:, :, 3, :) + y(:, :, 4, :))/2);
+
 %% Test input validation
 %!error median ()
 %!error median (1, 2, 3)