1
/* ========================================================================== */
2
/* === spqr_mx_error ======================================================== */
3
/* ========================================================================== */
5
/* Compile with gcc, not g++. This is called by the CHOLMOD error handler,
6
* which is itself in C. A global variable is used for spumoni because the
7
* parameter signature of this function cannot be changed; it is passed as
8
* a function pointer to the CHOLMOD error handler.
12
* CHOLMOD_TOO_LARGE MATLAB:pmaxsize problem too large
13
* CHOLMOD_OUT_OF_MEMORY MATLAB:nomem out of memory
14
* CHOLMOD_INVALID MATLAB:internal invalid option
15
* CHOLMOD_NOT_INSTALLED MATLAB:internal internal error
17
* warnings: these are not used by SuiteSparseQR. They can only come from
18
* CHOLMOD, but they do not apply to SuiteSparseQR.
20
* CHOLMOD_NOT_POSDEF matrix not positive definite (for chol)
21
* CHOLMOD_DSMALL diagonal too small (for LDL')
27
int spqr_spumoni = 0 ;
29
void spqr_mx_error (int status, const char *file, int line, const char *msg)
32
if (spqr_spumoni > 0 ||
33
!(status == CHOLMOD_OUT_OF_MEMORY || status == CHOLMOD_TOO_LARGE))
35
mexPrintf ("ERROR: %s line %d, status %d: %s\n",
36
file, line, status, msg) ;
39
if (status < CHOLMOD_OK)
43
case CHOLMOD_OUT_OF_MEMORY:
44
mexErrMsgIdAndTxt ("MATLAB:nomem",
45
"Out of memory. Type HELP MEMORY for your options.") ;
47
case CHOLMOD_TOO_LARGE:
48
mexErrMsgIdAndTxt ("MATLAB:pmaxsize",
49
"Maximum variable size allowed by the program is exceeded.") ;
53
/* CHOLMOD_NOT_INSTALLED and CHOLMOD_INVALID:
54
These errors should be caught by the mexFunction interface
55
to SuiteSparseQR, not by the CHOLMOD or SuiteSparseQR
56
internal code itself */
57
mexErrMsgIdAndTxt ("MATLAB:internal", "Internal error") ;
63
/* A CHOMOD warning is not used by SuiteSparseQR at all. Thus, it is
64
reported here as an internal error rather than as a warning. */
65
/* mexWarnMsgTxt (msg) ; */
66
mexErrMsgIdAndTxt ("MATLAB:internal", "Internal error") ;