home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SPARFUN.DI$ / SYMBFACT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.4 KB  |  45 lines

  1. function [count,h,parent,post,R] = symbfact(A,f)
  2. %SYMBFACT Symbolic factorization analysis.
  3. %
  4. %    count = SYMBFACT(A) returns the vector of row counts for the upper
  5. %    triangular Cholesky factor of a symmetric matrix whose upper triangle 
  6. %    is that of A, assuming no cancellation during the factorization.  
  7. %    This routine should be much faster than chol(A).
  8. %
  9. %    count = SYMBFACT(A,'col') analyzes A'*A (without forming it explicitly).
  10. %    count = SYMBFACT(A,'sym') is the same as p = symbfact(A).
  11. %
  12. %    There are several optional return values:
  13. %
  14. %    [count,h,parent,post,R] = symbfact(...) also returns
  15. %         the height of the elimination tree,
  16. %         the elimination tree itself,
  17. %         a postordering permutation of the elimination tree,
  18. %         and a 0-1 matrix R whose structure is that of chol(A).
  19. %
  20. %    See also CHOL, ETREE, TREELAYOUT.
  21.  
  22. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  23.  
  24. if nargin <= 1,
  25.     op = 'symanalyze';
  26. elseif f(1) == 's' | f(1) == 'S',
  27.     op = 'symanalyze';
  28. elseif f(1) == 'c' | f(1) == 'C',
  29.     op = 'colanalyze';
  30. else 
  31.     error ('Second argument must be ''sym'' or ''col''');
  32. end
  33.  
  34. if     nargout <= 1
  35.   count = sparsfun(op,A);
  36. elseif nargout == 2
  37.   [count,h] = sparsfun(op,A);
  38. elseif nargout == 3
  39.   [count,h,parent] = sparsfun(op,A);
  40. elseif nargout == 4
  41.   [count,h,parent,post] = sparsfun(op,A);
  42. elseif nargout == 5
  43.   [count,h,parent,post,R] = sparsfun(op,A);
  44. end
  45.