view scripts/general/is_symmetric.m @ 59:2d10ab3ee69d

[project @ 1993-08-13 20:09:16 by jwe] Initial revision
author jwe
date Fri, 13 Aug 1993 20:09:16 +0000
parents
children f3c9042fd609
line wrap: on
line source

function retval = is_symmetric (x,tol)

# usage: is_symmetric (x{,tol})
#
# If x is symmetric, return the dimension of x, otherwise, return 0.
#
# See also: size, rows, columns, length, is_matrix, is_scalar, 
# is_square, is_vector

  if (nargin == 1 || nargin == 2)
    if ((retval = is_square (x)))
      if (nargin == 1)
	tol = eps;
      endif
      if (norm (x - x') / norm(x) > tol)
        retval = 0;
      endif
    endif
  else
    error ("usage: is_symmetric (x {,tol})");
  endif

endfunction