24 #if defined (HAVE_CONFIG_H) 111 #if defined (HAVE_CHOLMOD) 113 int nargin = args.length ();
121 cholmod_sparse Astore;
122 cholmod_sparse *
A = &Astore;
126 #if defined (OCTAVE_ENABLE_64) 127 A->itype = CHOLMOD_LONG;
129 A->itype = CHOLMOD_INT;
131 A->dtype = CHOLMOD_DOUBLE;
135 if (args(0).isreal ())
143 A->xtype = CHOLMOD_REAL;
145 if (
a.rows () > 0 &&
a.cols () > 0)
148 else if (args(0).iscomplex ())
156 A->xtype = CHOLMOD_COMPLEX;
158 if (
a.rows () > 0 &&
a.cols () > 0)
172 ch = tolower (
str[0]);
186 error (R
"(symbfact: unrecognized TYP "%s")", str.c_str ()); 191 std::string str = args(2).xstring_value (
"MODE must be a string");
194 ch = toupper (
str[0]);
196 error (R
"(symbfact: unrecognized MODE "%s")", str.c_str ()); 199 if (
A->stype &&
A->nrow !=
A->ncol)
208 cholmod_common Common;
209 cholmod_common *cm = &Common;
216 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
220 cm->print =
static_cast<int> (spu) + 2;
221 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
225 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
226 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
229 cholmod_sparse *Aup, *Alo;
247 if (cm->status < CHOLMOD_OK)
249 err_msg =
"symbfact: matrix corrupted";
253 if (
CHOLMOD_NAME(postorder) (Parent, n,
nullptr, Post, cm) != n)
255 err_msg =
"symbfact: postorder failed";
259 CHOLMOD_NAME(rowcolcounts) (Alo,
nullptr, 0, Parent, Post,
nullptr, ColCount,
262 if (cm->status < CHOLMOD_OK)
264 err_msg =
"symbfact: matrix corrupted";
270 cholmod_sparse *A1, *A2;
277 else if (
A->stype == -1)
318 0, CHOLMOD_PATTERN, cm);
338 std::fill_n (L.
xdata (), lnz,
true);
350 tmp(
i) = Post[
i] + 1;
357 tmp(
i) = Parent[
i] + 1;
365 for (
int i = 0 ;
i < n ;
i++)
368 retval(1) =
static_cast<double> (height);
372 tmp(
i) = ColCount[
i];
379 if (! err_msg.empty ())
380 error (err_msg.c_str ());
386 octave_unused_parameter (args);
387 octave_unused_parameter (
nargout);
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)
void error(const char *fmt,...)
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)
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
F77_RET_T const F77_INT F77_CMPLX * 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)
#define CHOLMOD_NAME(name)
octave_idx_type * xridx(void)
void err_wrong_type_arg(const char *name, const char *s)
charNDArray max(char d, const charNDArray &m)
int SparseCholPrint(const char *fmt,...)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define DEFUN_DLD(name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin function.
octave_idx_type * xcidx(void)
Vector representing the dimensions (size) of an Array.
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
SparseBoolMatrix transpose(void) const
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)