comparison scripts/linear-algebra/ishermitian.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 d63878346099
children
comparison
equal deleted inserted replaced
18920:c4def7ab39e7 18921:d0d0858cfab1
16 ## You should have received a copy of the GNU General Public License 16 ## You should have received a copy of the GNU General Public License
17 ## along with Octave; see the file COPYING. If not, see 17 ## along with Octave; see the file COPYING. If not, see
18 ## <http://www.gnu.org/licenses/>. 18 ## <http://www.gnu.org/licenses/>.
19 19
20 ## -*- texinfo -*- 20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {} ishermitian (@var{x}) 21 ## @deftypefn {Function File} {} ishermitian (@var{A})
22 ## @deftypefnx {Function File} {} ishermitian (@var{x}, @var{tol}) 22 ## @deftypefnx {Function File} {} ishermitian (@var{A}, @var{tol})
23 ## Return true if @var{x} is Hermitian within the tolerance specified by 23 ## Return true if @var{A} is Hermitian within the tolerance specified by
24 ## @var{tol}. 24 ## @var{tol}.
25 ##
25 ## The default tolerance is zero (uses faster code). 26 ## The default tolerance is zero (uses faster code).
26 ## Matrix @var{x} is considered symmetric if 27 ## Matrix @var{A} is considered symmetric if
27 ## @code{norm (@var{x} - @var{x}', Inf) / norm (@var{x}, Inf) < @var{tol}}. 28 ## @code{norm (@var{A} - @var{A}', Inf) / norm (@var{A}, Inf) < @var{tol}}.
28 ## @seealso{issymmetric, isdefinite} 29 ## @seealso{issymmetric, isdefinite}
29 ## @end deftypefn 30 ## @end deftypefn
30 31
31 ## Author: A. S. Hodel <scotte@eng.auburn.edu> 32 ## Author: A. S. Hodel <scotte@eng.auburn.edu>
32 ## Created: August 1993 33 ## Created: August 1993
33 ## Adapted-By: jwe 34 ## Adapted-By: jwe
34 35
35 function retval = ishermitian (x, tol = 0) 36 function retval = ishermitian (A, tol = 0)
36 37
37 if (nargin < 1 || nargin > 2) 38 if (nargin < 1 || nargin > 2)
38 print_usage (); 39 print_usage ();
39 endif 40 endif
40 41
41 retval = isnumeric (x) && issquare (x); 42 retval = isnumeric (A) && issquare (A);
42 if (retval) 43 if (retval)
43 if (tol == 0) 44 if (tol == 0)
44 retval = all ((x == x')(:)); 45 retval = all ((A == A')(:));
45 else 46 else
46 norm_x = norm (x, inf); 47 norm_x = norm (A, inf);
47 retval = norm_x == 0 || norm (x - x', inf) / norm_x <= tol; 48 retval = norm_x == 0 || norm (A - A', inf) / norm_x <= tol;
48 endif 49 endif
49 endif 50 endif
50 51
51 endfunction 52 endfunction
52 53