time | calls | line |
---|
| | 1 | function [p, varargout] = symamd (S, varargin)
|
| | 2 | %SYMAMD Symmetric approximate minimum degree permutation.
|
| | 3 | % P = SYMAMD(S) for a symmetric positive definite matrix S, returns the
|
| | 4 | % permutation vector p such that S(p,p) tends to have a sparser Cholesky
|
| | 5 | % factor than S. Sometimes SYMAMD works well for symmetric indefinite
|
| | 6 | % matrices too. The matrix S is assumed to be symmetric; only the
|
| | 7 | % strictly lower triangular part is referenced. S must be square.
|
| | 8 | % Note that p = amd(S) is much faster and generates comparable orderings.
|
| | 9 | % The ordering is followed by an elimination tree post-ordering.
|
| | 10 | %
|
| | 11 | % Usage: P = symamd (S)
|
| | 12 | % [P, stats] = symamd (S, knobs)
|
| | 13 | %
|
| | 14 | % knobs is an optional one- to two-element input vector. If S is n-by-n,
|
| | 15 | % then rows and columns with more than max(16,knobs(1)*sqrt(n)) entries are
|
| | 16 | % removed prior to ordering, and ordered last in the output permutation P.
|
| | 17 | % No rows/columns are removed if knobs(1)<0. If knobs(2) is nonzero, stats
|
| | 18 | % and knobs are printed. The default is knobs = [10 0]. Note that knobs
|
| | 19 | % differs from earlier versions of symamd.
|
| | 20 | %
|
| | 21 | % Type the command "type symamd" for a description of the optional stats
|
| | 22 | % output and for the copyright information.
|
| | 23 | %
|
| | 24 | % Authors: S. Larimore and T. Davis, University of Florida. Developed in
|
| | 25 | % collaboration with J. Gilbert and E. Ng. Version 2.5.
|
| | 26 | %
|
| | 27 | % Acknowledgements: This work was supported by the National Science
|
| | 28 | % Foundation, under grants DMS-9504974 and DMS-9803599.
|
| | 29 | %
|
| | 30 | % See also AMD, COLAMD, COLPERM, SYMRCM.
|
| | 31 |
|
| | 32 | % Used by permission of the Copyright holder. This version has been modified
|
| | 33 | % by The MathWorks, Inc. and their revision information is below:
|
| | 34 | %
|
| | 35 | % Additional Notice from the original authors is below:
|
| | 36 | % Notice:
|
| | 37 | %
|
| | 38 | % Copyright (c) 1998-2006, Timothy A. Davis, All Rights Reserved.
|
| | 39 | %
|
| | 40 | % Availability:
|
| | 41 | %
|
| | 42 | % colamd and symamd are available at
|
| | 43 | % http://www.cise.ufl.edu/research/sparse
|
| | 44 |
|
| | 45 | %-------------------------------------------------------------------------------
|
| | 46 | % perform the symamd ordering:
|
| | 47 | %-------------------------------------------------------------------------------
|
| | 48 |
|
0.17 | 4 | 49 | [p, varargout{1:nargout-1}] = symamdmex(S, varargin{:});
|
| | 50 |
|
| | 51 | %-------------------------------------------------------------------------------
|
| | 52 | % symmetric elimination tree post-ordering:
|
| | 53 | %-------------------------------------------------------------------------------
|
| | 54 |
|
0.05 | 4 | 55 | [~, q] = etree(S(p,p));
|
| 4 | 56 | p = p(q);
|