File: Mathematical-Considerations.html

package info (click to toggle)
octave3.2 3.2.4-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 62,936 kB
  • ctags: 37,353
  • sloc: cpp: 219,497; fortran: 116,336; ansic: 10,264; sh: 5,508; makefile: 4,245; lex: 3,573; yacc: 3,062; objc: 2,042; lisp: 1,692; awk: 860; perl: 844
file content (555 lines) | stat: -rw-r--r-- 33,607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<html lang="en">
<head>
<title>Mathematical Considerations - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Operators-and-Functions.html#Operators-and-Functions" title="Operators and Functions">
<link rel="prev" href="Return-Types-of-Operators-and-Functions.html#Return-Types-of-Operators-and-Functions" title="Return Types of Operators and Functions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Mathematical-Considerations"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Return-Types-of-Operators-and-Functions.html#Return-Types-of-Operators-and-Functions">Return Types of Operators and Functions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Operators-and-Functions.html#Operators-and-Functions">Operators and Functions</a>
<hr>
</div>

<h5 class="subsubsection">21.1.4.3 Mathematical Considerations</h5>

<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>Firstly, the "./" and ".^" operators must be used with care.  Consider what
the examples

<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>
   <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 <var>s</var><code> .^
</code><var>s</var> is a full matrix.

   <p>Likewise <var>s</var><code> .^ -2</code> involves terms like <code>0 .^ -2</code> which
is infinity, and so <var>s</var><code> .^ -2</code> is equally a full matrix.

   <p>For the "./" operator <var>s</var><code> ./ 2</code> has no problems, but
<code>2 ./ </code><var>s</var> involves a large number of infinity terms as well
and is equally a full matrix.  The case of <var>s</var><code> ./ </code><var>s</var>
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>The above behavior is consistent with full matrices, but is not
consistent with sparse implementations in other products.

   <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

<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>
   <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>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 non-zero
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>Several functions are available to reorder depending on the type of the
matrix to be factorized.  If the matrix is symmetric positive-definite,
then <dfn>symamd</dfn> or <dfn>csymamd</dfn> should be used.  Otherwise
<dfn>amd</dfn>, <dfn>colamd</dfn> or <dfn>ccolamd</dfn> should be used.  For completeness
the reordering functions <dfn>colperm</dfn> and <dfn>randperm</dfn> are
also available.

   <p>See <a href="fig_003asimplematrix.html#fig_003asimplematrix">fig:simplematrix</a>, for an example of the structure of a simple
positive definite matrix.

   <div class="float">
<a name="fig_003asimplematrix"></a><div align="center"><img src="spmatrix.png" alt="spmatrix.png"></div>
   <p><strong class="float-caption">Figure 21.3: Structure of simple sparse matrix.</strong></p></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.html#fig_003asimplechol">fig:simplechol</a>. 
The original matrix had
598
non-zero 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>The appropriate sparsity preserving permutation of the original
matrix is given by <dfn>symamd</dfn> 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
non-zero terms which is a significant improvement.

   <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 r<code>[r, p, q] = chol(A); spy(r)</code>.

   <div class="float">
<a name="fig_003asimplechol"></a><div align="center"><img src="spchol.png" alt="spchol.png"></div>
   <p><strong class="float-caption">Figure 21.4: Structure of the un-permuted Cholesky factorization of the above matrix.</strong></p></div>

   <div class="float">
<a name="fig_003asimplecholperm"></a><div align="center"><img src="spcholperm.png" alt="spcholperm.png"></div>
   <p><strong class="float-caption">Figure 21.5: Structure of the permuted Cholesky factorization of the above matrix.</strong></p></div>

   <p>In the case of an asymmetric matrix, the appropriate sparsity
preserving permutation is <dfn>colamd</dfn> 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>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.

