24 #if defined (HAVE_CONFIG_H)
105 #if defined (HAVE_CHOLMOD)
109 if (nargin < 1 || nargin > 3)
115 cholmod_sparse Astore;
116 cholmod_sparse *
A = &Astore;
120 #if defined (OCTAVE_ENABLE_64)
121 A->itype = CHOLMOD_LONG;
123 A->itype = CHOLMOD_INT;
125 A->dtype = CHOLMOD_DOUBLE;
129 if (
args(0).is_real_type ())
137 A->xtype = CHOLMOD_REAL;
142 else if (
args(0).is_complex_type ())
150 A->xtype = CHOLMOD_COMPLEX;
166 ch = tolower (str[0]);
180 error (
"symbfact: unrecognized TYP \"%s\"", str.c_str ());
188 ch = toupper (str[0]);
190 error (
"symbfact: unrecognized MODE \"%s\"", str.c_str ());
193 if (A->stype && A->nrow != A->ncol)
202 cholmod_common Common;
203 cholmod_common *cm = &Common;
204 CHOLMOD_NAME(
start) (cm);
210 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, 0);
214 cm->print =
static_cast<int> (spu) + 2;
215 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
219 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
220 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
222 cholmod_sparse *
F = CHOLMOD_NAME(
transpose) (
A, 0, cm);
223 cholmod_sparse *Aup, *Alo;
225 if (A->stype == 1 || coletree)
236 CHOLMOD_NAME(etree) (Aup, Parent, cm);
241 if (cm->status < CHOLMOD_OK)
243 err_msg =
"symbfact: matrix corrupted";
247 if (CHOLMOD_NAME(postorder) (Parent, n, 0, Post, cm) != n)
249 err_msg =
"symbfact: postorder failed";
253 CHOLMOD_NAME(rowcolcounts) (Alo, 0, 0, Parent, Post, 0,
254 ColCount, First, Level, cm);
256 if (cm->status < CHOLMOD_OK)
258 err_msg =
"symbfact: matrix corrupted";
264 cholmod_sparse *A1, *A2;
271 else if (A->stype == -1)
311 = CHOLMOD_NAME(allocate_sparse) (n, 1, n,
false,
true,
312 0, CHOLMOD_PATTERN, cm);
320 CHOLMOD_NAME(row_subtree) (A1, A2,
k, Parent, R, cm);
329 CHOLMOD_NAME(free_sparse) (&R, cm);
345 tmp(
i) = Post[
i] + 1;
352 tmp(
i) = Parent[
i] + 1;
360 for (
int i = 0 ;
i < n ;
i++)
363 retval(1) =
static_cast<double> (height);
367 tmp(
i) = ColCount[
i];
371 CHOLMOD_NAME(free_sparse) (&
F, cm);
372 CHOLMOD_NAME(finish) (cm);
374 if (! err_msg.empty ())
375 error (err_msg.c_str ());
381 octave_unused_parameter (
args);
382 octave_unused_parameter (
nargout);
octave_idx_type * xridx(void)
octave_idx_type cols(void) const
octave_idx_type rows(void) const
OCTINTERP_API void print_usage(void)
void SparseCholError(int status, char *file, int line, char *message)
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
octave_idx_type * xcidx(void)
void error(const char *fmt,...)
SparseBoolMatrix transpose(void) const
octave_idx_type * cidx(void)
void err_square_matrix_required(const char *fcn, const char *name)
static void coletree(const octave_idx_type *ridx, const octave_idx_type *colbeg, octave_idx_type *colend, octave_idx_type *parent, octave_idx_type nr, octave_idx_type nc)
static double get_key(const std::string &key)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
OCTAVE_EXPORT octave_value_list W
void err_wrong_type_arg(const char *name, const char *s)
charNDArray max(char d, const charNDArray &m)
int SparseCholPrint(const char *fmt,...)
octave_idx_type * ridx(void)
=val(i)}if ode{val(i)}occurs in table i
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define DEFUN_DLD(name, args_name, nargout_name, doc)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
F77_RET_T const F77_INT F77_CMPLX * A
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)