1 diff -ur ../SuiteSparse.orig/CHOLMOD/Partition/cholmod_metis.c ./CHOLMOD/Partition/cholmod_metis.c
2 --- ../SuiteSparse.orig/CHOLMOD/Partition/cholmod_metis.c 2007-05-04 11:47:17.000000000 -0500
3 +++ ./CHOLMOD/Partition/cholmod_metis.c 2011-10-21 18:21:54.000000000 -0500
7 /* After dumping the graph with this routine, run "onmetis metisgraph" */
8 -static void dumpgraph (idxtype *Mp, idxtype *Mi, UF_long n,
9 +static void dumpgraph (idx_t *Mp, idx_t *Mi, UF_long n,
10 cholmod_common *Common)
14 s = GUESS ((double) nz, (double) n) ;
15 s *= Common->metis_memory ;
17 - if (s * sizeof (idxtype) >= ((double) Size_max))
18 + if (s * sizeof (idx_t) >= ((double) Size_max))
20 /* don't even attempt to malloc such a large block */
23 metis_guard *= Common->metis_memory ;
25 /* attempt to malloc the block */
26 - p = CHOLMOD(malloc) (metis_guard, sizeof (idxtype), Common) ;
27 + p = CHOLMOD(malloc) (metis_guard, sizeof (idx_t), Common) ;
30 /* failure - return out-of-memory condition */
34 /* success - free the block */
35 - CHOLMOD(free) (metis_guard, sizeof (idxtype), p, Common) ;
36 + CHOLMOD(free) (metis_guard, sizeof (idx_t), p, Common) ;
44 - idxtype *Mp, *Mi, *Mnw, *Mew, *Mpart ;
45 + idx_t *Mp, *Mi, *Mnw, *Mew, *Mpart ;
46 Int n, nleft, nright, j, p, csep, total_weight, lightest, nz ;
47 int Opt [8], nn, csp ;
50 /* ---------------------------------------------------------------------- */
53 - if (sizeof (Int) > sizeof (idxtype) && MAX (n,nz) > INT_MAX / sizeof (int))
54 + if (sizeof (Int) > sizeof (idx_t) && MAX (n,nz) > INT_MAX / sizeof (int))
56 /* CHOLMOD's matrix is too large for METIS */
59 DEBUG (for (j = 0 ; j < n ; j++) ASSERT (Anw [j] > 0)) ;
61 /* ---------------------------------------------------------------------- */
62 - /* copy Int to METIS idxtype, if necessary */
63 + /* copy Int to METIS idx_t, if necessary */
64 /* ---------------------------------------------------------------------- */
66 DEBUG (for (j = 0 ; j < nz ; j++) ASSERT (Aew [j] > 0)) ;
67 - if (sizeof (Int) == sizeof (idxtype))
68 + if (sizeof (Int) == sizeof (idx_t))
70 /* this is the typical case */
71 - Mi = (idxtype *) Ai ;
72 - Mew = (idxtype *) Aew ;
73 - Mp = (idxtype *) Ap ;
74 - Mnw = (idxtype *) Anw ;
75 - Mpart = (idxtype *) Partition ;
77 + Mew = (idx_t *) Aew ;
79 + Mnw = (idx_t *) Anw ;
80 + Mpart = (idx_t *) Partition ;
84 - /* idxtype and Int differ; copy the graph into the METIS idxtype */
85 - Mi = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
86 - Mew = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
87 - Mp = CHOLMOD(malloc) (n1, sizeof (idxtype), Common) ;
88 - Mnw = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
89 - Mpart = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
90 + /* idx_t and Int differ; copy the graph into the METIS idx_t */
91 + Mi = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
92 + Mew = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
93 + Mp = CHOLMOD(malloc) (n1, sizeof (idx_t), Common) ;
94 + Mnw = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
95 + Mpart = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
96 if (Common->status < CHOLMOD_OK)
98 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
99 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
100 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
101 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
102 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
103 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
104 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
105 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
106 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
107 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
110 for (p = 0 ; p < nz ; p++)
111 @@ -338,13 +338,13 @@
112 if (!metis_memory_ok (n, nz, Common))
114 /* METIS might ask for too much memory and thus terminate the program */
115 - if (sizeof (Int) != sizeof (idxtype))
116 + if (sizeof (Int) != sizeof (idx_t))
118 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
119 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
120 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
121 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
122 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
123 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
124 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
125 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
126 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
127 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
131 @@ -370,27 +370,27 @@
135 - METIS_NodeComputeSeparator (&nn, Mp, Mi, Mnw, Mew, Opt, &csp, Mpart) ;
136 + METIS_ComputeVertexSeparator (&nn, Mp, Mi, Mnw, Opt, &csp, Mpart) ;
140 PRINT1 (("METIS csep "ID"\n", csep)) ;
142 /* ---------------------------------------------------------------------- */
143 - /* copy the results back from idxtype, if required */
144 + /* copy the results back from idx_t, if required */
145 /* ---------------------------------------------------------------------- */
147 - if (sizeof (Int) != sizeof (idxtype))
148 + if (sizeof (Int) != sizeof (idx_t))
150 for (j = 0 ; j < n ; j++)
152 Partition [j] = Mpart [j] ;
154 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
155 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
156 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
157 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
158 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
159 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
160 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
161 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
162 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
163 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
166 /* ---------------------------------------------------------------------- */
170 Int *Iperm, *Iwork, *Bp, *Bi ;
171 - idxtype *Mp, *Mi, *Mperm, *Miperm ;
172 + idx_t *Mp, *Mi, *Mperm, *Miperm ;
174 Int i, j, n, nz, p, identity, uncol ;
175 int Opt [8], nn, zero = 0 ;
177 /* ---------------------------------------------------------------------- */
180 - if (sizeof (Int) > sizeof (idxtype) && MAX (n,nz) > INT_MAX / sizeof (int))
181 + if (sizeof (Int) > sizeof (idx_t) && MAX (n,nz) > INT_MAX / sizeof (int))
183 /* CHOLMOD's matrix is too large for METIS */
184 CHOLMOD(free_sparse) (&B, Common) ;
185 @@ -630,29 +630,29 @@
186 /* allocate the METIS input arrays, if needed */
187 /* ---------------------------------------------------------------------- */
189 - if (sizeof (Int) == sizeof (idxtype))
190 + if (sizeof (Int) == sizeof (idx_t))
192 /* This is the typical case. */
193 - Miperm = (idxtype *) Iperm ;
194 - Mperm = (idxtype *) Perm ;
195 - Mp = (idxtype *) Bp ;
196 - Mi = (idxtype *) Bi ;
197 + Miperm = (idx_t *) Iperm ;
198 + Mperm = (idx_t *) Perm ;
199 + Mp = (idx_t *) Bp ;
200 + Mi = (idx_t *) Bi ;
204 - /* allocate graph for METIS only if Int and idxtype differ */
205 - Miperm = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
206 - Mperm = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
207 - Mp = CHOLMOD(malloc) (n1, sizeof (idxtype), Common) ;
208 - Mi = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
209 + /* allocate graph for METIS only if Int and idx_t differ */
210 + Miperm = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
211 + Mperm = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
212 + Mp = CHOLMOD(malloc) (n1, sizeof (idx_t), Common) ;
213 + Mi = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
214 if (Common->status < CHOLMOD_OK)
217 CHOLMOD(free_sparse) (&B, Common) ;
218 - CHOLMOD(free) (n, sizeof (idxtype), Miperm, Common) ;
219 - CHOLMOD(free) (n, sizeof (idxtype), Mperm, Common) ;
220 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
221 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
222 + CHOLMOD(free) (n, sizeof (idx_t), Miperm, Common) ;
223 + CHOLMOD(free) (n, sizeof (idx_t), Mperm, Common) ;
224 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
225 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
228 for (j = 0 ; j <= n ; j++)
229 @@ -741,16 +741,16 @@
230 /* free the METIS input arrays */
231 /* ---------------------------------------------------------------------- */
233 - if (sizeof (Int) != sizeof (idxtype))
234 + if (sizeof (Int) != sizeof (idx_t))
236 for (i = 0 ; i < n ; i++)
238 Perm [i] = (Int) (Mperm [i]) ;
240 - CHOLMOD(free) (n, sizeof (idxtype), Miperm, Common) ;
241 - CHOLMOD(free) (n, sizeof (idxtype), Mperm, Common) ;
242 - CHOLMOD(free) (n+1, sizeof (idxtype), Mp, Common) ;
243 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
244 + CHOLMOD(free) (n, sizeof (idx_t), Miperm, Common) ;
245 + CHOLMOD(free) (n, sizeof (idx_t), Mperm, Common) ;
246 + CHOLMOD(free) (n+1, sizeof (idx_t), Mp, Common) ;
247 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
250 CHOLMOD(free_sparse) (&B, Common) ;
251 Only in .: metis.patch