Mercurial > octave-antonio
annotate libinterp/dldfcn/amd.cc @ 20163:075a5e2e1ba5 stable
doc: Update more docstrings to have one sentence summary as first line.
Reviewed build-aux, libinterp/dldfcn, libinterp/octave-value,
libinterp/parse-tree directories.
* build-aux/mk-opts.pl, libinterp/dldfcn/__magick_read__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/audiodevinfo.cc,
libinterp/dldfcn/audioread.cc, libinterp/dldfcn/ccolamd.cc,
libinterp/dldfcn/chol.cc, libinterp/dldfcn/colamd.cc,
libinterp/dldfcn/convhulln.cc, libinterp/dldfcn/dmperm.cc,
libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc, libinterp/dldfcn/symbfact.cc,
libinterp/dldfcn/symrcm.cc, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-oncleanup.cc,
libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-usr-fcn.cc,
libinterp/octave-value/ov.cc, libinterp/parse-tree/lex.ll,
libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-eval.cc, libinterp/parse-tree/pt-mat.cc:
doc: Update more docstrings to have one sentence summary as first line.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 03 May 2015 21:52:42 -0700 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
7619 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19208
diff
changeset
|
3 Copyright (C) 2008-2015 David Bateman |
7619 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 3 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 // This is the octave interface to amd, which bore the copyright given | |
24 // in the help of the functions. | |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 #include <config.h> | |
28 #endif | |
29 | |
30 #include <cstdlib> | |
31 | |
32 #include <string> | |
33 #include <vector> | |
34 | |
35 #include "ov.h" | |
36 #include "defun-dld.h" | |
37 #include "pager.h" | |
38 #include "ov-re-mat.h" | |
39 | |
40 #include "ov-re-sparse.h" | |
41 #include "ov-cx-sparse.h" | |
42 #include "oct-map.h" | |
43 | |
44 #include "oct-sparse.h" | |
8377
25bc2d31e1bf
improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
45 #include "oct-locbuf.h" |
7619 | 46 |
16313
6aafe87a3144
use int64_t for idx type if --enable-64
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
47 #ifdef USE_64_BIT_IDX_T |
7619 | 48 #define AMD_NAME(name) amd_l ## name |
49 #else | |
50 #define AMD_NAME(name) amd ## name | |
51 #endif | |
52 | |
53 DEFUN_DLD (amd, args, nargout, | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
54 "-*- texinfo -*-\n\ |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
55 @deftypefn {Loadable Function} {@var{p} =} amd (@var{S})\n\ |
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
56 @deftypefnx {Loadable Function} {@var{p} =} amd (@var{S}, @var{opts})\n\ |
7619 | 57 \n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
58 Return the approximate minimum degree permutation of a matrix.\n\ |
7619 | 59 \n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
60 This is a permutation such that the Cholesky@tie{}factorization of\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
61 @code{@var{S} (@var{p}, @var{p})} tends to be sparser than the\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
62 Cholesky@tie{}factorization of @var{S} itself. @code{amd} is typically\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
63 faster than @code{symamd} but serves a similar purpose.\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
64 \n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
65 The optional parameter @var{opts} is a structure that controls the behavior\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
66 of @code{amd}. The fields of the structure are\n\ |
7619 | 67 \n\ |
68 @table @asis\n\ | |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
69 @item @var{opts}.dense\n\ |
7619 | 70 Determines what @code{amd} considers to be a dense row or column of the\n\ |
18679
a142f35f3cb6
doc: Fix unbalanced parentheses in documentation.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
71 input matrix. Rows or columns with more than @code{max (16, (dense *\n\ |
a142f35f3cb6
doc: Fix unbalanced parentheses in documentation.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
72 sqrt (@var{n})))} entries, where @var{n} is the order of the matrix @var{S},\n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
73 are ignored by @code{amd} during the calculation of the permutation.\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
74 The value of dense must be a positive scalar and the default value is 10.0\n\ |
7619 | 75 \n\ |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
76 @item @var{opts}.aggressive\n\ |
18809
53af80da6781
doc: Update documentation of sparse functions including seealso links.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
77 If this value is a nonzero scalar, then @code{amd} performs aggressive\n\ |
9066
be150a172010
Cleanup documentation for diagperm.texi, sparse.texi
Rik <rdrider0-list@yahoo.com>
parents:
9064
diff
changeset
|
78 absorption. The default is not to perform aggressive absorption.\n\ |
7619 | 79 @end table\n\ |
80 \n\ | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
81 The author of the code itself is Timothy A. Davis\n\ |
20163
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
82 @email{davis@@cise.ufl.edu}, University of Florida\n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
83 (see @url{http://www.cise.ufl.edu/research/sparse/amd}).\n\ |
7619 | 84 @seealso{symamd, colamd}\n\ |
85 @end deftypefn") | |
86 { | |
87 octave_value_list retval; | |
88 | |
89 #ifdef HAVE_AMD | |
90 int nargin = args.length (); | |
91 | |
92 if (nargin < 1 || nargin > 2) | |
93 print_usage (); | |
94 else | |
95 { | |
10527
b4d2080b6df7
Replace nzmax by nnz as needed
David Bateman <dbateman@free.fr>
parents:
10154
diff
changeset
|
96 octave_idx_type n_row, n_col; |
7619 | 97 const octave_idx_type *ridx, *cidx; |
98 SparseMatrix sm; | |
99 SparseComplexMatrix scm; | |
100 | |
101 if (args(0).is_sparse_type ()) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
102 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
103 if (args(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
104 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
105 scm = args(0).sparse_complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
106 n_row = scm.rows (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
107 n_col = scm.cols (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
108 ridx = scm.xridx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
109 cidx = scm.xcidx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
110 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
111 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
112 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
113 sm = args(0).sparse_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
114 n_row = sm.rows (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
115 n_col = sm.cols (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
116 ridx = sm.xridx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
117 cidx = sm.xcidx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
118 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
119 } |
7619 | 120 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
121 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
122 if (args(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
123 sm = SparseMatrix (real (args(0).complex_matrix_value ())); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
124 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
125 sm = SparseMatrix (args(0).matrix_value ()); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
126 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
127 n_row = sm.rows (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
128 n_col = sm.cols (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
129 ridx = sm.xridx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
130 cidx = sm.xcidx (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
131 } |
7619 | 132 |
133 if (!error_state && n_row != n_col) | |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
134 error ("amd: matrix S must be square"); |
7619 | 135 |
136 if (!error_state) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
137 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
138 OCTAVE_LOCAL_BUFFER (double, Control, AMD_CONTROL); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
139 AMD_NAME (_defaults) (Control) ; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
140 if (nargin > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
141 { |
11046
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
142 octave_scalar_map arg1 = args(1).scalar_map_value (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
143 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
144 if (!error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
145 { |
11046
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
146 octave_value tmp; |
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
147 |
11053
c33b7054f1f9
in recent Octave_map -> octave_scalar_map changes, use GETFIELD to access map elements, not CONTENTS
John W. Eaton <jwe@octave.org>
parents:
11046
diff
changeset
|
148 tmp = arg1.getfield ("dense"); |
11046
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
149 if (tmp.is_defined ()) |
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
150 Control[AMD_DENSE] = tmp.double_value (); |
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
151 |
11053
c33b7054f1f9
in recent Octave_map -> octave_scalar_map changes, use GETFIELD to access map elements, not CONTENTS
John W. Eaton <jwe@octave.org>
parents:
11046
diff
changeset
|
152 tmp = arg1.getfield ("aggressive"); |
11046
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
153 if (tmp.is_defined ()) |
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
154 Control[AMD_AGGRESSIVE] = tmp.double_value (); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
155 } |
11046
14993c9e857e
amd.cc, cellfun.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
156 else |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
157 error ("amd: OPTS argument must be a scalar structure"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
158 } |
7619 | 159 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
160 if (!error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
161 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
162 OCTAVE_LOCAL_BUFFER (octave_idx_type, P, n_col); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
163 Matrix xinfo (AMD_INFO, 1); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
164 double *Info = xinfo.fortran_vec (); |
7619 | 165 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 // FIXME: how can we manage the memory allocation of amd |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 // in a cleaner manner? |
19139
afd6179d2616
allow building with new version of SuiteSparse (bug #43063)
John W. Eaton <jwe@octave.org>
parents:
18811
diff
changeset
|
168 SUITESPARSE_ASSIGN_FPTR (malloc_func, amd_malloc, malloc); |
afd6179d2616
allow building with new version of SuiteSparse (bug #43063)
John W. Eaton <jwe@octave.org>
parents:
18811
diff
changeset
|
169 SUITESPARSE_ASSIGN_FPTR (free_func, amd_free, free); |
afd6179d2616
allow building with new version of SuiteSparse (bug #43063)
John W. Eaton <jwe@octave.org>
parents:
18811
diff
changeset
|
170 SUITESPARSE_ASSIGN_FPTR (calloc_func, amd_calloc, calloc); |
afd6179d2616
allow building with new version of SuiteSparse (bug #43063)
John W. Eaton <jwe@octave.org>
parents:
18811
diff
changeset
|
171 SUITESPARSE_ASSIGN_FPTR (realloc_func, amd_realloc, realloc); |
afd6179d2616
allow building with new version of SuiteSparse (bug #43063)
John W. Eaton <jwe@octave.org>
parents:
18811
diff
changeset
|
172 SUITESPARSE_ASSIGN_FPTR (printf_func, amd_printf, printf); |
7619 | 173 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
174 octave_idx_type result = AMD_NAME (_order) (n_col, cidx, ridx, P, |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
175 Control, Info); |
7619 | 176 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
177 switch (result) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
178 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
179 case AMD_OUT_OF_MEMORY: |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
180 error ("amd: out of memory"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
181 break; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
182 case AMD_INVALID: |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
183 error ("amd: matrix S is corrupted"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
184 break; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
185 default: |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
186 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
187 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
188 retval(1) = xinfo; |
7619 | 189 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
190 Matrix Pout (1, n_col); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
191 for (octave_idx_type i = 0; i < n_col; i++) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
192 Pout.xelem (i) = P[i] + 1; |
7619 | 193 |
14844
5bc9b9cb4362
maint: Use Octave coding conventions for cuddled parenthesis in retval assignments.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
194 retval(0) = Pout; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
195 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
196 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
197 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
198 } |
7619 | 199 } |
200 #else | |
201 | |
202 error ("amd: not available in this version of Octave"); | |
203 | |
204 #endif | |
205 | |
206 return retval; | |
207 } | |
19144
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
208 /* |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
209 %!shared A, A2, opts |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
210 %! A = ones (20, 30); |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
211 %! A2 = ones (30, 30); |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
212 %! |
19208
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19144
diff
changeset
|
213 %!testif HAVE_AMD |
19144
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
214 %! assert(amd (A2), [1:30]) |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
215 %! opts.dense = 25; |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
216 %! assert(amd (A2, opts), [1:30]) |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
217 %! opts.aggressive = 1; |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
218 %! assert(amd (A2, opts), [1:30]) |
19208
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19144
diff
changeset
|
219 |
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19144
diff
changeset
|
220 %!error <matrix S must be square|not available in this version> amd (A) |
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19144
diff
changeset
|
221 %!error amd (A2, 2) |
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19144
diff
changeset
|
222 %!error <matrix S is corrupted|not available in this version> amd ([]) |
19144
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19139
diff
changeset
|
223 */ |