changeset 11470:eb9e0b597d61

Use common names for variables in documentation and code for a few more m-script files.
author Rik <octave@nomad.inbox5.com>
date Sun, 09 Jan 2011 13:44:15 -0800
parents c776f063fefe
children 994e2a93a8e2
files scripts/ChangeLog scripts/general/bicubic.m scripts/general/nargchk.m scripts/general/nargoutchk.m scripts/linear-algebra/krylov.m scripts/linear-algebra/krylovb.m scripts/linear-algebra/normest.m scripts/linear-algebra/null.m scripts/linear-algebra/orth.m scripts/linear-algebra/rank.m
diffstat 10 files changed, 91 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/ChangeLog	Sun Jan 09 13:44:15 2011 -0800
@@ -1,3 +1,11 @@
+2011-01-09  Rik  <octave@nomad.inbox5.com>
+
+	* general/bicubic.m, general/nargchk.m, general/nargoutchk.m,
+	linear-algebra/krylov.m, linear-algebra/krylovb.m,
+	linear-algebra/normest.m, linear-algebra/null.m, linear-algebra/orth.m,
+	linear-algebra/rank.m: Use common names for variables in documentation
+	and code.
+
 2011-01-09  Rik  <octave@nomad.inbox5.com>
 
 	* audio/loadaudio.m, audio/mu2lin.m, audio/saveaudio.m,
--- a/scripts/general/bicubic.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/general/bicubic.m	Sun Jan 09 13:44:15 2011 -0800
@@ -32,7 +32,7 @@
 ## Bicubic interpolation method.
 ## Author: Hoxide Ma <hoxide_dirac@yahoo.com.cn>
 
-function F = bicubic (X, Y, Z, XI, YI, extrapval, spline_alpha)
+function zi = bicubic (x, y, z, xi, yi, extrapval, spline_alpha)
 
   if (nargin < 1 || nargin > 7)
     print_usage ();
@@ -48,81 +48,81 @@
     extrapval = NaN;
   endif
 
-  if (isa (X, "single") || isa (Y, "single") || isa (Z, "single")
-      || isa (XI, "single") || isa (YI, "single"))
+  if (isa (x, "single") || isa (y, "single") || isa (z, "single")
+      || isa (xi, "single") || isa (yi, "single"))
     myeps = eps("single");
   else
     myeps = eps;
   endif
 
   if (nargin <= 2)
-    ## bicubic (Z) or bicubic (Z, 2)
+    ## bicubic (z) or bicubic (z, 2)
     if (nargin == 1) 
       n = 1;
     else
-      n = Y;
+      n = y;
     endif
-    Z = X;
-    X = [];
-    [rz, cz] = size (Z);
+    z = x;
+    x = [];
+    [rz, cz] = size (z);
     s = linspace (1, cz, (cz-1)*pow2(n)+1);
     t = linspace (1, rz, (rz-1)*pow2(n)+1);
   elseif (nargin == 3)
-    if (! isvector (X) || ! isvector (Y))
+    if (! isvector (x) || ! isvector (y))
       error ("bicubic: XI and YI must be vector");
     endif
-    s = Y;
-    t = Z;
-    Z = X;
-    [rz, cz] = size (Z);
+    s = y;
+    t = z;
+    z = x;
+    [rz, cz] = size (z);
   elseif (nargin == 5 || nargin == 6)
-    [rz, cz] = size (Z) ; 
-    if (isvector (X) && isvector (Y))
-      if (rz != length (Y) || cz != length (X))
+    [rz, cz] = size (z) ; 
+    if (isvector (x) && isvector (y))
+      if (rz != length (y) || cz != length (x))
         error ("bicubic: length of X and Y must match the size of Z");
       endif
-    elseif (size_equal (X, Y) && size_equal (X, Z))
-      X = X(1,:);
-      Y = Y(:,1);
+    elseif (size_equal (x, y) && size_equal (x, z))
+      x = x(1,:);
+      y = y(:,1);
     else
       error ("bicubic: X, Y and Z must be equal size matrices of same size");
     endif
     
     ## Mark values outside the lookup table.
-    xfirst_ind = find (XI < X(1));
-    xlast_ind  = find (XI > X(cz));    
-    yfirst_ind = find (YI < Y(1));
-    ylast_ind  = find (YI > Y(rz));
+    xfirst_ind = find (xi < x(1));
+    xlast_ind  = find (xi > x(cz));    
+    yfirst_ind = find (yi < y(1));
+    ylast_ind  = find (yi > y(rz));
     ## Set value outside the table preliminary to min max index.
