47 #ifdef USE_64_BIT_IDX_T
48 #define AMD_NAME(name) amd_l ## name
50 #define AMD_NAME(name) amd ## name
55 @deftypefn {Loadable Function} {@var{p} =} amd (@var{S})\n\
56 @deftypefnx {Loadable Function} {@var{p} =} amd (@var{S}, @var{opts})\n\
58 Return the approximate minimum degree permutation of a matrix. This\n\
59 permutation such that the Cholesky@tie{}factorization of @code{@var{S}\n\
60 (@var{p}, @var{p})} tends to be sparser than the Cholesky@tie{}factorization\n\
61 of @var{S} itself. @code{amd} is typically faster than @code{symamd} but\n\
62 serves a similar purpose.\n\
64 The optional parameter @var{opts} is a structure that controls the\n\
65 behavior of @code{amd}. The fields of the structure are\n\
68 @item @var{opts}.dense\n\
69 Determines what @code{amd} considers to be a dense row or column of the\n\
70 input matrix. Rows or columns with more than @code{max(16, (dense *\n\
71 sqrt (@var{n})} entries, where @var{n} is the order of the matrix @var{S},\n\
72 are ignored by @code{amd} during the calculation of the permutation\n\
73 The value of dense must be a positive scalar and its default value is 10.0\n\
75 @item @var{opts}.aggressive\n\
76 If this value is a non zero scalar, then @code{amd} performs aggressive\n\
77 absorption. The default is not to perform aggressive absorption.\n\
80 The author of the code itself is Timothy A. Davis\n\
81 @email{davis@@cise.ufl.edu}, University of Florida (see\n\
82 @url{http://www.cise.ufl.edu/research/sparse/amd}).\n\
83 @seealso{symamd, colamd}\n\
89 int nargin = args.
length ();
91 if (nargin < 1 || nargin > 2)
100 if (args(0).is_sparse_type ())
102 if (args(0).is_complex_type ())
104 scm = args(0).sparse_complex_matrix_value ();
112 sm = args(0).sparse_matrix_value ();
121 if (args(0).is_complex_type ())
133 error (
"amd: matrix S must be square");
156 error (
"amd: OPTS argument must be a scalar structure");
162 Matrix xinfo (AMD_INFO, 1);
170 amd_realloc = realloc;
178 case AMD_OUT_OF_MEMORY:
179 error (
"amd: out of memory");
182 error (
"amd: matrix S is corrupted");
191 Pout.
xelem (i) = P[i] + 1;
201 error (
"amd: not available in this version of Octave");