octave-maintainers
[Top][All Lists]
Advanced

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

Update for the New Find


From: Bill Denney
Subject: Update for the New Find
Date: Tue, 3 Oct 2006 09:51:50 -0400 (EDT)

Here are updates to the scripts that can make use of the new find syntax.

Bill

scripts/Changelog
2006-10-03  Bill Denney  <address@hidden>

        * audio/loadaudio.m, control/base/nyquist.m,
          control/system/__zp2ssg2__.m, linear-algebra/cross.m,
          linear-algebra/krylov.m, statistics/base/center.m,
          statistics/base/median.m, statistics/base/std.m,
          statistics/base/var.m, testfun/test.m: use the new find syntax.
Index: audio/loadaudio.m
===================================================================
RCS file: /cvs/octave/scripts/audio/loadaudio.m,v
retrieving revision 1.18
diff -u -r1.18 loadaudio.m
--- audio/loadaudio.m   6 Mar 2006 21:26:48 -0000       1.18
+++ audio/loadaudio.m   3 Oct 2006 12:12:17 -0000
@@ -67,7 +67,7 @@
          || strcmp (ext, "snd") || strcmp(ext, "ul"))
     [Y, c] = fread (num, inf, "uchar");
     ## remove file header
-    m = max (find (Y(1:64) == 0));
+    m = find (Y(1:64) == 0, 1, "last");
     if (! isempty (m))
       Y(1:m) = [];
     endif
Index: control/base/nyquist.m
===================================================================
RCS file: /cvs/octave/scripts/control/base/nyquist.m,v
retrieving revision 1.11
diff -u -r1.11 nyquist.m
--- control/base/nyquist.m      26 Apr 2005 19:24:29 -0000      1.11
+++ control/base/nyquist.m      3 Oct 2006 12:12:17 -0000
@@ -166,7 +166,7 @@
 
         ## check for asymptotes
         fmax = max(abs(f));
-        fi = max(find(abs(f) == fmax));
+        fi = find(abs(f) == fmax, 1, "last");
 
         ## compute angles from point to point
         df = diff(f);