<!-- ./DLD-FUNCTIONS/amd.cc -->
   <p><a name="doc_002damd"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>amd</b> (<var>s</var>)<var><a name="index-amd-1686"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>amd</b> (<var>s, opts</var>)<var><a name="index-amd-1687"></a></var><br>
<blockquote>
        <p>Returns the approximate minimum degree permutation of a matrix.  This
permutation such that the Cholesky factorization of <var>s</var><code> (</code><var>p</var><code>,
</code><var>p</var><code>)</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>The optional parameter <var>opts</var> is a structure that controls the
behavior of <code>amd</code>.  The fields of these structure are

          <dl>
<dt>opts.dense<dd>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 (</code><var>n</var><code>)</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 its default value is 10.0

          <br><dt>opts.aggressive<dd>If this value is a non zero scalar, then <code>amd</code> performs aggressive
absorption.  The default is not to perform aggressive absorption. 
</dl>

        <p>The author of the code itself is Timothy A. Davis (davis@cise.ufl.edu),
University of Florida (see <a href="http://www.cise.ufl.edu/research/sparse/amd">http://www.cise.ufl.edu/research/sparse/amd</a>). 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsymamd.html#doc_002dsymamd">symamd</a>, <a href="doc_002dcolamd.html#doc_002dcolamd">colamd</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/ccolamd.cc -->
   <p><a name="doc_002dccolamd"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>ccolamd</b> (<var>s</var>)<var><a name="index-ccolamd-1688"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>ccolamd</b> (<var>s, knobs</var>)<var><a name="index-ccolamd-1689"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>ccolamd</b> (<var>s, knobs, cmember</var>)<var><a name="index-ccolamd-1690"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>ccolamd</b> (<var><small class="dots">...</small></var>)<var><a name="index-ccolamd-1691"></a></var><br>
<blockquote>
        <p>Constrained column approximate minimum degree permutation.  <var>p</var><code> =
ccolamd (</code><var>s</var><code>)</code> returns the column approximate minimum degree permutation
vector for the sparse matrix <var>s</var>.  For a non-symmetric matrix <var>s</var>,
<var>s</var><code> (:, </code><var>p</var><code>)</code> tends to have sparser LU factors than <var>s</var>. 
<code>chol (</code><var>s</var><code> (:, </code><var>p</var><code>)' * </code><var>s</var><code> (:, </code><var>p</var><code>))</code> also tends to be
sparser than <code>chol (</code><var>s</var><code>' * </code><var>s</var><code>)</code>.  <var>p</var><code> = ccolamd
(</code><var>s</var><code>, 1)</code> optimizes the ordering for <code>lu (</code><var>s</var><code> (:, </code><var>p</var><code>))</code>. 
The ordering is followed by a column elimination tree post-ordering.

        <p><var>knobs</var> is an optional one- to five-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.

          <dl>
<dt><var>knobs</var><code>(1)</code><dd>if nonzero, the ordering is optimized for <code>lu (S (:, p))</code>.  It will be a
poor ordering for <code>chol (</code><var>s</var><code> (:, </code><var>p</var><code>)' * </code><var>s</var><code> (:,
</code><var>p</var><code>))</code>.  This is the most important knob for ccolamd.

          <br><dt><var>knob</var><code>(2)</code><dd>if <var>s</var> is m-by-n, rows with more than <code>max (16, </code><var>knobs</var><code> (2) *
sqrt (n))</code> entries are ignored.

          <br><dt><var>knob</var><code>(3)</code><dd>columns with more than <code>max (16, </code><var>knobs</var><code> (3) * sqrt (min (</code><var>m</var><code>,
</code><var>n</var><code>)))</code> entries are ignored and ordered last in the output permutation
(subject to the cmember constraints).

          <br><dt><var>knob</var><code>(4)</code><dd>if nonzero, aggressive absorption is performed.

          <br><dt><var>knob</var><code>(5)</code><dd>if nonzero, statistics and knobs are printed.

        </dl>

        <p><var>cmember</var> is an optional vector of length n.  It defines the constraints
on the column ordering.  If <var>cmember</var><code> (j) = </code><var>c</var>, then column
<var>j</var> is in constraint set <var>c</var> (<var>c</var> must be in the range 1 to
<var>n</var>).  In the output permutation <var>p</var>, all columns in set 1 appear
first, followed by all columns in set 2, and so on.  <var>cmember</var><code> =
ones(1,n)</code> if not present or empty.  <code>ccolamd (</code><var>s</var><code>, [], 1 :
</code><var>n</var><code>)</code> returns <code>1 : </code><var>n</var>

        <p><var>p</var><code> = ccolamd (</code><var>s</var><code>)</code> is about the same as <var>p</var><code> =
colamd (</code><var>s</var><code>)</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 (</code><var>s</var><code> (:, </code><var>p</var><code>))</code> and <code>chol (</code><var>S</var><code> (:, </code><var>p</var><code>)'
* </code><var>s</var><code> (:, </code><var>p</var><code>))</code>; it cannot optimize its ordering for
<code>lu (</code><var>s</var><code> (:, </code><var>p</var><code>))</code> to the extent that
<code>ccolamd (</code><var>s</var><code>, 1)</code> can.

        <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 <var>stats</var><code> (1 : 3)</code>.  <var>stats</var><code> (1)</code> and
<var>stats</var><code> (2)</code> are the number of dense or empty rows and columns
ignored by CCOLAMD and <var>stats</var><code> (3)</code> is the number of garbage
collections performed on the internal data structure used by CCOLAMD
(roughly of size <code>2.2 * nnz (</code><var>s</var><code>) + 4 * </code><var>m</var><code> + 7 * </code><var>n</var>
integers).

        <p><var>stats</var><code> (4 : 7)</code> provide information if CCOLAMD was able to
continue.  The matrix is OK if <var>stats</var><code> (4)</code> is zero, or 1 if
invalid.  <var>stats</var><code> (5)</code> is the rightmost column index that is
unsorted or contains duplicate entries, or zero if no such column exists. 
<var>stats</var><code> (6)</code> is the last seen duplicate or out-of-order row
index in the column index given by <var>stats</var><code> (5)</code>, or zero if no
such row index exists.  <var>stats</var><code> (7)</code> is the number of duplicate
or out-of-order row indices.  <var>stats</var><code> (8 : 20)</code> is always zero in
the current version of CCOLAMD (reserved for future use).

        <p>The authors of the code itself are S. Larimore, T. Davis (Uni of Florida)
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://www.cise.ufl.edu/research/sparse">http://www.cise.ufl.edu/research/sparse</a> for ccolamd, csymamd, amd,
colamd, symamd, and other related orderings. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcolamd.html#doc_002dcolamd">colamd</a>, <a href="doc_002dcsymamd.html#doc_002dcsymamd">csymamd</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/colamd.cc -->
   <p><a name="doc_002dcolamd"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>colamd</b> (<var>s</var>)<var><a name="index-colamd-1692"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>colamd</b> (<var>s, knobs</var>)<var><a name="index-colamd-1693"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>colamd</b> (<var>s</var>)<var><a name="index-colamd-1694"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>colamd</b> (<var>s, knobs</var>)<var><a name="index-colamd-1695"></a></var><br>
<blockquote>
        <p>Column approximate minimum degree permutation.  <var>p</var><code> = colamd
(</code><var>s</var><code>)</code> returns the column approximate minimum degree permutation
vector for the sparse matrix <var>s</var>.  For a non-symmetric matrix <var>s</var>,
<var>s</var><code> (:,</code><var>p</var><code>)</code> tends to have sparser LU factors than <var>s</var>. 
The Cholesky factorization of <var>s</var><code> (:,</code><var>p</var><code>)' * </code><var>s</var><code>
(:,</code><var>p</var><code>)</code> also tends to be sparser than that of <var>s</var><code>' *
</code><var>s</var>.

        <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,</code><var>knobs</var><code>(1)*sqrt(n))</code> entries
are ignored.  Columns with more than <code>max(16,knobs(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 <var>knobs</var><code> (1)</code> and <var>knobs</var><code> (2)</code> are &lt; 0, respectively. 
If <var>knobs</var><code> (3)</code> is nonzero, <var>stats</var> and <var>knobs</var> are
printed.  The default is <var>knobs</var><code> = [10 10 0]</code>.  Note that
<var>knobs</var> differs from earlier versions of colamd

        <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 <var>stats</var><code> (1:3)</code>.  <var>stats</var><code> (1)</code> and
<var>stats</var><code> (2)</code> are the number of dense or empty rows and columns
ignored by COLAMD and <var>stats</var><code> (3)</code> is the number of garbage
collections performed on the internal data structure used by COLAMD
(roughly of size <code>2.2 * nnz(</code><var>s</var><code>) + 4 * </code><var>m</var><code> + 7 * </code><var>n</var>
integers).

        <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 COLAMD 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 COLAMD 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 COLAMD cannot continue, an error message is
printed, and no output arguments (<var>p</var> or <var>stats</var>) are returned. 
COLAMD is thus a simple way to check a sparse matrix to see if it's
valid.

        <p><var>stats</var><code> (4:7)</code> provide information if COLAMD was able to
continue.  The matrix is OK if <var>stats</var><code> (4)</code> is zero, or 1 if
invalid.  <var>stats</var><code> (5)</code> is the rightmost column index that is
unsorted or contains duplicate entries, or zero if no such column exists. 
<var>stats</var><code> (6)</code> is the last seen duplicate or out-of-order row
index in the column index given by <var>stats</var><code> (5)</code>, or zero if no
such row index exists.  <var>stats</var><code> (7)</code> is the number of duplicate
or out-of-order row indices.  <var>stats</var><code> (8:20)</code> is always zero in
the current version of COLAMD (reserved for future use).

        <p>The ordering is followed by a column elimination tree post-ordering.

        <p>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.  (see
<a href="http://www.cise.ufl.edu/research/sparse/colamd">http://www.cise.ufl.edu/research/sparse/colamd</a>)
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcolperm.html#doc_002dcolperm">colperm</a>, <a href="doc_002dsymamd.html#doc_002dsymamd">symamd</a>. 
</p></blockquote></div>

<!-- ./sparse/colperm.m -->
   <p><a name="doc_002dcolperm"></a>

<div class="defun">
&mdash; Function File: <var>p</var> = <b>colperm</b> (<var>s</var>)<var><a name="index-colperm-1696"></a></var><br>
<blockquote><p>Returns the column permutations such that the columns of
<var>s</var><code> (:, </code><var>p</var><code>)</code> are ordered in terms of increase number
of non-zero elements.  If <var>s</var> is symmetric, then <var>p</var> is chosen
such that <var>s</var><code> (</code><var>p</var><code>, </code><var>p</var><code>)</code> orders the rows and
columns with increasing number of non zeros elements. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/ccolamd.cc -->
   <p><a name="doc_002dcsymamd"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>csymamd</b> (<var>s</var>)<var><a name="index-csymamd-1697"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>csymamd</b> (<var>s, knobs</var>)<var><a name="index-csymamd-1698"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>csymamd</b> (<var>s, knobs, cmember</var>)<var><a name="index-csymamd-1699"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>csymamd</b> (<var><small class="dots">...</small></var>)<var><a name="index-csymamd-1700"></a></var><br>
<blockquote>
        <p>For a symmetric positive definite matrix <var>s</var>, returns the permutation
vector <var>p</var> such that <var>s</var><code>(</code><var>p</var><code>,</code><var>p</var><code>)</code> tends to have a
sparser Cholesky factor than <var>s</var>.  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><var>knobs</var> is an optional one- to three-element input vector, with a
default value of <code>[10 1 0]</code> if present or empty.  Entries not
present are set to their defaults.

          <dl>
<dt><var>knobs</var><code>(1)</code><dd>If <var>s</var> is n-by-n, then rows and columns with more than
<code>max(16,</code><var>knobs</var><code>(1)*sqrt(n))</code> entries are ignored, and ordered
last in the output permutation (subject to the cmember constraints).

          <br><dt><var>knobs</var><code>(2)</code><dd>If nonzero, aggressive absorption is performed.

          <br><dt><var>knobs</var><code>(3)</code><dd>If nonzero, statistics and knobs are printed.

        </dl>

        <p><var>cmember</var> is an optional vector of length n. It defines the constraints
on the ordering.  If <var>cmember</var><code>(j) = </code><var>s</var>, 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.  <var>cmember</var><code> = ones(1,n)</code>
if not present or empty.  <code>csymamd(</code><var>s</var><code>,[],1:n)</code> returns <code>1:n</code>.

        <p><var>p</var><code> = csymamd(</code><var>s</var><code>)</code> is about the same as <var>p</var><code> =
symamd(</code><var>s</var><code>)</code>.  <var>knobs</var> and its default values differ.

        <p><var>stats</var><code> (4:7)</code> provide information if CCOLAMD was able to
continue.  The matrix is OK if <var>stats</var><code> (4)</code> is zero, or 1 if
invalid.  <var>stats</var><code> (5)</code> is the rightmost column index that is
unsorted or contains duplicate entries, or zero if no such column exists. 
<var>stats</var><code> (6)</code> is the last seen duplicate or out-of-order row
index in the column index given by <var>stats</var><code> (5)</code>, or zero if no
such row index exists.  <var>stats</var><code> (7)</code> is the number of duplicate
or out-of-order row indices.  <var>stats</var><code> (8:20)</code> is always zero in
the current version of CCOLAMD (reserved for future use).

        <p>The authors of the code itself are S. Larimore, T. Davis (Uni of Florida)
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://www.cise.ufl.edu/research/sparse">http://www.cise.ufl.edu/research/sparse</a> for ccolamd, csymamd, amd,
colamd, symamd, and other related orderings. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsymamd.html#doc_002dsymamd">symamd</a>, <a href="doc_002dccolamd.html#doc_002dccolamd">ccolamd</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/dmperm.cc -->
   <p><a name="doc_002ddmperm"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>dmperm</b> (<var>s</var>)<var><a name="index-dmperm-1701"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>q</var>, <var>r</var>, <var>s</var>] = <b>dmperm</b> (<var>s</var>)<var><a name="index-dmperm-1702"></a></var><br>
<blockquote>
        <p><a name="index-Dulmage_002dMendelsohn-decomposition-1703"></a>Perform a Dulmage-Mendelsohn permutation on the sparse matrix <var>s</var>. 
With a single output argument <dfn>dmperm</dfn> performs the row permutations
<var>p</var> such that <var>s</var><code> (</code><var>p</var><code>,:)</code> has no zero elements on the
diagonal.

        <p>Called with two or more output arguments, returns the row and column
permutations, such that <var>s</var><code> (</code><var>p</var><code>, </code><var>q</var><code>)</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 <var>r</var><code> == </code><var>s</var>.

        <p>The method used is described in: A. Pothen &amp; C.-J. Fan. Computing the block
triangular form of a sparse matrix. ACM Trans. Math. Software,
16(4):303-324, 1990. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcolamd.html#doc_002dcolamd">colamd</a>, <a href="doc_002dccolamd.html#doc_002dccolamd">ccolamd</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/colamd.cc -->
   <p><a name="doc_002dsymamd"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>symamd</b> (<var>s</var>)<var><a name="index-symamd-1704"></a></var><br>
&mdash; Loadable Function: <var>p</var> = <b>symamd</b> (<var>s, knobs</var>)<var><a name="index-symamd-1705"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>symamd</b> (<var>s</var>)<var><a name="index-symamd-1706"></a></var><br>
&mdash; Loadable Function: [<var>p</var>, <var>stats</var>] = <b>symamd</b> (<var>s, knobs</var>)<var><a name="index-symamd-1707"></a></var><br>
<blockquote>
        <p>For a symmetric positive definite matrix <var>s</var>, returns the permutation
vector p such that <var>s</var><code> (</code><var>p</var><code>, </code><var>p</var><code>)</code> tends to have a
sparser Cholesky factor than <var>s</var>.  Sometimes SYMAMD 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><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,</code><var>knobs</var><code>(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 <var>knobs</var><code>(1) &lt; 0</code>.  If <var>knobs</var><code> (2)</code> is nonzero,
<code>stats</code> and <var>knobs</var> are printed.  The default is <var>knobs</var><code>
= [10 0]</code>.  Note that <var>knobs</var> differs from earlier versions of symamd.

        <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 <var>stats</var><code> (1:3)</code>.  <var>stats</var><code> (1) =
</code><var>stats</var><code> (2)</code> is the number of dense or empty rows and columns
ignored by SYMAMD and <var>stats</var><code> (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 (</code><var>s</var><code>, -1)) + 9 * </code><var>n</var>
integers).

        <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><var>stats</var><code> (4:7)</code> provide information if SYMAMD was able to
continue.  The matrix is OK if <var>stats</var><code> (4)</code> is zero, or 1
if invalid.  <var>stats</var><code> (5)</code> is the rightmost column index that
is unsorted or contains duplicate entries, or zero if no such column
exists.  <var>stats</var><code> (6)</code> is the last seen duplicate or out-of-order
row index in the column index given by <var>stats</var><code> (5)</code>, or zero
if no such row index exists.  <var>stats</var><code> (7)</code> is the number of
duplicate or out-of-order row indices.  <var>stats</var><code> (8:20)</code> is
always zero in the current version of SYMAMD (reserved for future use).

        <p>The ordering is followed by a column elimination tree post-ordering.

        <p>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.  (see
<a href="http://www.cise.ufl.edu/research/sparse/colamd">http://www.cise.ufl.edu/research/sparse/colamd</a>)
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcolperm.html#doc_002dcolperm">colperm</a>, <a href="doc_002dcolamd.html#doc_002dcolamd">colamd</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/symrcm.cc -->
   <p><a name="doc_002dsymrcm"></a>

<div class="defun">
&mdash; Loadable Function: <var>p</var> = <b>symrcm</b> (<var>S</var>)<var><a name="index-symrcm-1708"></a></var><br>
<blockquote><p>Symmetric reverse Cuthill-McKee permutation of <var>S</var>. 
Return a permutation vector <var>p</var> such that
<var>S</var><code> (</code><var>p</var><code>, </code><var>p</var><code>)</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>The algorithm represents a heuristic approach to the NP-complete
bandwidth minimization problem.  The implementation is based in the
descriptions found in

        <p>E. Cuthill, J. McKee: Reducing the Bandwidth of Sparse Symmetric
Matrices. Proceedings of the 24th ACM National Conference, 157&ndash;172
1969, Brandon Press, New Jersey.

        <p>Alan George, Joseph W. H. Liu: Computer Solution of Large Sparse
Positive Definite Systems, Prentice Hall Series in Computational
Mathematics, ISBN 0-13-165274-5, 1981.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcolperm.html#doc_002dcolperm">colperm</a>, <a href="doc_002dcolamd.html#doc_002dcolamd">colamd</a>, <a href="doc_002dsymamd.html#doc_002dsymamd">symamd</a>. 
</p></blockquote></div>

   </body></html>