diff liboctave/COLAMD/colamd.m @ 5438:49ff3dd744ee

[project @ 2005-09-04 12:25:21 by dbateman]
author dbateman
date Sun, 04 Sep 2005 12:25:21 +0000
parents 57077d0ddc8e
children
line wrap: on
line diff
--- a/liboctave/COLAMD/colamd.m
+++ b/liboctave/COLAMD/colamd.m
@@ -1,25 +1,70 @@
 function [p,stats] = colamd (S, knobs)
 %COLAMD Column approximate minimum degree permutation.
-%    P = COLAMD (S) returns the column approximate minimum degree permutation
-%    vector for the sparse matrix S.  For a non-symmetric matrix S, S (:,P)
+%    P = COLAMD(S) returns the column approximate minimum degree permutation
+%    vector for the sparse matrix S.  For a non-symmetric matrix S, S(:,P)
 %    tends to have sparser LU factors than S.  The Cholesky factorization of
-%    S (:,P)' * S (:,P) also tends to be sparser than that of S'*S.  COLAMD
-%    tends to be faster than COLMMD and tends to return a better ordering.
+%    S(:,P)'*S(:,P) also tends to be sparser than that of S'*S.  The ordering
+%    is followed by a column elimination tree post-ordering.
 %
-%    See also COLMMD, COLPERM, SPPARMS, SYMAMD, SYMMMD, SYMRCM.
+%    See also AMD, CCOLAMD, CSYMAMD, SYMAMD, COLPERM, SYMRCM.
 %
 %    Usage:  P = colamd (S)
-%            P = colamd (S, knobs)
-%            [P, stats] = colamd (S)
 %            [P, stats] = colamd (S, knobs)
 %
-%    knobs is an optional two-element input vector.  If S is m-by-n, then
-%    rows with more than (knobs (1))*n entries are ignored.  Columns with
-%    more than (knobs (2))*m entries are removed prior to ordering, and
-%    ordered last in the output permutation P.  If the knobs parameter is not
-%    present, then 0.5 is used instead, for both knobs (1) and knobs (2). 
-%    knobs (3) controls the printing of statistics and error messages.
+%    knobs is an optional one- to three-element input vector.  If S is m-by-n,
+%    then rows with more than max(16,knobs(1)*sqrt(n)) entries are ignored.
+%    Columns with more than max(16,knobs(2)*sqrt(min(m,n))) entries are
+%    removed prior to ordering, and ordered last in the output permutation P.
+%    Only completely dense rows or columns are removed if knobs(1) and knobs(2)
+%    are < 0, respectively.  If knobs(3) is nonzero, stats and knobs are
+%    printed.  The default is knobs = [10 10 0].  Note that knobs differs from
+%    earlier versions of colamd.
+%
+%    Type the command "type colamd" for a description of the optional stats
+%    output and for the copyright information.
+%
+%    Authors: S. Larimore and T. Davis, University of Florida.  Developed in
+%       collaboration with J. Gilbert and E. Ng.  Version 2.4.
+%
+%    Acknowledgements: This work was supported by the National Science
+%       Foundation, under grants DMS-9504974 and DMS-9803599.
+
+%    Notice:
+%
+%	Copyright (c) 1998-2005, Timothy A. Davis, All Rights Reserved.
+%
+%       See http://www.cise.ufl.edu/research/sparse/colamd (the colamd.c
+%       file) for the License.
+%
+%    Availability:
 %
+%       The colamd, symamd, amd, ccolamd, and csymamd are available at
+%       http://www.cise.ufl.edu/research/sparse
+
+%-------------------------------------------------------------------------------
+% Perform the colamd ordering:
+%-------------------------------------------------------------------------------
+
+if (nargout <= 1 && nargin == 1)
+    p = colamdmex (S) ;
+elseif (nargout <= 1 && nargin == 2)
+    p = colamdmex (S, knobs) ;
+elseif (nargout == 2 && nargin == 1)
+    [p, stats] = colamdmex (S) ;
+elseif (nargout == 2 && nargin == 2)
+    [p, stats] = colamdmex (S, knobs) ;
+else
+    error ('MATLAB:colamd:WrongInputOrOutputNumber',...
+           'colamd:  incorrect number of input and/or output arguments') ;
+end
+
+%-------------------------------------------------------------------------------
+% column elimination tree post-ordering:
+%-------------------------------------------------------------------------------
+
+[ignore, q] = sparsfun ('coletree', S (:,p)) ;
+p = p (q) ;
+
 %    stats is an optional 20-element output vector that provides data about the
 %    ordering and the validity of the input matrix S.  Ordering statistics are
 %    in stats (1:3).  stats (1) and stats (2) are the number of dense or empty
@@ -50,60 +95,4 @@
 %
 %    stats (8:20) is always zero in the current version of COLAMD (reserved
 %    for future use).
-%
-%    The ordering is followed by a column elimination tree post-ordering.
-%
-%    Authors:
-%
-%	The authors of the code itself are Stefan I. Larimore and Timothy A.
-%	Davis (davis@cise.ufl.edu), University of Florida.  The algorithm was
-%	developed in collaboration with John Gilbert, Xerox PARC, and Esmond
-%	Ng, Oak Ridge National Laboratory.
-%
-%    Date:
-%
-%	September 8, 2003.  Version 2.3.
-%
-%    Acknowledgements:
-%
-%	This work was supported by the National Science Foundation, under
-%	grants DMS-9504974 and DMS-9803599.
 
-%    Notice:
-%
-%	Copyright (c) 1998-2003 by the University of Florida.
-%	All Rights Reserved.
-%
-%	See http://www.cise.ufl.edu/research/sparse/colamd (the colamd.c
-%	file) for the License.
-%
-%    Availability:
-%
-%	The colamd/symamd library is available at
-%
-%	    http://www.cise.ufl.edu/research/sparse/colamd/
-%
-
-%-------------------------------------------------------------------------------
-% Perform the colamd ordering:
-%-------------------------------------------------------------------------------
-
-if (nargout <= 1 & nargin == 1)
-    p = colamdmex (S) ;
-elseif (nargout <= 1 & nargin == 2)
-    p = colamdmex (S, knobs) ;
-elseif (nargout == 2 & nargin == 1)
-    [p, stats] = colamdmex (S) ;
-elseif (nargout == 2 & nargin == 2)
-    [p, stats] = colamdmex (S, knobs) ;
-else
-    error ('colamd:  incorrect number of input and/or output arguments') ;
-end
-
-%-------------------------------------------------------------------------------
-% column elimination tree post-ordering:
-%-------------------------------------------------------------------------------
-
-[ignore, q] = sparsfun ('coletree', S (:,p)) ;
-p = p (q) ;
-