Index: control/system/__zp2ssg2__.m
===================================================================
RCS file: /cvs/octave/scripts/control/system/__zp2ssg2__.m,v
retrieving revision 1.4
diff -u -r1.4 __zp2ssg2__.m
--- control/system/__zp2ssg2__.m        26 Apr 2005 19:24:29 -0000      1.4
+++ control/system/__zp2ssg2__.m        3 Oct 2006 12:12:17 -0000
@@ -40,7 +40,7 @@
     ## roundoff)
     err = abs(rvals(cidx) - r1');
     minerr = min(err);
-    c2i = min(find(err == minerr));
+    c2i = find(err == minerr, 1);
     r2i = cidx(c2i);
     r2 = rvals(r2i);
     cidx = complement(r2i,cidx);
Index: linear-algebra/cross.m
===================================================================
RCS file: /cvs/octave/scripts/linear-algebra/cross.m,v
retrieving revision 1.14
diff -u -r1.14 cross.m
--- linear-algebra/cross.m      24 Apr 2006 19:13:08 -0000      1.14
+++ linear-algebra/cross.m      3 Oct 2006 12:12:18 -0000
@@ -59,7 +59,7 @@
   endif
 
   if (nargin == 2)
-     dim = min (find (size (x) == 3));
+     dim = find (size (x) == 3, 1);
      if (isempty (dim)) 
        error ("cross: must have at least one dimension with 3 elements");
      endif
Index: linear-algebra/krylov.m
===================================================================
RCS file: /cvs/octave/scripts/linear-algebra/krylov.m,v
retrieving revision 1.17
diff -u -r1.17 krylov.m
--- linear-algebra/krylov.m     24 Aug 2006 17:09:18 -0000      1.17
+++ linear-algebra/krylov.m     3 Oct 2006 12:12:18 -0000
@@ -133,12 +133,12 @@
           ## locate max magnitude element in short_q
           asq = abs (short_q);
           maxv = max (asq);
-          maxidx = find (asq == maxv);
-          pivot_idx = short_pv(maxidx(1));
+          maxidx = find (asq == maxv, 1);
+          pivot_idx = short_pv(maxidx);
 
          ## see if need to change the pivot list
           if (pivot_idx != pivot_vec(nu))
-            swapidx = maxidx(1) + (nu-1);
+            swapidx = maxidx + (nu-1);
             [pivot_vec(nu), pivot_vec(swapidx)] = ...
                swap (pivot_vec(nu), pivot_vec(swapidx));
           endif
Index: statistics/base/center.m
===================================================================
RCS file: /cvs/octave/scripts/statistics/base/center.m,v
retrieving revision 1.11
diff -u -r1.11 center.m
--- statistics/base/center.m    23 Aug 2005 18:38:28 -0000      1.11
+++ statistics/base/center.m    3 Oct 2006 12:12:18 -0000
@@ -39,7 +39,7 @@
     retval = x - mean (x, varargin{:});
   elseif (ismatrix (x))
     if nargin < 2
-      dim = min (find (size (x) > 1));
+      dim = find (size (x) > 1, 1);
       if isempty (dim), 
        dim=1; 
       endif;
Index: statistics/base/median.m
===================================================================
RCS file: /cvs/octave/scripts/statistics/base/median.m,v
retrieving revision 1.10
diff -u -r1.10 median.m
--- statistics/base/median.m    6 Mar 2006 21:26:50 -0000       1.10
+++ statistics/base/median.m    3 Oct 2006 12:12:18 -0000
@@ -53,7 +53,7 @@
     usage ("median (a, dim)");
   endif
   if (nargin < 2)
-    dim = min (find (size (a) > 1));
+    dim = find (size (a) > 1, 1);
     if (isempty (dim))
       dim = 1;
     endif
Index: statistics/base/std.m
===================================================================
RCS file: /cvs/octave/scripts/statistics/base/std.m,v
retrieving revision 1.9
diff -u -r1.9 std.m
--- statistics/base/std.m       6 Mar 2006 21:26:50 -0000       1.9
+++ statistics/base/std.m       3 Oct 2006 12:12:18 -0000
@@ -66,7 +66,7 @@
     usage ("std (a, opt, dim)");
   endif
   if nargin < 3
-    dim = min(find(size(a)>1));
+    dim = find (size (a) > 1, 1);
     if isempty(dim), dim=1; endif;
   endif
   if ((nargin < 2) || isempty(opt))
Index: statistics/base/var.m
===================================================================
RCS file: /cvs/octave/scripts/statistics/base/var.m,v
retrieving revision 1.12
diff -u -r1.12 var.m
--- statistics/base/var.m       31 Aug 2005 20:41:47 -0000      1.12
+++ statistics/base/var.m       3 Oct 2006 12:12:19 -0000
@@ -47,7 +47,7 @@
     usage ("var (x, opt, sim)");
   endif
   if (nargin < 3)
-    dim = min (find (size (x) > 1));
+    dim = find (size (x) > 1, 1);
     if (isempty (dim))
       dim = 1;
     endif
Index: testfun/test.m
===================================================================
RCS file: /cvs/octave/scripts/testfun/test.m,v
retrieving revision 1.9
diff -u -r1.9 test.m
--- testfun/test.m      27 Jul 2006 17:16:14 -0000      1.9
+++ testfun/test.m      3 Oct 2006 12:12:20 -0000
@@ -479,12 +479,12 @@
   pos = [];
 
   ## Find the end of the name
-  right = min(find(def=='('));
+  right = find(def=='(', 1);
   if isempty(right), return; endif
-  right = max(find(def(1:right-1) != ' '));
+  right = find(def(1:right-1) != ' ', 1, "last");
 
   ## Find the beginning of the name
-  left = max([find(def(1:right)==' '),find(def(1:right)=='=')]);
+  left = max([find(def(1:right)==' ', 1, "last"),find(def(1:right)=='=', 1, 
"last")]);
   if isempty(left), return; endif
   left++;
 

reply via email to

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