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.\n\
60 This is a permutation such that the Cholesky@tie{}factorization of\n\
61 @code{@var{S} (@var{p}, @var{p})} tends to be sparser than the\n\
62 Cholesky@tie{}factorization of @var{S} itself. @code{amd} is typically\n\
63 faster than @code{symamd} but serves a similar purpose.\n\
65 The optional parameter @var{opts} is a structure that controls the behavior\n\
66 of @code{amd}. The fields of the structure are\n\
69 @item @var{opts}.dense\n\
70 Determines what @code{amd} considers to be a dense row or column of the\n\
71 input matrix. Rows or columns with more than @code{max (16, (dense *\n\
72 sqrt (@var{n})))} entries, where @var{n} is the order of the matrix @var{S},\n\
73 are ignored by @code{amd} during the calculation of the permutation.\n\
74 The value of dense must be a positive scalar and the default value is 10.0\n\
76 @item @var{opts}.aggressive\n\
77 If this value is a nonzero scalar, then @code{amd} performs aggressive\n\
78 absorption. The default is not to perform aggressive absorption.\n\
81 The author of the code itself is Timothy A. Davis\n\
82 @email{davis@@cise.ufl.edu}, University of Florida\n\
83 (see @url{http://www.cise.ufl.edu/research/sparse/amd}).\n\
84 @seealso{symamd, colamd}\n\
90 int nargin = args.
length ();
92 if (nargin < 1 || nargin > 2)
101 if (args(0).is_sparse_type ())
103 if (args(0).is_complex_type ())
105 scm = args(0).sparse_complex_matrix_value ();
113 sm = args(0).sparse_matrix_value ();
122 if (args(0).is_complex_type ())
134 error (
"amd: matrix S must be square");
157 error (
"amd: OPTS argument must be a scalar structure");
163 Matrix xinfo (AMD_INFO, 1);
168 SUITESPARSE_ASSIGN_FPTR (malloc_func, amd_malloc,
malloc);
169 SUITESPARSE_ASSIGN_FPTR (free_func, amd_free,
free);
170 SUITESPARSE_ASSIGN_FPTR (calloc_func, amd_calloc, calloc);
171 SUITESPARSE_ASSIGN_FPTR (realloc_func, amd_realloc, realloc);
172 SUITESPARSE_ASSIGN_FPTR (printf_func, amd_printf, printf);
179 case AMD_OUT_OF_MEMORY:
180 error (
"amd: out of memory");
183 error (
"amd: matrix S is corrupted");
192 Pout.
xelem (i) = P[i] + 1;
202 error (
"amd: not available in this version of Octave");
octave_idx_type * xridx(void)
octave_idx_type cols(void) const
octave_idx_type rows(void) const
OCTINTERP_API void print_usage(void)
octave_idx_type length(void) const
bool is_defined(void) const
octave_idx_type * xcidx(void)
void error(const char *fmt,...)
T & xelem(octave_idx_type n)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_value getfield(const std::string &key) const
#define DEFUN_DLD(name, args_name, nargout_name, doc)
const T * fortran_vec(void) const
ColumnVector real(const ComplexColumnVector &a)
double double_value(bool frc_str_conv=false) const