diff scripts/polynomial/roots.m @ 22765:01aae08a0105

maint: Rename variables to match documentation in m-files. * fminbnd.m, javaclasspath.m, ls_command.m, isprop.m, roots.m, bicg.m, cgs.m, qmr.m, dump_demos.m: Rename variables in function to match documentation. * normest1.m, AbsRel_norm.m, colstyle.m, frame2im.m, rotate.m: Rename variables in documentation to match function. * recycle.m: Rename variable 'state' to 'val' in documentation, and then throughout code. * untabify.m: Rename variable 'dblank' to 'deblank_arg'. * speed.m: Add comment about why variable names can't match documentation.
author Rik <rik@octave.org>
date Mon, 14 Nov 2016 14:55:41 -0800
parents 3a2b891d0b33
children ef4d915df748
line wrap: on
line diff
--- a/scripts/polynomial/roots.m	Mon Nov 14 12:53:43 2016 -0800
+++ b/scripts/polynomial/roots.m	Mon Nov 14 14:55:41 2016 -0800
@@ -79,35 +79,35 @@
 ## Created: 24 December 1993
 ## Adapted-By: jwe
 
-function r = roots (v)
+function r = roots (c)
 
-  if (nargin != 1 || (! isvector (v) && ! isempty (v)))
+  if (nargin != 1 || (! isvector (c) && ! isempty (c)))
     print_usage ();
-  elseif (any (! isfinite (v)))
+  elseif (any (! isfinite (c)))
     error ("roots: inputs must not contain Inf or NaN");
   endif
 
-  v = v(:);
-  n = numel (v);
+  c = c(:);
+  n = numel (c);
 
-  ## If v = [ 0 ... 0 v(k+1) ... v(k+l) 0 ... 0 ],
+  ## If c = [ 0 ... 0 c(k+1) ... c(k+l) 0 ... 0 ],
   ## we can remove the leading k zeros,
   ## and n - k - l roots of the polynomial are zero.
 
-  v_max = max (abs (v));
-  if (isempty (v) || v_max == 0)
+  c_max = max (abs (c));
+  if (isempty (c) || c_max == 0)
     r = [];
     return;
   endif
 
-  f = find (v ./ v_max);
+  f = find (c ./ c_max);
   m = numel (f);
 
-  v = v(f(1):f(m));
-  l = numel (v);
+  c = c(f(1):f(m));
+  l = numel (c);
   if (l > 1)
     A = diag (ones (1, l-2), -1);
-    A(1,:) = -v(2:l) ./ v(1);
+    A(1,:) = -c(2:l) ./ c(1);
     r = eig (A);
     if (f(m) < n)
       r = [r; zeros(n - f(m), 1)];