diff src/DLD-FUNCTIONS/colamd.cc @ 11553:01f703952eff

Improve docstrings for functions in DLD-FUNCTIONS directory. Use same variable names in error() strings and in documentation.
author Rik <octave@nomad.inbox5.com>
date Sun, 16 Jan 2011 22:13:23 -0800
parents fd0a3ac60b0e
children 12df7854fa7c
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/colamd.cc	Sat Jan 15 15:13:06 2011 -0800
+++ b/src/DLD-FUNCTIONS/colamd.cc	Sun Jan 16 22:13:23 2011 -0800
@@ -210,37 +210,37 @@
 
 DEFUN_DLD (colamd, args, nargout,
     "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{p} =} colamd (@var{s})\n\
-@deftypefnx {Loadable Function} {@var{p} =} colamd (@var{s}, @var{knobs})\n\
-@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} colamd (@var{s})\n\
-@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} colamd (@var{s}, @var{knobs})\n\
+@deftypefn  {Loadable Function} {@var{p} =} colamd (@var{S})\n\
+@deftypefnx {Loadable Function} {@var{p} =} colamd (@var{S}, @var{knobs})\n\
+@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} colamd (@var{S})\n\
+@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} colamd (@var{S}, @var{knobs})\n\
 \n\
 Column approximate minimum degree permutation.\n\
-@code{@var{p} = colamd (@var{s})} returns the column approximate minimum\n\
-degree permutation vector for the sparse matrix @var{s}.  For a\n\
-non-symmetric matrix @var{s}, @code{@var{s} (:,@var{p})} tends to have\n\
-sparser LU factors than @var{s}.  The Cholesky factorization of\n\
-@code{@var{s}(:,@var{p})' * @var{s} (:,@var{p})} also tends to be sparser\n\
-than that of @code{@var{s}' * @var{s}}.\n\
+@code{@var{p} = colamd (@var{S})} returns the column approximate minimum\n\
+degree permutation vector for the sparse matrix @var{S}.  For a\n\
+non-symmetric matrix @var{S}, @code{@var{S}(:,@var{p})} tends to have\n\
+sparser LU@tie{}factors than @var{S}.  The Cholesky@tie{}factorization of\n\
+@code{@var{S}(:,@var{p})' * @var{S}(:,@var{p})} also tends to be sparser\n\
+than that of @code{@var{S}' * @var{S}}.\n\
 \n\
-@var{knobs} is an optional one- to three-element input vector.  If @var{s} is\n\
+@var{knobs} is an optional one- to three-element input vector.  If @var{S} is\n\
 m-by-n, then rows with more than @code{max(16,@var{knobs}(1)*sqrt(n))}\n\
 entries are ignored.  Columns with more than\n\
-@code{max(16,knobs(2)*sqrt(min(m,n)))} entries are removed prior to\n\
+@code{max(16,@var{knobs}(2)*sqrt(min(m,n)))} entries are removed prior to\n\
 ordering, and ordered last in the output permutation @var{p}.  Only\n\
-completely dense rows or columns are removed if @code{@var{knobs} (1)} and\n\
-@code{@var{knobs} (2)} are < 0, respectively.  If @code{@var{knobs} (3)} is\n\
+completely dense rows or columns are removed if @code{@var{knobs}(1)} and\n\
+@code{@var{knobs}(2)} are < 0, respectively.  If @code{@var{knobs}(3)} is\n\
 nonzero, @var{stats} and @var{knobs} are printed.  The default is\n\
 @code{@var{knobs} = [10 10 0]}.  Note that @var{knobs} differs from earlier\n\
 versions of colamd\n\
 \n\
 @var{stats} is an optional 20-element output vector that provides data\n\
-about the ordering and the validity of the input matrix @var{s}.  Ordering\n\
-statistics are in @code{@var{stats} (1:3)}.  @code{@var{stats} (1)} and\n\
-@code{@var{stats} (2)} are the number of dense or empty rows and columns\n\
-ignored by @sc{colamd} and @code{@var{stats} (3)} is the number of garbage\n\
+about the ordering and the validity of the input matrix @var{S}.  Ordering\n\
+statistics are in @code{@var{stats}(1:3)}.  @code{@var{stats}(1)} and\n\
+@code{@var{stats}(2)} are the number of dense or empty rows and columns\n\
+ignored by @sc{colamd} and @code{@var{stats}(3)} is the number of garbage\n\
 collections performed on the internal data structure used by @sc{colamd}\n\
-(roughly of size @code{2.2 * nnz(@var{s}) + 4 * @var{m} + 7 * @var{n}}\n\
+(roughly of size @code{2.2 * nnz(@var{S}) + 4 * @var{m} + 7 * @var{n}}\n\
 integers).\n\
 \n\
 Octave built-in functions are intended to generate valid sparse matrices,\n\
@@ -251,20 +251,20 @@
 more times in the same column) or if the row indices in a column are out\n\
 of order, then @sc{colamd} can correct these errors by ignoring the duplicate\n\
 entries and sorting each column of its internal copy of the matrix\n\
