<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Mathematical Considerations (GNU Octave (version 5.1.0))</title> <meta name="description" content="Mathematical Considerations (GNU Octave (version 5.1.0))"> <meta name="keywords" content="Mathematical Considerations (GNU Octave (version 5.1.0))"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Operators-and-Functions.html#Operators-and-Functions" rel="up" title="Operators and Functions"> <link href="Sparse-Linear-Algebra.html#Sparse-Linear-Algebra" rel="next" title="Sparse Linear Algebra"> <link href="Return-Types-of-Operators-and-Functions.html#Return-Types-of-Operators-and-Functions" rel="prev" title="Return Types of Operators and Functions"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> <link rel="stylesheet" type="text/css" href="octave.css"> </head> <body lang="en"> <a name="Mathematical-Considerations"></a> <div class="header"> <p> Previous: <a href="Return-Types-of-Operators-and-Functions.html#Return-Types-of-Operators-and-Functions" accesskey="p" rel="prev">Return Types of Operators and Functions</a>, Up: <a href="Operators-and-Functions.html#Operators-and-Functions" accesskey="u" rel="up">Operators and Functions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="Mathematical-Considerations-1"></a> <h4 class="subsubsection">22.1.4.3 Mathematical Considerations</h4> <p>The attempt has been made to make sparse matrices behave in exactly the same manner as there full counterparts. However, there are certain differences and especially differences with other products sparse implementations. </p> <p>First, the <code>"./"</code> and <code>".^"</code> operators must be used with care. Consider what the examples </p> <div class="example"> <pre class="example"> s = speye (4); a1 = s .^ 2; a2 = s .^ s; a3 = s .^ -2; a4 = s ./ 2; a5 = 2 ./ s; a6 = s ./ s; </pre></div> <p>will give. The first example of <var>s</var> raised to the power of 2 causes no problems. However <var>s</var> raised element-wise to itself involves a large number of terms <code>0 .^ 0</code> which is 1. There <code><var>s</var> .^ <var>s</var></code> is a full matrix. </p> <p>Likewise <code><var>s</var> .^ -2</code> involves terms like <code>0 .^ -2</code> which is infinity, and so <code><var>s</var> .^ -2</code> is equally a full matrix. </p> <p>For the "./" operator <code><var>s</var> ./ 2</code> has no problems, but <code>2 ./ <var>s</var></code> involves a large number of infinity terms as well and is equally a full matrix. The case of <code><var>s</var> ./ <var>s</var></code> involves terms like <code>0 ./ 0</code> which is a <code>NaN</code> and so this is equally a full matrix with the zero elements of <var>s</var> filled with <code>NaN</code> values. </p> <p>The above behavior is consistent with full matrices, but is not consistent with sparse implementations in other products. </p> <p>A particular problem of sparse matrices comes about due to the fact that as the zeros are not stored, the sign-bit of these zeros is equally not stored. In certain cases the sign-bit of zero is important. For example: </p> <div class="example"> <pre class="example"> a = 0 ./ [-1, 1; 1, -1]; b = 1 ./ a ⇒ -Inf Inf Inf -Inf c = 1 ./ sparse (a) ⇒ Inf Inf Inf Inf </pre></div> <p>To correct this behavior would mean that zero elements with a negative sign-bit would need to be stored in the matrix to ensure that their sign-bit was respected. This is not done at this time, for reasons of efficiency, and so the user is warned that calculations where the sign-bit of zero is important must not be done using sparse matrices. </p> <p>In general any function or operator used on a sparse matrix will result in a sparse matrix with the same or a larger number of nonzero elements than the original matrix. This is particularly true for the important case of sparse matrix factorizations. The usual way to address this is to reorder the matrix, such that its factorization is sparser than the factorization of the original matrix. That is the factorization of <code>L * U = P * S * Q</code> has sparser terms <code>L</code> and <code>U</code> than the equivalent factorization <code>L * U = S</code>. </p> <p>Several functions are available to reorder depending on the type of the matrix to be factorized. If the matrix is symmetric positive-definite, then <em>symamd</em> or <em>csymamd</em> should be used. Otherwise <em>amd</em>, <em>colamd</em> or <em>ccolamd</em> should be used. For completeness the reordering functions <em>colperm</em> and <em>randperm</em> are also available. </p> <p>See <a href="#fig_003asimplematrix">Figure 22.3</a>, for an example of the structure of a simple positive definite matrix. </p> <div class="float"><a name="fig_003asimplematrix"></a> <div align="center"><img src="spmatrix.png" alt="spmatrix"> </div> <div class="float-caption"><p><strong>Figure 22.3: </strong>Structure of simple sparse matrix.</p></div></div> <p>The standard Cholesky factorization of this matrix can be obtained by the same command that would be used for a full matrix. This can be visualized with the command <code>r = chol (A); spy (r);</code>. See <a href="#fig_003asimplechol">Figure 22.4</a>. The original matrix had 598 nonzero terms, while this Cholesky factorization has 10200, with only half of the symmetric matrix being stored. This is a significant level of fill in, and although not an issue for such a small test case, can represents a large overhead in working with other sparse matrices. </p> <p>The appropriate sparsity preserving permutation of the original matrix is given by <em>symamd</em> and the factorization using this reordering can be visualized using the command <code>q = symamd (A); r = chol (A(q,q)); spy (r)</code>. This gives 399 nonzero terms which is a significant improvement. </p> <p>The Cholesky factorization itself can be used to determine the appropriate sparsity preserving reordering of the matrix during the factorization, In that case this might be obtained with three return arguments as <code>[r, p, q] = chol (A); spy (r)</code>. </p> <div class="float"><a name="fig_003asimplechol"></a> <div align="center"><img src="spchol.png" alt="spchol"> </div> <div class="float-caption"><p><strong>Figure 22.4: </strong>Structure of the unpermuted Cholesky factorization of the above matrix.</p></div></div> <div class="float"><a name="fig_003asimplecholperm"></a> <div align="center"><img src="spcholperm.png" alt="spcholperm"> </div> <div class="float-caption"><p><strong>Figure 22.5: </strong>Structure of the permuted Cholesky factorization of the above matrix.</p></div></div> <p>In the case of an asymmetric matrix, the appropriate sparsity preserving permutation is <em>colamd</em> and the factorization using this reordering can be visualized using the command <code>q = colamd (A); [l, u, p] = lu (A(:,q)); spy (l+u)</code>. </p> <p>Finally, Octave implicitly reorders the matrix when using the div (/) and ldiv (\) operators, and so no the user does not need to explicitly reorder the matrix to maximize performance. </p> <a name="XREFamd"></a><dl> <dt><a name="index-amd"></a><em><var>p</var> =</em> <strong>amd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-amd-1"></a><em><var>p</var> =</em> <strong>amd</strong> <em>(<var>S</var>, <var>opts</var>)</em></dt> <dd> <p>Return the approximate minimum degree permutation of a matrix. </p> <p>This is a permutation such that the Cholesky factorization of <code><var>S</var> (<var>p</var>, <var>p</var>)</code> tends to be sparser than the Cholesky factorization of <var>S</var> itself. <code>amd</code> is typically faster than <code>symamd</code> but serves a similar purpose. </p> <p>The optional parameter <var>opts</var> is a structure that controls the behavior of <code>amd</code>. The fields of the structure are </p> <dl compact="compact"> <dt><var>opts</var>.dense</dt> <dd><p>Determines what <code>amd</code> considers to be a dense row or column of the input matrix. Rows or columns with more than <code>max (16, (dense * sqrt (<var>n</var>)))</code> entries, where <var>n</var> is the order of the matrix <var>S</var>, are ignored by <code>amd</code> during the calculation of the permutation. The value of dense must be a positive scalar and the default value is 10.0 </p> </dd> <dt><var>opts</var>.aggressive</dt> <dd><p>If this value is a nonzero scalar, then <code>amd</code> performs aggressive absorption. The default is not to perform aggressive absorption. </p></dd> </dl> <p>The author of the code itself is Timothy A. Davis (see <a href="http://faculty.cse.tamu.edu/davis/suitesparse.html">http://faculty.cse.tamu.edu/davis/suitesparse.html</a>). </p> <p><strong>See also:</strong> <a href="#XREFsymamd">symamd</a>, <a href="#XREFcolamd">colamd</a>. </p></dd></dl> <a name="XREFccolamd"></a><dl> <dt><a name="index-ccolamd"></a><em><var>p</var> =</em> <strong>ccolamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-ccolamd-1"></a><em><var>p</var> =</em> <strong>ccolamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dt><a name="index-ccolamd-2"></a><em><var>p</var> =</em> <strong>ccolamd</strong> <em>(<var>S</var>, <var>knobs</var>, <var>cmember</var>)</em></dt> <dt><a name="index-ccolamd-3"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>ccolamd</strong> <em>(…)</em></dt> <dd> <p>Constrained column approximate minimum degree permutation. </p> <p><code><var>p</var> = ccolamd (<var>S</var>)</code> returns the column approximate minimum degree permutation vector for the sparse matrix <var>S</var>. For a non-symmetric matrix <var>S</var>, <code><var>S</var>(:, <var>p</var>)</code> tends to have sparser LU factors than <var>S</var>. <code>chol (<var>S</var>(:, <var>p</var>)' * <var>S</var>(:, <var>p</var>))</code> also tends to be sparser than <code>chol (<var>S</var>' * <var>S</var>)</code>. <code><var>p</var> = ccolamd (<var>S</var>, 1)</code> optimizes the ordering for <code>lu (<var>S</var>(:, <var>p</var>))</code>. The ordering is followed by a column elimination tree post-ordering. </p> <p><var>knobs</var> is an optional 1-element to 5-element input vector, with a default value of <code>[0 10 10 1 0]</code> if not present or empty. Entries not present are set to their defaults. </p> <dl compact="compact"> <dt><code><var>knobs</var>(1)</code></dt> <dd><p>if nonzero, the ordering is optimized for <code>lu (S(:, p))</code>. It will be a poor ordering for <code>chol (<var>S</var>(:, <var>p</var>)' * <var>S</var>(:, <var>p</var>))</code>. This is the most important knob for ccolamd. </p> </dd> <dt><code><var>knobs</var>(2)</code></dt> <dd><p>if <var>S</var> is m-by-n, rows with more than <code>max (16, <var>knobs</var>(2) * sqrt (n))</code> entries are ignored. </p> </dd> <dt><code><var>knobs</var>(3)</code></dt> <dd><p>columns with more than <code>max (16, <var>knobs</var>(3) * sqrt (min (<var>m</var>, <var>n</var>)))</code> entries are ignored and ordered last in the output permutation (subject to the cmember constraints). </p> </dd> <dt><code><var>knobs</var>(4)</code></dt> <dd><p>if nonzero, aggressive absorption is performed. </p> </dd> <dt><code><var>knobs</var>(5)</code></dt> <dd><p>if nonzero, statistics and knobs are printed. </p> </dd> </dl> <p><var>cmember</var> is an optional vector of length <em>n</em>. It defines the constraints on the column ordering. If <code><var>cmember</var>(j) = <var>c</var></code>, then column <var>j</var> is in constraint set <var>c</var> (<var>c</var> must be in the range 1 to n). In the output permutation <var>p</var>, all columns in set 1 appear first, followed by all columns in set 2, and so on. <code><var>cmember</var> = ones (1,n)</code> if not present or empty. <code>ccolamd (<var>S</var>, [], 1 : n)</code> returns <code>1 : n</code> </p> <p><code><var>p</var> = ccolamd (<var>S</var>)</code> is about the same as <code><var>p</var> = colamd (<var>S</var>)</code>. <var>knobs</var> and its default values differ. <code>colamd</code> always does aggressive absorption, and it finds an ordering suitable for both <code>lu (<var>S</var>(:, <var>p</var>))</code> and <code>chol (<var>S</var>(:, <var>p</var>)' * <var>S</var>(:, <var>p</var>))</code>; it cannot optimize its ordering for <code>lu (<var>S</var>(:, <var>p</var>))</code> to the extent that <code>ccolamd (<var>S</var>, 1)</code> can. </p> <p><var>stats</var> is an optional 20-element output vector that provides data about the ordering and the validity of the input matrix <var>S</var>. Ordering statistics are in <code><var>stats</var>(1 : 3)</code>. <code><var>stats</var>(1)</code> and <code><var>stats</var>(2)</code> are the number of dense or empty rows and columns ignored by <small>CCOLAMD</small> and <code><var>stats</var>(3)</code> is the number of garbage collections performed on the internal data structure used by <small>CCOLAMD</small> (roughly of size <code>2.2 * nnz (<var>S</var>) + 4 * <var>m</var> + 7 * <var>n</var></code> integers). </p> <p><code><var>stats</var>(4 : 7)</code> provide information if CCOLAMD was able to continue. The matrix is OK if <code><var>stats</var>(4)</code> is zero, or 1 if invalid. <code><var>stats</var>(5)</code> is the rightmost column index that is unsorted or contains duplicate entries, or zero if no such column exists. <code><var>stats</var>(6)</code> is the last seen duplicate or out-of-order row index in the column index given by <code><var>stats</var>(5)</code>, or zero if no such row index exists. <code><var>stats</var>(7)</code> is the number of duplicate or out-of-order row indices. <code><var>stats</var>(8 : 20)</code> is always zero in the current version of <small>CCOLAMD</small> (reserved for future use). </p> <p>The authors of the code itself are S. Larimore, T. Davis and S. Rajamanickam in collaboration with J. Bilbert and E. Ng. Supported by the National Science Foundation (DMS-9504974, DMS-9803599, CCR-0203270), and a grant from Sandia National Lab. See <a href="http://faculty.cse.tamu.edu/davis/suitesparse.html">http://faculty.cse.tamu.edu/davis/suitesparse.html</a> for ccolamd, csymamd, amd, colamd, symamd, and other related orderings. </p> <p><strong>See also:</strong> <a href="#XREFcolamd">colamd</a>, <a href="#XREFcsymamd">csymamd</a>. </p></dd></dl> <a name="XREFcolamd"></a><dl> <dt><a name="index-colamd"></a><em><var>p</var> =</em> <strong>colamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-colamd-1"></a><em><var>p</var> =</em> <strong>colamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dt><a name="index-colamd-2"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>colamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-colamd-3"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>colamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dd> <p>Compute the column approximate minimum degree permutation. </p> <p><code><var>p</var> = colamd (<var>S</var>)</code> returns the column approximate minimum degree permutation vector for the sparse matrix <var>S</var>. For a non-symmetric matrix <var>S</var>, <code><var>S</var>(:,<var>p</var>)</code> tends to have sparser LU factors than <var>S</var>. The Cholesky factorization of <code><var>S</var>(:,<var>p</var>)' * <var>S</var>(:,<var>p</var>)</code> also tends to be sparser than that of <code><var>S</var>' * <var>S</var></code>. </p> <p><var>knobs</var> is an optional one- to three-element input vector. If <var>S</var> is m-by-n, then rows with more than <code>max(16,<var>knobs</var>(1)*sqrt(n))</code> entries are ignored. Columns with more than <code>max (16,<var>knobs</var>(2)*sqrt(min(m,n)))</code> entries are removed prior to ordering, and ordered last in the output permutation <var>p</var>. Only completely dense rows or columns are removed if <code><var>knobs</var>(1)</code> and <code><var>knobs</var>(2)</code> are < 0, respectively. If <code><var>knobs</var>(3)</code> is nonzero, <var>stats</var> and <var>knobs</var> are printed. The default is <code><var>knobs</var> = [10 10 0]</code>. Note that <var>knobs</var> differs from earlier versions of colamd. </p> <p><var>stats</var> is an optional 20-element output vector that provides data about the ordering and the validity of the input matrix <var>S</var>. Ordering statistics are in <code><var>stats</var>(1:3)</code>. <code><var>stats</var>(1)</code> and <code><var>stats</var>(2)</code> are the number of dense or empty rows and columns ignored by <small>COLAMD</small> and <code><var>stats</var>(3)</code> is the number of garbage collections performed on the internal data structure used by <small>COLAMD</small> (roughly of size <code>2.2 * nnz(<var>S</var>) + 4 * <var>m</var> + 7 * <var>n</var></code> integers). </p> <p>Octave built-in functions are intended to generate valid sparse matrices, with no duplicate entries, with ascending row indices of the nonzeros in each column, with a non-negative number of entries in each column (!) and so on. If a matrix is invalid, then <small>COLAMD</small> may or may not be able to continue. If there are duplicate entries (a row index appears two or more times in the same column) or if the row indices in a column are out of order, then <small>COLAMD</small> can correct these errors by ignoring the duplicate entries and sorting each column of its internal copy of the matrix <var>S</var> (the input matrix <var>S</var> is not repaired, however). If a matrix is invalid in other ways then <small>COLAMD</small> cannot continue, an error message is printed, and no output arguments (<var>p</var> or <var>stats</var>) are returned. <small>COLAMD</small> is thus a simple way to check a sparse matrix to see if it’s valid. </p> <p><code><var>stats</var>(4:7)</code> provide information if <small>COLAMD</small> was able to continue. The matrix is OK if <code><var>stats</var>(4)</code> is zero, or 1 if invalid. <code><var>stats</var>(5)</code> is the rightmost column index that is unsorted or contains duplicate entries, or zero if no such column exists. <code><var>stats</var>(6)</code> is the last seen duplicate or out-of-order row index in the column index given by <code><var>stats</var>(5)</code>, or zero if no such row index exists. <code><var>stats</var>(7)</code> is the number of duplicate or out-of-order row indices. <code><var>stats</var>(8:20)</code> is always zero in the current version of <small>COLAMD</small> (reserved for future use). </p> <p>The ordering is followed by a column elimination tree post-ordering. </p> <p>The authors of the code itself are Stefan I. Larimore and Timothy A. Davis. The algorithm was developed in collaboration with John Gilbert, Xerox PARC, and Esmond Ng, Oak Ridge National Laboratory. (see <a href="http://faculty.cse.tamu.edu/davis/suitesparse.html">http://faculty.cse.tamu.edu/davis/suitesparse.html</a>) </p> <p><strong>See also:</strong> <a href="#XREFcolperm">colperm</a>, <a href="#XREFsymamd">symamd</a>, <a href="#XREFccolamd">ccolamd</a>. </p></dd></dl> <a name="XREFcolperm"></a><dl> <dt><a name="index-colperm"></a><em><var>p</var> =</em> <strong>colperm</strong> <em>(<var>s</var>)</em></dt> <dd><p>Return the column permutations such that the columns of <code><var>s</var> (:, <var>p</var>)</code> are ordered in terms of increasing number of nonzero elements. </p> <p>If <var>s</var> is symmetric, then <var>p</var> is chosen such that <code><var>s</var> (<var>p</var>, <var>p</var>)</code> orders the rows and columns with increasing number of nonzeros elements. </p></dd></dl> <a name="XREFcsymamd"></a><dl> <dt><a name="index-csymamd"></a><em><var>p</var> =</em> <strong>csymamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-csymamd-1"></a><em><var>p</var> =</em> <strong>csymamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dt><a name="index-csymamd-2"></a><em><var>p</var> =</em> <strong>csymamd</strong> <em>(<var>S</var>, <var>knobs</var>, <var>cmember</var>)</em></dt> <dt><a name="index-csymamd-3"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>csymamd</strong> <em>(…)</em></dt> <dd> <p>For a symmetric positive definite matrix <var>S</var>, return the permutation vector <var>p</var> such that <code><var>S</var>(<var>p</var>,<var>p</var>)</code> tends to have a sparser Cholesky factor than <var>S</var>. </p> <p>Sometimes <code>csymamd</code> works well for symmetric indefinite matrices too. The matrix <var>S</var> is assumed to be symmetric; only the strictly lower triangular part is referenced. <var>S</var> must be square. The ordering is followed by an elimination tree post-ordering. </p> <p><var>knobs</var> is an optional 1-element to 3-element input vector, with a default value of <code>[10 1 0]</code>. Entries not present are set to their defaults. </p> <dl compact="compact"> <dt><code><var>knobs</var>(1)</code></dt> <dd><p>If <var>S</var> is n-by-n, then rows and columns with more than <code>max(16,<var>knobs</var>(1)*sqrt(n))</code> entries are ignored, and ordered last in the output permutation (subject to the cmember constraints). </p> </dd> <dt><code><var>knobs</var>(2)</code></dt> <dd><p>If nonzero, aggressive absorption is performed. </p> </dd> <dt><code><var>knobs</var>(3)</code></dt> <dd><p>If nonzero, statistics and knobs are printed. </p> </dd> </dl> <p><var>cmember</var> is an optional vector of length n. It defines the constraints on the ordering. If <code><var>cmember</var>(j) = <var>S</var></code>, then row/column j is in constraint set <var>c</var> (<var>c</var> must be in the range 1 to n). In the output permutation <var>p</var>, rows/columns in set 1 appear first, followed by all rows/columns in set 2, and so on. <code><var>cmember</var> = ones (1,n)</code> if not present or empty. <code>csymamd (<var>S</var>,[],1:n)</code> returns <code>1:n</code>. </p> <p><code><var>p</var> = csymamd (<var>S</var>)</code> is about the same as <code><var>p</var> = symamd (<var>S</var>)</code>. <var>knobs</var> and its default values differ. </p> <p><code><var>stats</var>(4:7)</code> provide information if CCOLAMD was able to continue. The matrix is OK if <code><var>stats</var>(4)</code> is zero, or 1 if invalid. <code><var>stats</var>(5)</code> is the rightmost column index that is unsorted or contains duplicate entries, or zero if no such column exists. <code><var>stats</var>(6)</code> is the last seen duplicate or out-of-order row index in the column index given by <code><var>stats</var>(5)</code>, or zero if no such row index exists. <code><var>stats</var>(7)</code> is the number of duplicate or out-of-order row indices. <code><var>stats</var>(8:20)</code> is always zero in the current version of <small>CCOLAMD</small> (reserved for future use). </p> <p>The authors of the code itself are S. Larimore, T. Davis and S. Rajamanickam in collaboration with J. Bilbert and E. Ng. Supported by the National Science Foundation (DMS-9504974, DMS-9803599, CCR-0203270), and a grant from Sandia National Lab. See <a href="http://faculty.cse.tamu.edu/davis/suitesparse.html">http://faculty.cse.tamu.edu/davis/suitesparse.html</a> for ccolamd, colamd, csymamd, amd, colamd, symamd, and other related orderings. </p> <p><strong>See also:</strong> <a href="#XREFsymamd">symamd</a>, <a href="#XREFccolamd">ccolamd</a>. </p></dd></dl> <a name="XREFdmperm"></a><dl> <dt><a name="index-dmperm"></a><em><var>p</var> =</em> <strong>dmperm</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-dmperm-1"></a><em>[<var>p</var>, <var>q</var>, <var>r</var>, <var>S</var>] =</em> <strong>dmperm</strong> <em>(<var>S</var>)</em></dt> <dd> <a name="index-Dulmage_002dMendelsohn-decomposition"></a> <p>Perform a Dulmage-Mendelsohn permutation of the sparse matrix <var>S</var>. </p> <p>With a single output argument <code>dmperm</code> performs the row permutations <var>p</var> such that <code><var>S</var>(<var>p</var>,:)</code> has no zero elements on the diagonal. </p> <p>Called with two or more output arguments, returns the row and column permutations, such that <code><var>S</var>(<var>p</var>, <var>q</var>)</code> is in block triangular form. The values of <var>r</var> and <var>S</var> define the boundaries of the blocks. If <var>S</var> is square then <code><var>r</var> == <var>S</var></code>. </p> <p>The method used is described in: A. Pothen & C.-J. Fan. <cite>Computing the Block Triangular Form of a Sparse Matrix</cite>. ACM Trans. Math. Software, 16(4):303-324, 1990. </p> <p><strong>See also:</strong> <a href="#XREFcolamd">colamd</a>, <a href="#XREFccolamd">ccolamd</a>. </p></dd></dl> <a name="XREFsymamd"></a><dl> <dt><a name="index-symamd"></a><em><var>p</var> =</em> <strong>symamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-symamd-1"></a><em><var>p</var> =</em> <strong>symamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dt><a name="index-symamd-2"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>symamd</strong> <em>(<var>S</var>)</em></dt> <dt><a name="index-symamd-3"></a><em>[<var>p</var>, <var>stats</var>] =</em> <strong>symamd</strong> <em>(<var>S</var>, <var>knobs</var>)</em></dt> <dd> <p>For a symmetric positive definite matrix <var>S</var>, returns the permutation vector p such that <code><var>S</var>(<var>p</var>, <var>p</var>)</code> tends to have a sparser Cholesky factor than <var>S</var>. </p> <p>Sometimes <code>symamd</code> works well for symmetric indefinite matrices too. The matrix <var>S</var> is assumed to be symmetric; only the strictly lower triangular part is referenced. <var>S</var> must be square. </p> <p><var>knobs</var> is an optional one- to two-element input vector. If <var>S</var> is n-by-n, then rows and columns with more than <code>max (16,<var>knobs</var>(1)*sqrt(n))</code> entries are removed prior to ordering, and ordered last in the output permutation <var>p</var>. No rows/columns are removed if <code><var>knobs</var>(1) < 0</code>. If <code><var>knobs</var>(2)</code> is nonzero, <var>stats</var> and <var>knobs</var> are printed. The default is <code><var>knobs</var> = [10 0]</code>. Note that <var>knobs</var> differs from earlier versions of <code>symamd</code>. </p> <p><var>stats</var> is an optional 20-element output vector that provides data about the ordering and the validity of the input matrix <var>S</var>. Ordering statistics are in <code><var>stats</var>(1:3)</code>. <code><var>stats</var>(1) = <var>stats</var>(2)</code> is the number of dense or empty rows and columns ignored by SYMAMD and <code><var>stats</var>(3)</code> is the number of garbage collections performed on the internal data structure used by SYMAMD (roughly of size <code>8.4 * nnz (tril (<var>S</var>, -1)) + 9 * <var>n</var></code> integers). </p> <p>Octave built-in functions are intended to generate valid sparse matrices, with no duplicate entries, with ascending row indices of the nonzeros in each column, with a non-negative number of entries in each column (!) and so on. If a matrix is invalid, then SYMAMD may or may not be able to continue. If there are duplicate entries (a row index appears two or more times in the same column) or if the row indices in a column are out of order, then SYMAMD can correct these errors by ignoring the duplicate entries and sorting each column of its internal copy of the matrix S (the input matrix S is not repaired, however). If a matrix is invalid in other ways then SYMAMD cannot continue, an error message is printed, and no output arguments (<var>p</var> or <var>stats</var>) are returned. SYMAMD is thus a simple way to check a sparse matrix to see if it’s valid. </p> <p><code><var>stats</var>(4:7)</code> provide information if SYMAMD was able to continue. The matrix is OK if <code><var>stats</var> (4)</code> is zero, or 1 if invalid. <code><var>stats</var>(5)</code> is the rightmost column index that is unsorted or contains duplicate entries, or zero if no such column exists. <code><var>stats</var>(6)</code> is the last seen duplicate or out-of-order row index in the column index given by <code><var>stats</var>(5)</code>, or zero if no such row index exists. <code><var>stats</var>(7)</code> is the number of duplicate or out-of-order row indices. <code><var>stats</var>(8:20)</code> is always zero in the current version of SYMAMD (reserved for future use). </p> <p>The ordering is followed by a column elimination tree post-ordering. </p> <p>The authors of the code itself are Stefan I. Larimore and Timothy A. Davis. The algorithm was developed in collaboration with John Gilbert, Xerox PARC, and Esmond Ng, Oak Ridge National Laboratory. (see <a href="http://faculty.cse.tamu.edu/davis/suitesparse.html">http://faculty.cse.tamu.edu/davis/suitesparse.html</a>) </p> <p><strong>See also:</strong> <a href="#XREFcolperm">colperm</a>, <a href="#XREFcolamd">colamd</a>. </p></dd></dl> <a name="XREFsymrcm"></a><dl> <dt><a name="index-symrcm"></a><em><var>p</var> =</em> <strong>symrcm</strong> <em>(<var>S</var>)</em></dt> <dd><p>Return the symmetric reverse Cuthill-McKee permutation of <var>S</var>. </p> <p><var>p</var> is a permutation vector such that <code><var>S</var>(<var>p</var>, <var>p</var>)</code> tends to have its diagonal elements closer to the diagonal than <var>S</var>. This is a good preordering for LU or Cholesky factorization of matrices that come from “long, skinny” problems. It works for both symmetric and asymmetric <var>S</var>. </p> <p>The algorithm represents a heuristic approach to the NP-complete bandwidth minimization problem. The implementation is based in the descriptions found in </p> <p>E. Cuthill, J. McKee. <cite>Reducing the Bandwidth of Sparse Symmetric Matrices</cite>. Proceedings of the 24th ACM National Conference, 157–172 1969, Brandon Press, New Jersey. </p> <p>A. George, J.W.H. Liu. <cite>Computer Solution of Large Sparse Positive Definite Systems</cite>, Prentice Hall Series in Computational Mathematics, ISBN 0-13-165274-5, 1981. </p> <p><strong>See also:</strong> <a href="#XREFcolperm">colperm</a>, <a href="#XREFcolamd">colamd</a>, <a href="#XREFsymamd">symamd</a>. </p></dd></dl> <hr> <div class="header"> <p> Previous: <a href="Return-Types-of-Operators-and-Functions.html#Return-Types-of-Operators-and-Functions" accesskey="p" rel="prev">Return Types of Operators and Functions</a>, Up: <a href="Operators-and-Functions.html#Operators-and-Functions" accesskey="u" rel="up">Operators and Functions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> </body> </html>