-    XI(xfirst_ind) = X(1);
-    XI(xlast_ind) = X(cz);
-    YI(yfirst_ind) = Y(1);
-    YI(ylast_ind) = Y(rz);
+    xi(xfirst_ind) = x(1);
+    xi(xlast_ind) = x(cz);
+    yi(yfirst_ind) = y(1);
+    yi(ylast_ind) = y(rz);
 
 
-    X = reshape (X, 1, cz);
-    X(cz) *= 1 + sign (X(cz))*myeps;
-    if (X(cz) == 0) 
-      X(cz) = myeps;
+    x = reshape (x, 1, cz);
+    x(cz) *= 1 + sign (x(cz))*myeps;
+    if (x(cz) == 0) 
+      x(cz) = myeps;
     endif; 
-    XI = reshape (XI, 1, length (XI));
-    [m, i] = sort ([X, XI]);
+    xi = reshape (xi, 1, length (xi));
+    [m, i] = sort ([x, xi]);
     o = cumsum (i <= cz);
     xidx = o(find (i > cz));
     
-    Y = reshape (Y, rz, 1);
-    Y(rz) *= 1 + sign (Y(rz))*myeps;
-    if (Y(rz) == 0) 
-      Y(rz) = myeps;
+    y = reshape (y, rz, 1);
+    y(rz) *= 1 + sign (y(rz))*myeps;
+    if (y(rz) == 0) 
+      y(rz) = myeps;
     endif; 
-    YI = reshape (YI, length (YI), 1);
-    [m, i] = sort ([Y; YI]);
+    yi = reshape (yi, length (yi), 1);
+    [m, i] = sort ([y; yi]);
     o = cumsum (i <= rz);
     yidx = o([find(i > rz)]);
     
     ## Set s and t used follow codes.
-    s = xidx + ((XI .- X(xidx))./(X(xidx+1) .- X(xidx)));
-    t = yidx + ((YI - Y(yidx))./(Y(yidx+1) - Y(yidx)));
+    s = xidx + ((xi .- x(xidx))./(x(xidx+1) .- x(xidx)));
+    t = yidx + ((yi - y(yidx))./(y(yidx+1) - y(yidx)));
   else
     print_usage ();
   endif
@@ -145,8 +145,8 @@
   t(d) = 1.0;
   d = [];
 
-  p = zeros (size (Z) + 2);
-  p(2:rz+1,2:cz+1) = Z;
+  p = zeros (size (z) + 2);
+  p(2:rz+1,2:cz+1) = z;
   p(1,:) =    (6*(1-a))*p(2,:)    - 3*p(3,:)  + (6*a-2)*p(4,:);
   p(rz+2,:) = (6*(1-a))*p(rz+1,:) - 3*p(rz,:) + (6*a-2)*p(rz-1,:);
   p(:,1) =    (6*(1-a))*p(:,2)    - 3*p(:,3)  + (6*a-2)*p(:,4);
@@ -178,22 +178,22 @@
 
   lent = length (ct0);
   lens = columns (cs0);
-  F = zeros (lent, lens);
+  zi = zeros (lent, lens);
   
   for i = 1:lent
     it = indt(i);
     int = [it, it+1, it+2, it+3];
