octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #43038] 'mean' fails when operating on trailin


From: Dmitrey
Subject: [Octave-bug-tracker] [bug #43038] 'mean' fails when operating on trailing singleton dimension
Date: Tue, 09 Sep 2014 13:27:22 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0

Follow-up Comment #4, bug #43038 (project octave):

Hi, hear is diff file to fix this:
# HG changeset patch
# User Dmitrey Salnikov <address@hidden>
# Date 1410269118 -10800
#      Tue Sep 09 16:25:18 2014 +0300
# Node ID c40955104bdede20e8d3b31cb99e1273c9e63fd5
# Parent  4630a18757b319688ce52d06917a49063ee3721f
mean fix

diff -r 4630a18757b3 -r c40955104bde scripts/statistics/base/mean.m
--- a/scripts/statistics/base/mean.m    Tue Aug 26 15:48:02 2014 -0700
+++ b/scripts/statistics/base/mean.m    Tue Sep 09 16:25:18 2014 +0300
@@ -103,8 +103,13 @@
     (dim = find (sz > 1, 1)) || (dim = 1);
   else
     if (!(isscalar (dim) && dim == fix (dim))
-      || !(1 <= dim && dim <= nd))
-      error ("mean: DIM must be an integer and a valid dimension");
+      || !(1 <= dim))
+      error ("mean: DIM must be an integer and a valid dimension @@
lamazavr");
+    endif
+    
+    if (!(dim <= nd))
+        y = x;
+        return;
     endif
   endif
 
@@ -155,4 +160,3 @@
 %!error mean (1, 0)
 %!error mean (1, 3)
 %!error mean (1, "b")
-

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43038>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]