26 #define Long SuiteSparse_long 39 const mxArray *pargin [ ]
64 if (nargin < 1 || nargin > 3 || nargout < 0 || nargout > 2)
66 mexErrMsgTxt (
"Usage: [p stats] = csymamd (S, knobs, cmember)") ;
75 in_cmember = mxGetPr (pargin [2]) ;
76 cslen = mxGetNumberOfElements (pargin [2]) ;
79 cmember = (
Long *) mxCalloc (cslen,
sizeof (
Long)) ;
80 for (i = 0 ; i < cslen ; i++)
83 cmember[
i] = ((
Long) in_cmember [i] - 1) ;
97 in_knobs = mxGetPr (pargin [1]) ;
98 i = mxGetNumberOfElements (pargin [1]) ;
101 if (i > 2) spumoni = (in_knobs [2] != 0) ;
107 mexPrintf (
"\ncsymamd version %d.%d, %s:\n",
111 mexPrintf (
"knobs(1): %g, rows/cols with > " 112 "max(16,%g*sqrt(size(A,2))) entries removed\n",
117 mexPrintf (
"knobs(1): %g, no dense rows removed\n",
120 mexPrintf (
"knobs(2): %g, aggressive absorption: %s\n",
122 mexPrintf (
"knobs(3): %g, statistics and knobs printed\n",
128 Ainput = (mxArray *) pargin [0] ;
129 if (mxGetNumberOfDimensions (Ainput) != 2)
131 mexErrMsgTxt (
"csymamd: input matrix must be 2-dimensional.") ;
133 full = !mxIsSparse (Ainput) ;
136 mexCallMATLAB (1, &Ainput, 1, (mxArray **) pargin,
"sparse") ;
142 n_row = mxGetM (Ainput) ;
143 n_col = mxGetN (Ainput) ;
146 mexErrMsgTxt (
"csymamd: matrix must be square.") ;
149 if (cmember !=
NULL && cslen != n_col)
151 mexErrMsgTxt (
"csymamd: cmember must be of length equal to #cols of A");
154 A = (
Long *) mxGetIr (Ainput) ;
155 p = (
Long *) mxGetJc (Ainput) ;
156 perm = (
Long *) mxCalloc (n_col+1,
sizeof (
Long)) ;
160 if (!
csymamd_l (n_col, A, p, perm, knobs, stats, &mxCalloc, &mxFree,
164 mexErrMsgTxt (
"csymamd error!") ;
169 mxDestroyArray (Ainput) ;
174 pargout [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ;
175 out_perm = mxGetPr (pargout [0]) ;
176 for (i = 0 ; i < n_col ; i++)
179 out_perm [
i] = perm [
i] + 1 ;
194 pargout [1] = mxCreateDoubleMatrix (1,
CCOLAMD_STATS, mxREAL) ;
195 out_stats = mxGetPr (pargout [1]) ;
198 out_stats [
i] = stats [
i] ;
#define CCOLAMD_SUB_VERSION
void ccolamd_l_set_defaults(double knobs [CCOLAMD_KNOBS])
#define CCOLAMD_DENSE_ROW
#define CCOLAMD_MAIN_VERSION
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
void mexFunction(int nargout, mxArray *pargout [], int nargin, const mxArray *pargin [])
void csymamd_l_report(SuiteSparse_long stats [CCOLAMD_STATS])
idx_t idx_t idx_t idx_t idx_t * perm
#define CCOLAMD_AGGRESSIVE
SuiteSparse_long csymamd_l(SuiteSparse_long n, SuiteSparse_long A [], SuiteSparse_long p [], SuiteSparse_long perm [], double knobs [CCOLAMD_KNOBS], SuiteSparse_long stats [CCOLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *), SuiteSparse_long cmember [], SuiteSparse_long stype)