29 #if defined (HAVE_CONFIG_H)
47 DEFUN (ccolamd, args, nargout,
139 #if defined (HAVE_CCOLAMD)
141 int nargin = args.length ();
143 if (nargin < 1 || nargin > 3)
150 static_assert (CCOLAMD_KNOBS <= 40,
151 "ccolamd: # of CCOLAMD_KNOBS exceeded. Please report this to bugs.octave.org");
152 double knob_storage[CCOLAMD_KNOBS];
153 double *knobs = &knob_storage[0];
159 NDArray User_knobs = args(1).array_value ();
160 int nel_User_knobs = User_knobs.
numel ();
162 if (nel_User_knobs > 0)
163 knobs[CCOLAMD_LU] = (User_knobs(0) != 0);
164 if (nel_User_knobs > 1)
165 knobs[CCOLAMD_DENSE_ROW] = User_knobs(1);
166 if (nel_User_knobs > 2)
167 knobs[CCOLAMD_DENSE_COL] = User_knobs(2);
168 if (nel_User_knobs > 3)
169 knobs[CCOLAMD_AGGRESSIVE] = (User_knobs(3) != 0);
170 if (nel_User_knobs > 4)
171 spumoni = (User_knobs(4) != 0);
176 octave_stdout <<
"\nccolamd version " << CCOLAMD_MAIN_VERSION <<
'.'
177 << CCOLAMD_SUB_VERSION <<
", " << CCOLAMD_DATE
178 <<
":\nknobs(1): " << User_knobs(0) <<
", order for ";
179 if (knobs[CCOLAMD_LU] != 0)
184 if (knobs[CCOLAMD_DENSE_ROW] >= 0)
186 <<
", rows with > max (16,"
187 << knobs[CCOLAMD_DENSE_ROW]
188 <<
"*sqrt (size(A,2)))"
189 <<
" entries removed\n";
192 <<
", no dense rows removed\n";
194 if (knobs[CCOLAMD_DENSE_COL] >= 0)
196 <<
", cols with > max (16,"
197 << knobs[CCOLAMD_DENSE_COL] <<
"*sqrt (size(A)))"
198 <<
" entries removed\n";
201 <<
", no dense columns removed\n";
203 if (knobs[CCOLAMD_AGGRESSIVE] != 0)
205 <<
", aggressive absorption: yes";
208 <<
", aggressive absorption: no";
211 <<
", statistics and knobs printed\n";
220 if (args(0).issparse ())
222 if (args(0).iscomplex ())
224 scm = args(0).sparse_complex_matrix_value ();
233 sm = args(0).sparse_matrix_value ();
244 if (args(0).iscomplex ())
266 static_assert (CCOLAMD_STATS <= 40,
267 "ccolamd: # of CCOLAMD_STATS exceeded. Please report this to bugs.octave.org");
273 NDArray in_cmember = args(2).array_value ();
281 error (
"ccolamd: CMEMBER must be of length equal to #cols of A");
284 if (!
CCOLAMD_NAME () (n_row, n_col, Alen,
A, p, knobs, stats,cmember))
288 error (
"ccolamd: internal error!");
294 if (!
CCOLAMD_NAME () (n_row, n_col, Alen,
A, p, knobs, stats,
nullptr))
298 error (
"ccolamd: internal error!");
305 out_perm(i) = p[i] + 1;
318 out_stats(i) = stats[i];
324 out_stats(CCOLAMD_INFO1)++;
325 out_stats(CCOLAMD_INFO2)++;
332 octave_unused_parameter (args);
333 octave_unused_parameter (nargout);
340 DEFUN (csymamd, args, nargout,
406 #if defined (HAVE_CCOLAMD)
408 int nargin = args.length ();
410 if (nargin < 1 || nargin > 3)
417 static_assert (CCOLAMD_KNOBS <= 40,
418 "csymamd: # of CCOLAMD_KNOBS exceeded. Please report this to bugs.octave.org");
419 double knob_storage[CCOLAMD_KNOBS];
420 double *knobs = &knob_storage[0];
426 NDArray User_knobs = args(1).array_value ();
427 int nel_User_knobs = User_knobs.
numel ();
429 if (nel_User_knobs > 0)
430 knobs[CCOLAMD_DENSE_ROW] = User_knobs(0);
431 if (nel_User_knobs > 1)
432 knobs[CCOLAMD_AGGRESSIVE] = User_knobs(1);
433 if (nel_User_knobs > 2)
434 spumoni =
static_cast<int> (User_knobs(2));
439 octave_stdout <<
"\ncsymamd version " << CCOLAMD_MAIN_VERSION
440 <<
'.' << CCOLAMD_SUB_VERSION
441 <<
", " << CCOLAMD_DATE <<
"\n";
443 if (knobs[CCOLAMD_DENSE_ROW] >= 0)
445 <<
", rows/cols with > max (16,"
446 << knobs[CCOLAMD_DENSE_ROW]
447 <<
"*sqrt (size(A,2)))"
448 <<
" entries removed\n";
451 <<
", no dense rows/cols removed\n";
453 if (knobs[CCOLAMD_AGGRESSIVE] != 0)
455 <<
", aggressive absorption: yes";
458 <<
", aggressive absorption: no";
461 <<
", statistics and knobs printed\n";
470 if (args(0).issparse ())
472 if (args(0).iscomplex ())
474 scm = args(0).sparse_complex_matrix_value ();
482 sm = args(0).sparse_matrix_value ();
491 if (args(0).iscomplex ())
507 static_assert (CCOLAMD_STATS <= 40,
508 "csymamd: # of CCOLAMD_STATS exceeded. Please report this to bugs.octave.org");
514 NDArray in_cmember = args(2).array_value ();
522 error (
"csymamd: CMEMBER must be of length equal to #cols of A");
527 perm, knobs, stats, &calloc, &
free, cmember, -1))
531 error (
"csymamd: internal error!");
539 perm, knobs, stats, &calloc, &
free,
nullptr, -1))
543 error (
"csymamd: internal error!");
550 out_perm(i) = perm[i] + 1;
563 out_stats(i) = stats[i];
569 out_stats(CCOLAMD_INFO1)++;
570 out_stats(CCOLAMD_INFO2)++;
577 octave_unused_parameter (args);
578 octave_unused_parameter (nargout);
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type cols(void) const
octave_idx_type * xridx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type rows(void) const
octave_idx_type * xcidx(void)
Vector representing the dimensions (size) of an Array.
ColumnVector real(const ComplexColumnVector &a)
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
void err_square_matrix_required(const char *fcn, const char *name)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
F77_RET_T const F77_INT F77_CMPLX * A
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define CCOLAMD_NAME(name)
#define CSYMAMD_NAME(name)
octave_value::octave_value(const Array< char > &chm, char type) return retval