Mercurial > hg > octave-nkf
annotate libinterp/dldfcn/amd.cc @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | f90c8372b7ba |
children |
rev | line source |
---|---|
7619 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19400
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\ |
20373
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
58 Return the approximate minimum degree permutation of a matrix.\n\ |
7619 | 59 \n\ |
20373
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
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:
19898
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:
19898
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:
19898
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:
19898
diff
changeset
|
64 \n\ |
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
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:
19898
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\ |
18834
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\ |
20373
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
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:
19898
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\ |
19004
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\ |
20373
075a5e2e1ba5
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
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:
19898
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 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
136 OCTAVE_LOCAL_BUFFER (double, Control, AMD_CONTROL); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
137 AMD_NAME (_defaults) (Control) ; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
138 if (nargin > 1) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
139 { |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
140 octave_scalar_map arg1 = args(1).scalar_map_value (); |
7619 | 141 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
142 if (!error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9245
diff
changeset
|
143 { |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
144 octave_value tmp; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
145 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
146 tmp = arg1.getfield ("dense"); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
147 if (tmp.is_defined ()) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
148 Control[AMD_DENSE] = tmp.double_value (); |
7619 | 149 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
150 tmp = arg1.getfield ("aggressive"); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
151 if (tmp.is_defined ()) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
152 Control[AMD_AGGRESSIVE] = tmp.double_value (); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
153 } |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
154 else |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
155 error ("amd: OPTS argument must be a scalar structure"); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
156 } |
7619 | 157 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
158 if (!error_state) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
159 { |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
160 OCTAVE_LOCAL_BUFFER (octave_idx_type, P, n_col); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
161 Matrix xinfo (AMD_INFO, 1); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
162 double *Info = xinfo.fortran_vec (); |
7619 | 163 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
164 // FIXME: how can we manage the memory allocation of amd |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
165 // in a cleaner manner? |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
166 SUITESPARSE_ASSIGN_FPTR (malloc_func, amd_malloc, malloc); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
167 SUITESPARSE_ASSIGN_FPTR (free_func, amd_free, free); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
168 SUITESPARSE_ASSIGN_FPTR (calloc_func, amd_calloc, calloc); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
169 SUITESPARSE_ASSIGN_FPTR (realloc_func, amd_realloc, realloc); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
170 SUITESPARSE_ASSIGN_FPTR (printf_func, amd_printf, printf); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
171 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
172 octave_idx_type result = AMD_NAME (_order) (n_col, cidx, ridx, P, |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
173 Control, Info); |
7619 | 174 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
175 switch (result) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
176 { |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
177 case AMD_OUT_OF_MEMORY: |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
178 error ("amd: out of memory"); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
179 break; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
180 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
181 case AMD_INVALID: |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
182 error ("amd: matrix S is corrupted"); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
183 break; |
7619 | 184 |
20762
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
185 default: |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
186 { |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
187 if (nargout > 1) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
188 retval(1) = xinfo; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
189 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
190 Matrix Pout (1, n_col); |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
191 for (octave_idx_type i = 0; i < n_col; i++) |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
192 Pout.xelem (i) = P[i] + 1; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
193 |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
194 retval(0) = Pout; |
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20373
diff
changeset
|
195 } |
10154
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 } |
7619 | 198 } |
199 #else | |
200 | |
201 error ("amd: not available in this version of Octave"); | |
202 | |
203 #endif | |
204 | |
205 return retval; | |
206 } | |
19336
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
207 /* |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
208 %!shared A, A2, opts |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
209 %! A = ones (20, 30); |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
210 %! A2 = ones (30, 30); |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
211 %! |
19400
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19336
diff
changeset
|
212 %!testif HAVE_AMD |
19336
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
213 %! assert(amd (A2), [1:30]) |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
214 %! opts.dense = 25; |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
215 %! assert(amd (A2, opts), [1:30]) |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
216 %! opts.aggressive = 1; |
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
217 %! assert(amd (A2, opts), [1:30]) |
19400
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19336
diff
changeset
|
218 |
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19336
diff
changeset
|
219 %!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:
19336
diff
changeset
|
220 %!error amd (A2, 2) |
5f21e0bff135
Use %!testif HAVE_AMD for amd tests added in cset e99d7a2e7367
Mike Miller <mtmiller@ieee.org>
parents:
19336
diff
changeset
|
221 %!error <matrix S is corrupted|not available in this version> amd ([]) |
19336
e99d7a2e7367
* amd.cc: Tests added.
Eduardo Ramos (edu159) <eduradical951@gmail.com>
parents:
19331
diff
changeset
|
222 */ |