-    F(i,:) = ([ct0(i),ct1(i),ct2(i),ct3(i)]
+    zi(i,:) = ([ct0(i),ct1(i),ct2(i),ct3(i)]
               * (p(int,inds) .* cs0 + p(int,inds+1) .* cs1
                  + p(int,inds+2) .* cs2 + p(int,inds+3) .* cs3));
   endfor
 
   ## Set points outside the table to extrapval.
   if (! (isempty (xfirst_ind) && isempty (xlast_ind)))
-    F(:, [xfirst_ind, xlast_ind]) = extrapval;
+    zi(:, [xfirst_ind, xlast_ind]) = extrapval;
   endif
   if (! (isempty (yfirst_ind) && isempty (ylast_ind)))
-    F([yfirst_ind; ylast_ind], :) = extrapval;
+    zi([yfirst_ind; ylast_ind], :) = extrapval;
   endif
 
 endfunction
--- a/scripts/general/nargchk.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/general/nargchk.m	Sun Jan 09 13:44:15 2011 -0800
@@ -30,25 +30,25 @@
 
 ## Author: Bill Denney <bill@denney.ws>
 
-function msg = nargchk (mina, maxa, narg, outtype)
+function msg = nargchk (minargs, maxargs, nargs, outtype)
 
   if (nargin < 3 || nargin > 4)
     print_usage ();
-  elseif (mina > maxa)
-    error ("nargchk: minargs must be <= maxargs");
+  elseif (minargs > maxargs)
+    error ("nargchk: MINARGS must be <= MAXARGS");
   elseif (nargin == 3)
     outtype = "string";
   elseif (! any (strcmpi (outtype, {"string", "struct"})))
     error ("nargchk: output type must be either string or struct");
-  elseif (! (isscalar (mina) && isscalar (maxa) && isscalar (narg)))
-    error ("nargchk: mina, maxa, and narg must be scalars");
+  elseif (! (isscalar (minargs) && isscalar (maxargs) && isscalar (nargs)))
+    error ("nargchk: MINARGS, MAXARGS, and NARGS must be scalars");
   endif
 
   msg = struct ("message", "", "identifier", "");
-  if (narg < mina)
+  if (nargs < minargs)
     msg.message = "not enough input arguments";
     msg.identifier = "Octave:nargchk:not-enough-inputs";
-  elseif (narg > maxa)
+  elseif (nargs > maxargs)
     msg.message = "too many input arguments";
     msg.identifier = "Octave:nargchk:too-many-inputs";
   endif
--- a/scripts/general/nargoutchk.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/general/nargoutchk.m	Sun Jan 09 13:44:15 2011 -0800
@@ -30,25 +30,25 @@
 
 ## Author: Bill Denney <bill@denney.ws>
 
-function msg = nargoutchk (mina, maxa, narg, outtype)
+function msg = nargoutchk (minargs, maxargs, nargs, outtype)
 
   if (nargin < 3 || nargin > 4)
     print_usage ();
-  elseif (mina > maxa)
-    error ("nargoutchk: minargs must be <= maxargs");
+  elseif (minargs > maxargs)
+    error ("nargoutchk: MINARGS must be <= MAXARGS");
   elseif (nargin == 3)
     outtype = "string";
   elseif (! any (strcmpi (outtype, {"string" "struct"})))
     error ("nargoutchk: output type must be either string or struct");
-  elseif (! (isscalar (mina) && isscalar (maxa) && isscalar (narg)))
-    error ("nargoutchk: mina, maxa, and narg must be scalars");
+  elseif (! (isscalar (minargs) && isscalar (maxargs) && isscalar (nargs)))
+    error ("nargoutchk: MINARGS, MAXARGS, and NARGS must be scalars");
   endif
 
   msg = struct ("message", "", "identifier", "");
-  if (narg < mina)
+  if (nargs < minargs)
     msg.message = "not enough output arguments";
     msg.identifier = "Octave:nargoutchk:not-enough-outputs";
-  elseif (narg > maxa)
+  elseif (nargs > maxargs)
     msg.message = "too many output arguments";
     msg.identifier = "Octave:nargoutchk:too-many-outputs";
   endif
--- a/scripts/linear-algebra/krylov.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/krylov.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,7 +18,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{u}, @var{h}, @var{nu}] =} krylov (@var{a}, @var{v}, @var{k}, @var{eps1}, @var{pflg})
+## @deftypefn {Function File} {[@var{u}, @var{h}, @var{nu}] =} krylov (@var{A}, @var{V}, @var{k}, @var{eps1}, @var{pflg})
 ## Construct an orthogonal basis @var{u} of block Krylov subspace
 ##
 ## @example
@@ -28,13 +28,13 @@
 ## @noindent
 ## Using Householder reflections to guard against loss of orthogonality.
 ##
-## If @var{v} is a vector, then @var{h} contains the Hessenberg matrix
+## If @var{V} is a vector, then @var{h} contains the Hessenberg matrix
 ## such that @code{a*u == u*h+rk*ek'}, in which @code{rk =
 ## a*u(:,k)-u*h(:,k)}, and @code{ek'} is the vector
 ## @code{[0, 0, @dots{}, 1]} of length @code{k}.  Otherwise, @var{h} is
 ## meaningless.
 ##
-## If @var{v} is a vector and @var{k} is greater than
+## If @var{V} is a vector and @var{k} is greater than
 ## @code{length(A)-1}, then @var{h} contains the Hessenberg matrix such
 ## that @code{a*u == u*h}.
 ##
@@ -42,7 +42,7 @@
 ## subspace (based on @var{eps1}).
 ##
 ## If @var{b} is a vector and @var{k} is greater than @var{m-1}, then
