diff scripts/linear-algebra/issymmetric.m @ 18921:d0d0858cfab1

doc: Match docstring variable names to function variable names for linear-algebra m-files. * isbanded.m, isdefinite.m, isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m: Use 'A' for input matrix in linear algebra routines. Change docstrings from 'x' to 'A'.
author Rik <rik@octave.org>
date Mon, 14 Jul 2014 08:54:45 -0700
parents 9cf6d5868d21
children
line wrap: on
line diff
--- a/scripts/linear-algebra/issymmetric.m	Sun Jul 13 21:25:47 2014 -0700
+++ b/scripts/linear-algebra/issymmetric.m	Mon Jul 14 08:54:45 2014 -0700
@@ -18,12 +18,14 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {} issymmetric (@var{x})
-## @deftypefnx {Function File} {} issymmetric (@var{x}, @var{tol})
-## Return true if @var{x} is a symmetric matrix within the tolerance specified
-## by @var{tol}.  The default tolerance is zero (uses faster code).
-## Matrix @var{x} is considered symmetric if
-## @code{norm (@var{x} - @var{x}.', Inf) / norm (@var{x}, Inf) < @var{tol}}.
+## @deftypefn  {Function File} {} issymmetric (@var{A})
+## @deftypefnx {Function File} {} issymmetric (@var{A}, @var{tol})
+## Return true if @var{A} is a symmetric matrix within the tolerance specified
+## by @var{tol}.
+##
+## The default tolerance is zero (uses faster code).
+## Matrix @var{A} is considered symmetric if
+## @code{norm (@var{A} - @var{A}.', Inf) / norm (@var{A}, Inf) < @var{tol}}.
 ## @seealso{ishermitian, isdefinite}
 ## @end deftypefn
 
@@ -31,20 +33,20 @@
 ## Created: August 1993
 ## Adapted-By: jwe
 
-function retval = issymmetric (x, tol = 0)
+function retval = issymmetric (A, tol = 0)
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
   endif
 
-  retval = (isnumeric (x) || islogical (x)) && issquare (x);
+  retval = (isnumeric (A) || islogical (A)) && issquare (A);
   if (retval)
     if (tol == 0)
       ## Handle large sparse matrices as well as full ones
-      retval = nnz (x != x.') == 0;
+      retval = nnz (A != A.') == 0;
     else
-      norm_x = norm (x, inf);
-      retval = norm_x == 0 || norm (x - x.', inf) / norm_x <= tol;
+      norm_x = norm (A, inf);
+      retval = norm_x == 0 || norm (A - A.', inf) / norm_x <= tol;
     endif
   endif