29 #if defined (HAVE_CONFIG_H)
49 DEFUN (ccolamd, args, nargout,
141 #if defined (HAVE_CCOLAMD)
143 int nargin = args.length ();
145 if (nargin < 1 || nargin > 3)
152 static_assert (CCOLAMD_KNOBS <= 40,
153 "ccolamd: # of CCOLAMD_KNOBS exceeded. Please report this to bugs.octave.org");
154 double knob_storage[CCOLAMD_KNOBS];
155 double *knobs = &knob_storage[0];
161 NDArray User_knobs = args(1).array_value ();
162 int nel_User_knobs = User_knobs.
numel ();
164 if (nel_User_knobs > 0)
165 knobs[CCOLAMD_LU] = (User_knobs(0) != 0);
166 if (nel_User_knobs > 1)
167 knobs[CCOLAMD_DENSE_ROW] = User_knobs(1);
168 if (nel_User_knobs > 2)
169 knobs[CCOLAMD_DENSE_COL] = User_knobs(2);
170 if (nel_User_knobs > 3)
171 knobs[CCOLAMD_AGGRESSIVE] = (User_knobs(3) != 0);
172 if (nel_User_knobs > 4)
173 spumoni = (User_knobs(4) != 0);
178 octave_stdout <<
"\nccolamd version " << CCOLAMD_MAIN_VERSION <<
'.'
179 << CCOLAMD_SUB_VERSION <<
", " << CCOLAMD_DATE
180 <<
":\nknobs(1): " << User_knobs(0) <<
", order for ";
181 if (knobs[CCOLAMD_LU] != 0)
186 if (knobs[CCOLAMD_DENSE_ROW] >= 0)
188 <<
", rows with > max (16,"
189 << knobs[CCOLAMD_DENSE_ROW]
190 <<
"* sqrt (columns(A)))"
191 <<
" entries removed\n";
194 <<
", no dense rows removed\n";
196 if (knobs[CCOLAMD_DENSE_COL] >= 0)
198 <<
", cols with > max (16,"
199 << knobs[CCOLAMD_DENSE_COL] <<
"* sqrt (size(A)))"
200 <<
" entries removed\n";
203 <<
", no dense columns removed\n";
205 if (knobs[CCOLAMD_AGGRESSIVE] != 0)
207 <<
", aggressive absorption: yes";
210 <<
", aggressive absorption: no";
213 <<
", statistics and knobs printed\n";
222 if (args(0).issparse ())
224 if (args(0).iscomplex ())
226 scm = args(0).sparse_complex_matrix_value ();
235 sm = args(0).sparse_matrix_value ();
246 if (args(0).iscomplex ())
268 static_assert (CCOLAMD_STATS <= 40,
269 "ccolamd: # of CCOLAMD_STATS exceeded. Please report this to bugs.octave.org");
275 NDArray in_cmember = args(2).array_value ();
283 error (
"ccolamd: CMEMBER must be of length equal to #cols of A");
286 if (!
CCOLAMD_NAME () (n_row, n_col, Alen,
A, p, knobs, stats, cmember))
290 error (
"ccolamd: internal error!");
296 if (!
CCOLAMD_NAME () (n_row, n_col, Alen,
A, p, knobs, stats,
nullptr))
300 error (
"ccolamd: internal error!");
307 out_perm(i) = p[i] + 1;
309 retval(0) = out_perm;
320 out_stats(i) = stats[i];
321 retval(1) = out_stats;
326 out_stats(CCOLAMD_INFO1)++;
327 out_stats(CCOLAMD_INFO2)++;
334 octave_unused_parameter (args);
335 octave_unused_parameter (nargout);
342 DEFUN (csymamd, args, nargout,
408 #if defined (HAVE_CCOLAMD)
410 int nargin = args.length ();
412 if (nargin < 1 || nargin > 3)
419 static_assert (CCOLAMD_KNOBS <= 40,
420 "csymamd: # of CCOLAMD_KNOBS exceeded. Please report this to bugs.octave.org");
421 double knob_storage[CCOLAMD_KNOBS];
422 double *knobs = &knob_storage[0];
428 NDArray User_knobs = args(1).array_value ();
429 int nel_User_knobs = User_knobs.
numel ();
431 if (nel_User_knobs > 0)
432 knobs[CCOLAMD_DENSE_ROW] = User_knobs(0);
433 if (nel_User_knobs > 1)
434 knobs[CCOLAMD_AGGRESSIVE] = User_knobs(1);
435 if (nel_User_knobs > 2)
436 spumoni =
static_cast<int> (User_knobs(2));
441 octave_stdout <<
"\ncsymamd version " << CCOLAMD_MAIN_VERSION
442 <<
'.' << CCOLAMD_SUB_VERSION
443 <<
", " << CCOLAMD_DATE <<
"\n";
445 if (knobs[CCOLAMD_DENSE_ROW] >= 0)
447 <<
", rows/cols with > max (16,"
448 << knobs[CCOLAMD_DENSE_ROW]
449 <<
"* sqrt (columns(A)))"
450 <<
" entries removed\n";
453 <<
", no dense rows/cols removed\n";
455 if (knobs[CCOLAMD_AGGRESSIVE] != 0)
457 <<
", aggressive absorption: yes";
460 <<
", aggressive absorption: no";
463 <<
", statistics and knobs printed\n";
472 if (args(0).issparse ())
474 if (args(0).iscomplex ())
476 scm = args(0).sparse_complex_matrix_value ();
484 sm = args(0).sparse_matrix_value ();
493 if (args(0).iscomplex ())
509 static_assert (CCOLAMD_STATS <= 40,
510 "csymamd: # of CCOLAMD_STATS exceeded. Please report this to bugs.octave.org");
516 NDArray in_cmember = args(2).array_value ();
524 error (
"csymamd: CMEMBER must be of length equal to #cols of A");
529 perm, knobs, stats, &calloc, &
free, cmember, -1))
533 error (
"csymamd: internal error!");
541 perm, knobs, stats, &calloc, &
free,
nullptr, -1))
545 error (
"csymamd: internal error!");
552 out_perm(i) = perm[i] + 1;
554 retval(0) = out_perm;
565 out_stats(i) = stats[i];
566 retval(1) = out_stats;
571 out_stats(CCOLAMD_INFO1)++;
572 out_stats(CCOLAMD_INFO2)++;
579 octave_unused_parameter (args);
580 octave_unused_parameter (nargout);
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type rows(void) const
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type cols(void) const
octave_idx_type * xcidx(void)
octave_idx_type * xridx(void)
Vector representing the dimensions (size) of an Array.
ColumnVector real(const ComplexColumnVector &a)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
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
class OCTAVE_API SparseMatrix
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
#define CCOLAMD_NAME(name)
#define CSYMAMD_NAME(name)