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

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

[Octave-bug-tracker] [bug #29921] spline() should ignore NaNs


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #29921] spline() should ignore NaNs
Date: Tue, 25 May 2010 13:45:06 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100501 Iceweasel/3.5.9 (like Firefox/3.5.9)

Follow-up Comment #3, bug #29921 (project octave):

In your patch, you have

+  for k = (1:columns (a))(any (isnan (a))) 
+    ok = ! isnan (a(:,k)); 
+    a(!ok,k) = spline (x(ok), a(ok,k), x(!ok)); 
+  endfor 
+  
+  if (any (isnan (a)))
+    for k = 1:size(a,2)
+      ok = (! isnan (a(:,k)));
+      a(!ok,k) = spline (x(ok), a(ok,k), x(!ok));
+    endfor
+  endif

It looks like you are doing the same operation twice.  Is that intended?  If
so, then it might be good to use a temporary variable to avoid computing this
result more than once.  Possibly also for the computation of the OK vectors.

Is the

  if (any (isnan (a))

doing what you expect if A is a matrix?  For example:

  a = [1,2,3;4,NaN,6];

  isnan (a) ==>  [0,0,0;0,1,0]

  any (isnan (a)) ==>  [0,1,0]

and in an IF condition, this will be considered false.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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