1function result = get_symmetry (A,quick) 2%GET_SYMMETRY: does the same thing as the spsym mexFunction. 3% It's just a lot slower and uses much more memory. This function 4% is meant for testing and documentation only. 5[m n] = size (A) ; 6if (m ~= n) 7 result = 1 ; % rectangular 8 return 9end 10if (nargin < 2) 11 quick = 0 ; 12end 13d = diag (A) ; 14posdiag = all (real (d) > 0) & all (imag (d) == 0) ; 15if (quick & ~posdiag) 16 result = 2 ; % Not a candidate for sparse Cholesky. 17elseif (~isreal (A) & nnz (A-A') == 0) 18 if (posdiag) 19 result = 7 ; % complex Hermitian, with positive diagonal 20 else 21 result = 4 ; % complex Hermitian, nonpositive diagonal 22 end 23elseif (nnz (A-A.') == 0) 24 if (posdiag) 25 result = 6 ; % symmetric with positive diagonal 26 else 27 result = 3 ; % symmetric, nonpositive diagonal 28 end 29elseif (nnz (A+A.') == 0) 30 result = 5 ; % skew symmetric 31else 32 result = 2 ; % unsymmetric 33end 34 35