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) ;
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]) ;