-@var{s} (the input matrix @var{s} is not repaired, however).  If a matrix\n\
+@var{S} (the input matrix @var{S} is not repaired, however).  If a matrix\n\
 is invalid in other ways then @sc{colamd} cannot continue, an error message\n\
 is printed, and no output arguments (@var{p} or @var{stats}) are returned.\n\
 @sc{colamd} is thus a simple way to check a sparse matrix to see if it's\n\
 valid.\n\
 \n\
-@code{@var{stats} (4:7)} provide information if COLAMD was able to\n\
-continue.  The matrix is OK if @code{@var{stats} (4)} is zero, or 1 if\n\
-invalid.  @code{@var{stats} (5)} is the rightmost column index that is\n\
+@code{@var{stats}(4:7)} provide information if COLAMD was able to\n\
+continue.  The matrix is OK if @code{@var{stats}(4)} is zero, or 1 if\n\
+invalid.  @code{@var{stats}(5)} is the rightmost column index that is\n\
 unsorted or contains duplicate entries, or zero if no such column exists.\n\
-@code{@var{stats} (6)} is the last seen duplicate or out-of-order row\n\
-index in the column index given by @code{@var{stats} (5)}, or zero if no\n\
-such row index exists.  @code{@var{stats} (7)} is the number of duplicate\n\
-or out-of-order row indices.  @code{@var{stats} (8:20)} is always zero in\n\
+@code{@var{stats}(6)} is the last seen duplicate or out-of-order row\n\
+index in the column index given by @code{@var{stats}(5)}, or zero if no\n\
+such row index exists.  @code{@var{stats}(7)} is the number of duplicate\n\
+or out-of-order row indices.  @code{@var{stats}(8:20)} is always zero in\n\
 the current version of @sc{colamd} (reserved for future use).\n\
 \n\
 The ordering is followed by a column elimination tree post-ordering.\n\
@@ -274,7 +274,7 @@
 developed in collaboration with John Gilbert, Xerox PARC, and Esmond\n\
 Ng, Oak Ridge National Laboratory.  (see\n\
 @url{http://www.cise.ufl.edu/research/sparse/colamd})\n\
-@seealso{colperm, symamd}\n\
+@seealso{colperm, symamd, ccolamd}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -450,19 +450,19 @@
 
 DEFUN_DLD (symamd, args, nargout,
     "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{p} =} symamd (@var{s})\n\
-@deftypefnx {Loadable Function} {@var{p} =} symamd (@var{s}, @var{knobs})\n\
-@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} symamd (@var{s})\n\
-@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} symamd (@var{s}, @var{knobs})\n\
+@deftypefn  {Loadable Function} {@var{p} =} symamd (@var{S})\n\
+@deftypefnx {Loadable Function} {@var{p} =} symamd (@var{S}, @var{knobs})\n\
+@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} symamd (@var{S})\n\
+@deftypefnx {Loadable Function} {[@var{p}, @var{stats}] =} symamd (@var{S}, @var{knobs})\n\
 \n\
-For a symmetric positive definite matrix @var{s}, returns the permutation\n\
-vector p such that @code{@var{s} (@var{p}, @var{p})} tends to have a\n\
-sparser Cholesky factor than @var{s}.  Sometimes SYMAMD works well for\n\
-symmetric indefinite matrices too.  The matrix @var{s} is assumed to be\n\
-symmetric; only the strictly lower triangular part is referenced.  @var{s}\n\
-must be square.\n\
+For a symmetric positive definite matrix @var{S}, returns the permutation\n\
+vector p such that @code{@var{S}(@var{p}, @var{p})} tends to have a\n\
+sparser Cholesky@tie{}factor than @var{S}.  Sometimes @code{symamd} works\n\
+well for symmetric indefinite matrices too.  The matrix @var{S} is assumed\n\
+to be symmetric; only the strictly lower triangular part is referenced.  \n\
+@var{S} must be square.\n\
 \n\
-@var{knobs} is an optional one- to two-element input vector.  If @var{s} is\n\
+@var{knobs} is an optional one- to two-element input vector.  If @var{S} is\n\
 n-by-n, then rows and columns with more than\n\
 @code{max(16,@var{knobs}(1)*sqrt(n))} entries are removed prior to ordering,\n\
 and ordered last in the output permutation @var{p}.  No rows/columns are\n\
@@ -471,12 +471,12 @@
 = [10 0]}.  Note that @var{knobs} differs from earlier versions of symamd.\n\
 \n\
 @var{stats} is an optional 20-element output vector that provides data\n\
-about the ordering and the validity of the input matrix @var{s}.  Ordering\n\
-statistics are in @code{@var{stats} (1:3)}.  @code{@var{stats} (1) =\n\
-@var{stats} (2)} is the number of dense or empty rows and columns\n\
-ignored by SYMAMD and @code{@var{stats} (3)} is the number of garbage\n\
+about the ordering and the validity of the input matrix @var{S}.  Ordering\n\
+statistics are in @code{@var{stats}(1:3)}.  @code{@var{stats}(1) =\n\
+@var{stats}(2)} is the number of dense or empty rows and columns\n\
+ignored by SYMAMD and @code{@var{stats}(3)} is the number of garbage\n\
 collections performed on the internal data structure used by SYMAMD\n\
-(roughly of size @code{8.4 * nnz (tril (@var{s}, -1)) + 9 * @var{n}}\n\
+(roughly of size @code{8.4 * nnz (tril (@var{S}, -1)) + 9 * @var{n}}\n\
 integers).\n\
 \n\
 Octave built-in functions are intended to generate valid sparse matrices,\n\
@@ -492,19 +492,18 @@
 no output arguments (@var{p} or @var{stats}) are returned.  SYMAMD is\n\
 thus a simple way to check a sparse matrix to see if it's valid.\n\
 \n\
-@code{@var{stats} (4:7)} provide information if SYMAMD was able to\n\
+@code{@var{stats}(4:7)} provide information if SYMAMD was able to\n\
 continue.  The matrix is OK if @code{@var{stats} (4)} is zero, or 1\n\
-if invalid.  @code{@var{stats} (5)} is the rightmost column index that\n\
+if invalid.  @code{@var{stats}(5)} is the rightmost column index that\n\
 is unsorted or contains duplicate entries, or zero if no such column\n\
-exists.  @code{@var{stats} (6)} is the last seen duplicate or out-of-order\n\
-row index in the column index given by @code{@var{stats} (5)}, or zero\n\
-if no such row index exists.  @code{@var{stats} (7)} is the number of\n\
-duplicate or out-of-order row indices.  @code{@var{stats} (8:20)} is\n\
+exists.  @code{@var{stats}(6)} is the last seen duplicate or out-of-order\n\
+row index in the column index given by @code{@var{stats}(5)}, or zero\n\
+if no such row index exists.  @code{@var{stats}(7)} is the number of\n\
+duplicate or out-of-order row indices.  @code{@var{stats}(8:20)} is\n\
 always zero in the current version of SYMAMD (reserved for future use).\n\
 \n\
 The ordering is followed by a column elimination tree post-ordering.\n\
 \n\
-\n\
 The authors of the code itself are Stefan I. Larimore and Timothy A.\n\
 Davis @email{davis@@cise.ufl.edu}, University of Florida.  The algorithm was\n\
 developed in collaboration with John Gilbert, Xerox PARC, and Esmond\n\
@@ -587,7 +586,7 @@
 
       if (n_row != n_col)
         {
-          error ("symamd: matrix must be square");
+          error ("symamd: matrix S must be square");
           return retval;
         }
 
@@ -647,17 +646,17 @@
 
 DEFUN_DLD (etree, args, nargout,
     "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{p} =} etree (@var{s})\n\
-@deftypefnx {Loadable Function} {@var{p} =} etree (@var{s}, @var{typ})\n\
-@deftypefnx {Loadable Function} {[@var{p}, @var{q}] =} etree (@var{s}, @var{typ})\n\
+@deftypefn  {Loadable Function} {@var{p} =} etree (@var{S})\n\
+@deftypefnx {Loadable Function} {@var{p} =} etree (@var{S}, @var{typ})\n\
+@deftypefnx {Loadable Function} {[@var{p}, @var{q}] =} etree (@var{S}, @var{typ})\n\
 \n\
-Returns the elimination tree for the matrix @var{s}.  By default @var{s}\n\
+Returns the elimination tree for the matrix @var{S}.  By default @var{S}\n\
 is assumed to be symmetric and the symmetric elimination tree is\n\
 returned.  The argument @var{typ} controls whether a symmetric or\n\
 column elimination tree is returned.  Valid values of @var{typ} are\n\
 'sym' or 'col', for symmetric or column elimination tree respectively\n\
 \n\
-Called with a second argument, @dfn{etree} also returns the postorder\n\
+Called with a second argument, @code{etree} also returns the postorder\n\
 permutations on the tree.\n\
 @end deftypefn")
 {
@@ -699,7 +698,7 @@
         }
       else
         {
-          error ("etree: must be called with a sparse matrix");
+          error ("etree: S must be a sparse matrix");
           return retval;
         }
 
@@ -713,7 +712,7 @@
             }
           else
             {
-              error ("etree: second argument must be a string");
+              error ("etree: TYP must be a string");
               return retval;
             }
         }
@@ -725,7 +724,7 @@
         {
           if (n_row != n_col)
             {
-              error ("etree: matrix is marked as symmetric, but not square");
+              error ("etree: S is marked as symmetric, but is not square");
               return retval;
             }