59
|
1 function retval = is_symmetric (x,tol) |
|
2 |
|
3 # usage: is_symmetric (x{,tol}) |
|
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 |
|
10 if (nargin == 1 || nargin == 2) |
|
11 if ((retval = is_square (x))) |
|
12 if (nargin == 1) |
|
13 tol = eps; |
|
14 endif |
|
15 if (norm (x - x') / norm(x) > tol) |
|
16 retval = 0; |
|
17 endif |
|
18 endif |
|
19 else |
|
20 error ("usage: is_symmetric (x {,tol})"); |
|
21 endif |
|
22 |
|
23 endfunction |