3
3
/* ========================================================================== */
5
5
/* -----------------------------------------------------------------------------
6
* CHOLMOD/MATLAB Module. Version 1.3. Copyright (C) 2005-2006,
6
* CHOLMOD/MATLAB Module. Copyright (C) 2005-2006, Timothy A. Davis
8
7
* The CHOLMOD/MATLAB Module is licensed under Version 2.0 of the GNU
9
8
* General Public License. See gpl.txt for a text of the license.
10
9
* CHOLMOD is also available under other licenses; contact authors for details.
42
41
cholmod_sparse *A, Amatrix, *S ;
43
42
cholmod_common Common, *cm ;
47
46
/* ---------------------------------------------------------------------- */
120
119
/* compute the etree */
121
120
/* ---------------------------------------------------------------------- */
123
Parent = cholmod_malloc (n, sizeof (int), cm) ;
122
Parent = cholmod_l_malloc (n, sizeof (Int), cm) ;
124
123
if (A->stype == 1 || coletree)
126
125
/* symmetric case: find etree of A, using triu(A) */
127
126
/* column case: find column etree of A, which is etree of A'*A */
128
cholmod_etree (A, Parent, cm) ;
127
cholmod_l_etree (A, Parent, cm) ;
133
132
/* row case: find row etree of A, which is etree of A*A' */
135
134
cholmod_sparse *R ;
136
R = cholmod_transpose (A, 0, cm) ;
137
cholmod_etree (R, Parent, cm) ;
138
cholmod_free_sparse (&R, cm) ;
135
R = cholmod_l_transpose (A, 0, cm) ;
136
cholmod_l_etree (R, Parent, cm) ;
137
cholmod_l_free_sparse (&R, cm) ;
141
140
if (cm->status < CHOLMOD_OK)
160
Post = cholmod_malloc (n, sizeof (int), cm) ;
161
if (cholmod_postorder (Parent, n, NULL, Post, cm) != n)
159
Post = cholmod_l_malloc (n, sizeof (Int), cm) ;
160
if (cholmod_l_postorder (Parent, n, NULL, Post, cm) != n)
163
162
/* out of memory or Parent invalid */
164
163
mexErrMsgTxt ("etree2 postorder failed!") ;
166
165
pargout [1] = sputil_put_int (Post, n, 1) ;
167
cholmod_free (n, sizeof (int), Post, cm) ;
166
cholmod_l_free (n, sizeof (Int), Post, cm) ;
170
169
/* ---------------------------------------------------------------------- */
171
170
/* free workspace */
172
171
/* ---------------------------------------------------------------------- */
174
cholmod_free (n, sizeof (int), Parent, cm) ;
175
cholmod_free_sparse (&S, cm) ;
176
cholmod_finish (cm) ;
177
cholmod_print_common (" ", cm) ;
173
cholmod_l_free (n, sizeof (Int), Parent, cm) ;
174
cholmod_l_free_sparse (&S, cm) ;
175
cholmod_l_finish (cm) ;
176
cholmod_l_print_common (" ", cm) ;
178
177
/* if (cm->malloc_count != 0) mexErrMsgTxt ("!") ; */