59
|
1 function retval = is_symmetric (x,tol) |
|
2 |
73
|
3 # Usage: is_symmetric (x {,tol}) |
59
|
4 # |
|
5 # If x is symmetric, return the dimension of x, otherwise, return 0. |
|
6 # |
|
7 # See also: size, rows, columns, length, is_matrix, is_scalar, |
|
8 # is_square, is_vector |
|
9 |
73
|
10 # Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. |
|
11 |
59
|
12 if (nargin == 1 || nargin == 2) |
|
13 if ((retval = is_square (x))) |
|
14 if (nargin == 1) |
|
15 tol = eps; |
|
16 endif |
|
17 if (norm (x - x') / norm(x) > tol) |
|
18 retval = 0; |
|
19 endif |
|
20 endif |
|
21 else |
|
22 error ("usage: is_symmetric (x {,tol})"); |
|
23 endif |
|
24 |
|
25 endfunction |