-## @var{h} contains the Hessenberg decomposition of @var{a}.
+## @var{h} contains the Hessenberg decomposition of @var{A}.
 ##
 ## The optional parameter @var{eps1} is the threshold for zero.  The
 ## default value is 1e-12.
--- a/scripts/linear-algebra/krylovb.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/krylovb.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,7 +18,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{u}, @var{ucols}] =} krylovb (@var{a}, @var{v}, @var{k}, @var{eps1}, @var{pflg})
+## @deftypefn {Function File} {[@var{u}, @var{ucols}] =} krylovb (@var{A}, @var{V}, @var{k}, @var{eps1}, @var{pflg})
 ## See @code{krylov}.
 ## @end deftypefn
 
--- a/scripts/linear-algebra/normest.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/normest.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,12 +18,12 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{n} =} normest (@var{a})
-## @deftypefnx {Function File} {@var{n} =} normest (@var{a}, @var{tol})
+## @deftypefn  {Function File} {@var{n} =} normest (@var{A})
+## @deftypefnx {Function File} {@var{n} =} normest (@var{A}, @var{tol})
 ## @deftypefnx {Function File} {[@var{n}, @var{c}] =} normest (@dots{})
-## Estimate the 2-norm of the matrix @var{a} using a power series
+## Estimate the 2-norm of the matrix @var{A} using a power series
 ## analysis.  This is typically used for large matrices, where the cost
-## of calculating @code{norm (@var{a})} is prohibitive and an approximation
+## of calculating @code{norm (@var{A})} is prohibitive and an approximation
 ## to the 2-norm is acceptable.
 ##
 ## @var{tol} is the tolerance to which the 2-norm is calculated.  By default
--- a/scripts/linear-algebra/null.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/null.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,15 +18,15 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} null (@var{a}, @var{tol})
-## Return an orthonormal basis of the null space of @var{a}.
+## @deftypefn {Function File} {} null (@var{A}, @var{tol})
+## Return an orthonormal basis of the null space of @var{A}.
 ##
 ## The dimension of the null space is taken as the number of singular
-## values of @var{a} not greater than @var{tol}.  If the argument @var{tol}
+## values of @var{A} not greater than @var{tol}.  If the argument @var{tol}
 ## is missing, it is computed as
 ##
 ## @example
-## max (size (@var{a})) * max (svd (@var{a})) * eps
+## max (size (@var{A})) * max (svd (@var{A})) * eps
 ## @end example
 ## @seealso{orth}
 ## @end deftypefn
--- a/scripts/linear-algebra/orth.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/orth.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,15 +18,15 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} orth (@var{a}, @var{tol})
-## Return an orthonormal basis of the range space of @var{a}.
+## @deftypefn {Function File} {} orth (@var{A}, @var{tol})
+## Return an orthonormal basis of the range space of @var{A}.
 ##
 ## The dimension of the range space is taken as the number of singular
-## values of @var{a} greater than @var{tol}.  If the argument @var{tol} is
+## values of @var{A} greater than @var{tol}.  If the argument @var{tol} is
 ## missing, it is computed as
 ##
 ## @example
-## max (size (@var{a})) * max (svd (@var{a})) * eps
+## max (size (@var{A})) * max (svd (@var{A})) * eps
 ## @end example
 ## @seealso{null}
 ## @end deftypefn
--- a/scripts/linear-algebra/rank.m	Sun Jan 09 12:41:21 2011 -0800
+++ b/scripts/linear-algebra/rank.m	Sun Jan 09 13:44:15 2011 -0800
@@ -18,19 +18,19 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} rank (@var{a}, @var{tol})
-## Compute the rank of @var{a}, using the singular value decomposition.
-## The rank is taken to be the number of singular values of @var{a} that
+## @deftypefn {Function File} {} rank (@var{A}, @var{tol})
+## Compute the rank of @var{A}, using the singular value decomposition.
+## The rank is taken to be the number of singular values of @var{A} that
 ## are greater than the specified tolerance @var{tol}.  If the second
 ## argument is omitted, it is taken to be
 ##
 ## @example
-## tol = max (size (@var{a})) * sigma(1) * eps;
+## tol = max (size (@var{A})) * sigma(1) * eps;
 ## @end example
 ##
 ## @noindent
 ## where @code{eps} is machine precision and @code{sigma(1)} is the largest
-## singular value of @var{a}.
+## singular value of @var{A}.
 ## @end deftypefn
 
 ## Author: jwe