home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / SEPPLOT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.2 KB  |  62 lines

  1. function sepplot(A,xy,lname,sname)
  2. %SEPPLOT Used by SEPDEMO to show the separators.
  3. % sepplot(A,xy,lname,sname): plot a mesh, a matrix, a tree, a factor,
  4. % highlighting the top-level separator.
  5. %     A:  the matrix
  6. %    xy: the xy coordinates of the mesh
  7. % lname: the text of the name of the permutation (long)
  8. % sname: the text of the name of the permutation (short)
  9.  
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. if nargin<3
  13.    lname = 'Some Ordering';
  14. end;
  15. if nargin<4
  16.    sname = lname;
  17. end;
  18.  
  19. clf
  20. subplot(2,2,1);
  21.  
  22. [n,n] = size(A);
  23. [t,q] = etree(A);
  24. A = A(q,q);
  25. xy = xy(q,:);
  26. [t,q] = etree(A);
  27. [x,y,h,s] = treelayout(t,q);
  28.  
  29. % identify the top-level separator
  30. sepvtx = n-s+1;
  31. sep = sepvtx:n;
  32.  
  33. % identify the partitions (subtrees)
  34. parts = find (t == sepvtx);
  35. parts = [1 parts+1 n+1];  % identify them by their first vertices
  36.  
  37.  
  38. highlight(A,xy,sep);
  39. title('Finite Element Mesh')
  40.  
  41. subplot(2,2,2);
  42. if s < n
  43.    spypart(A,parts);
  44. else
  45.    spy(A);
  46. end
  47. title(lname)
  48.  
  49.  
  50. subplot(2,2,3)
  51. etreeplot(A);
  52. title(['Elim Tree with ' sname])
  53.  
  54.  
  55. subplot(2,2,4)
  56. if s < n
  57.    spypart(chol(A),parts);
  58. else
  59.    spy(chol(A));
  60. end
  61. title(['Factor with ' sname]);
  62.