Hello,

three minor bugs in nanmin and nanmax of the current statistics package 
(1.0.10).  Proposed patch attached.

a) nanmax does not process optional third argument DIM correctly, if second 
argument is empty.

Example:

octave:1> nanmax([1,2,nan;nan,nan,nan],[],2)
ans =

     2
  -Inf
   NaN

Expected result:

ans =

     2
   NaN

b) nanmin does not permit 3 arguments.

Example:

octave:1> nanmin([1,2,nan;nan,nan,nan],[],2)
usage: [v, idx] = nanmin(X [, Y, [DIM]])
error:   /u/home/wima/reifert/usr/opt/SimTree/octave/statistics/nanmin.m at 
line 31, column 5

Expected result:

ans =

     1
   NaN

c) After fix of b) same problem a) in nanmin,

Regards,
Andreas

-- 

Dipl.-Inform. Andreas Reifert

Universität Stuttgart, Institut für Kommunikationsnetze und Rechnersysteme
       Zimmer 1.303, Pfaffenwaldring 47, D-70569 Stuttgart, Germany
           Tel: +49-(0)711-685 67963  Fax: +49-(0)711-685 57963

Public key available at http://www.ikr.uni-stuttgart.de/~reifert/pubkey.asc

The greatest obstacle to discovery is not ignorance -
it is the illusion of knowledge. (Daniel J. Boorstin)
diff -ru statistics-1.0.10/inst/nanmax.m statistics-1.0.10.1/inst/nanmax.m
--- statistics-1.0.10/inst/nanmax.m	2008-10-10 21:55:07.000000000 +0200
+++ statistics-1.0.10.1/inst/nanmax.m	2010-08-25 10:49:02.000000000 +0200
@@ -37,7 +37,7 @@
     nanvals = isnan(X);
     X(nanvals) = -Inf;
     v = max (X,[],DIM);
-    v(all(nanvals)) = NaN;
+    v(all(nanvals,DIM)) = NaN;
   else
     Xnan = isnan(X);
     Ynan = isnan(Y);
diff -ru statistics-1.0.10/inst/nanmin.m statistics-1.0.10.1/inst/nanmin.m
--- statistics-1.0.10/inst/nanmin.m	2008-10-10 21:55:07.000000000 +0200
+++ statistics-1.0.10.1/inst/nanmin.m	2010-08-25 10:48:43.000000000 +0200
@@ -27,7 +27,7 @@
 ## @end deftypefn
 
 function [v, idx] = nanmin (X, Y, DIM) 
-  if nargin < 1 || nargin > 2
+  if nargin < 1 || nargin > 3
     usage ("[v, idx] = nanmin(X [, Y, [DIM]])");
   elseif nargin == 1 || (nargin == 2 && isempty(Y))
     nanvals = isnan(X);
@@ -38,7 +38,7 @@
     nanvals = isnan(X);
     X(nanvals) = Inf;
     v = min (X,[],DIM);
-    v(all(nanvals)) = NaN;
+    v(all(nanvals,DIM)) = NaN;
   else
     Xnan = isnan(X);
     Ynan = isnan(Y);

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to