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

  1. function [p,q] = etree(A,f)
  2. %ETREE    Elimination tree of a matrix.
  3. %    p = etree(A) returns an elimination tree for the square
  4. %    symmetric matrix whose upper triangle is that of A.
  5. %    p(j) is the parent of column j in the tree, 
  6. %    or 0 if j is a root.
  7. %
  8. %    p = etree(A,'col') returns the elimination tree of A'*A.
  9. %    p = etree(A,'sym') is the same as p = etree(A).
  10. %
  11. %    [p,q] = etree(...) also returns a postorder permutation q on the tree.
  12. %
  13. %    See also TREELAYOUT, TREEPLOT, ETREEPLOT.
  14.  
  15. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  16.  
  17. if nargin <= 1,
  18.     [p,q] = sparsfun('symetree',A);
  19. elseif f(1) == 's' | f(1) == 'S',
  20.     [p,q] = sparsfun('symetree',A);
  21. elseif f(1) == 'c' | f(1) == 'C',
  22.     [p,q] = sparsfun('coletree',A);
  23. else 
  24.     error ('Second input argument must be ''sym'' or ''col''');
  25. end
  26.