1 --- CHOLMOD/Partition/cholmod_metis.c.orig 2012-05-29 17:02:05.000000000 +0200
2 +++ CHOLMOD/Partition/cholmod_metis.c 2012-06-27 18:05:33.131952214 +0200
6 /* After dumping the graph with this routine, run "onmetis metisgraph" */
7 -static void dumpgraph (idxtype *Mp, idxtype *Mi, SuiteSparse_long n,
8 +static void dumpgraph (idx_t *Mp, idx_t *Mi, SuiteSparse_long n,
9 cholmod_common *Common)
11 SuiteSparse_long i, j, p, nz ;
13 s = GUESS ((double) nz, (double) n) ;
14 s *= Common->metis_memory ;
16 - if (s * sizeof (idxtype) >= ((double) Size_max))
17 + if (s * sizeof (idx_t) >= ((double) Size_max))
19 /* don't even attempt to malloc such a large block */
22 metis_guard *= Common->metis_memory ;
24 /* attempt to malloc the block */
25 - p = CHOLMOD(malloc) (metis_guard, sizeof (idxtype), Common) ;
26 + p = CHOLMOD(malloc) (metis_guard, sizeof (idx_t), Common) ;
29 /* failure - return out-of-memory condition */
33 /* success - free the block */
34 - CHOLMOD(free) (metis_guard, sizeof (idxtype), p, Common) ;
35 + CHOLMOD(free) (metis_guard, sizeof (idx_t), p, Common) ;
43 - idxtype *Mp, *Mi, *Mnw, *Mew, *Mpart ;
44 + idx_t *Mp, *Mi, *Mnw, *Mew, *Mpart ;
45 Int n, nleft, nright, j, p, csep, total_weight, lightest, nz ;
46 int Opt [8], nn, csp ;
49 /* ---------------------------------------------------------------------- */
52 - if (sizeof (Int) > sizeof (idxtype) && MAX (n,nz) > INT_MAX / sizeof (int))
53 + if (sizeof (Int) > sizeof (idx_t) && MAX (n,nz) > INT_MAX / sizeof (int))
55 /* CHOLMOD's matrix is too large for METIS */
58 DEBUG (for (j = 0 ; j < n ; j++) ASSERT (Anw [j] > 0)) ;
60 /* ---------------------------------------------------------------------- */
61 - /* copy Int to METIS idxtype, if necessary */
62 + /* copy Int to METIS idx_t, if necessary */
63 /* ---------------------------------------------------------------------- */
65 DEBUG (for (j = 0 ; j < nz ; j++) ASSERT (Aew [j] > 0)) ;
66 - if (sizeof (Int) == sizeof (idxtype))
67 + if (sizeof (Int) == sizeof (idx_t))
69 /* this is the typical case */
70 - Mi = (idxtype *) Ai ;
71 - Mew = (idxtype *) Aew ;
72 - Mp = (idxtype *) Ap ;
73 - Mnw = (idxtype *) Anw ;
74 - Mpart = (idxtype *) Partition ;
76 + Mew = (idx_t *) Aew ;
78 + Mnw = (idx_t *) Anw ;
79 + Mpart = (idx_t *) Partition ;
83 - /* idxtype and Int differ; copy the graph into the METIS idxtype */
84 - Mi = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
85 - Mew = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
86 - Mp = CHOLMOD(malloc) (n1, sizeof (idxtype), Common) ;
87 - Mnw = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
88 - Mpart = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
89 + /* idx_t and Int differ; copy the graph into the METIS idx_t */
90 + Mi = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
91 + Mew = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
92 + Mp = CHOLMOD(malloc) (n1, sizeof (idx_t), Common) ;
93 + Mnw = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
94 + Mpart = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
95 if (Common->status < CHOLMOD_OK)
97 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
98 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
99 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
100 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
101 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
102 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
103 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
104 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
105 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
106 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
109 for (p = 0 ; p < nz ; p++)
110 @@ -337,13 +337,13 @@
111 if (!metis_memory_ok (n, nz, Common))
113 /* METIS might ask for too much memory and thus terminate the program */
114 - if (sizeof (Int) != sizeof (idxtype))
115 + if (sizeof (Int) != sizeof (idx_t))
117 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
118 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
119 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
120 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
121 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
122 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
123 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
124 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
125 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
126 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
130 @@ -369,27 +369,27 @@
134 - METIS_NodeComputeSeparator (&nn, Mp, Mi, Mnw, Mew, Opt, &csp, Mpart) ;
135 + METIS_ComputeVertexSeparator (&nn, Mp, Mi, Mnw, Opt, &csp, Mpart) ;
139 PRINT1 (("METIS csep "ID"\n", csep)) ;
141 /* ---------------------------------------------------------------------- */
142 - /* copy the results back from idxtype, if required */
143 + /* copy the results back from idx_t, if required */
144 /* ---------------------------------------------------------------------- */
146 - if (sizeof (Int) != sizeof (idxtype))
147 + if (sizeof (Int) != sizeof (idx_t))
149 for (j = 0 ; j < n ; j++)
151 Partition [j] = Mpart [j] ;
153 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
154 - CHOLMOD(free) (nz, sizeof (idxtype), Mew, Common) ;
155 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
156 - CHOLMOD(free) (n, sizeof (idxtype), Mnw, Common) ;
157 - CHOLMOD(free) (n, sizeof (idxtype), Mpart, Common) ;
158 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
159 + CHOLMOD(free) (nz, sizeof (idx_t), Mew, Common) ;
160 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
161 + CHOLMOD(free) (n, sizeof (idx_t), Mnw, Common) ;
162 + CHOLMOD(free) (n, sizeof (idx_t), Mpart, Common) ;
165 /* ---------------------------------------------------------------------- */
169 Int *Iperm, *Iwork, *Bp, *Bi ;
170 - idxtype *Mp, *Mi, *Mperm, *Miperm ;
171 + idx_t *Mp, *Mi, *Mperm, *Miperm ;
173 Int i, j, n, nz, p, identity, uncol ;
174 int Opt [8], nn, zero = 0 ;
176 /* ---------------------------------------------------------------------- */
179 - if (sizeof (Int) > sizeof (idxtype) && MAX (n,nz) > INT_MAX / sizeof (int))
180 + if (sizeof (Int) > sizeof (idx_t) && MAX (n,nz) > INT_MAX / sizeof (int))
182 /* CHOLMOD's matrix is too large for METIS */
183 CHOLMOD(free_sparse) (&B, Common) ;
184 @@ -629,29 +629,29 @@
185 /* allocate the METIS input arrays, if needed */
186 /* ---------------------------------------------------------------------- */
188 - if (sizeof (Int) == sizeof (idxtype))
189 + if (sizeof (Int) == sizeof (idx_t))
191 /* This is the typical case. */
192 - Miperm = (idxtype *) Iperm ;
193 - Mperm = (idxtype *) Perm ;
194 - Mp = (idxtype *) Bp ;
195 - Mi = (idxtype *) Bi ;
196 + Miperm = (idx_t *) Iperm ;
197 + Mperm = (idx_t *) Perm ;
198 + Mp = (idx_t *) Bp ;
199 + Mi = (idx_t *) Bi ;
203 - /* allocate graph for METIS only if Int and idxtype differ */
204 - Miperm = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
205 - Mperm = CHOLMOD(malloc) (n, sizeof (idxtype), Common) ;
206 - Mp = CHOLMOD(malloc) (n1, sizeof (idxtype), Common) ;
207 - Mi = CHOLMOD(malloc) (nz, sizeof (idxtype), Common) ;
208 + /* allocate graph for METIS only if Int and idx_t differ */
209 + Miperm = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
210 + Mperm = CHOLMOD(malloc) (n, sizeof (idx_t), Common) ;
211 + Mp = CHOLMOD(malloc) (n1, sizeof (idx_t), Common) ;
212 + Mi = CHOLMOD(malloc) (nz, sizeof (idx_t), Common) ;
213 if (Common->status < CHOLMOD_OK)
216 CHOLMOD(free_sparse) (&B, Common) ;
217 - CHOLMOD(free) (n, sizeof (idxtype), Miperm, Common) ;
218 - CHOLMOD(free) (n, sizeof (idxtype), Mperm, Common) ;
219 - CHOLMOD(free) (n1, sizeof (idxtype), Mp, Common) ;
220 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
221 + CHOLMOD(free) (n, sizeof (idx_t), Miperm, Common) ;
222 + CHOLMOD(free) (n, sizeof (idx_t), Mperm, Common) ;
223 + CHOLMOD(free) (n1, sizeof (idx_t), Mp, Common) ;
224 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
227 for (j = 0 ; j <= n ; j++)
228 @@ -740,16 +740,16 @@
229 /* free the METIS input arrays */
230 /* ---------------------------------------------------------------------- */
232 - if (sizeof (Int) != sizeof (idxtype))
233 + if (sizeof (Int) != sizeof (idx_t))
235 for (i = 0 ; i < n ; i++)
237 Perm [i] = (Int) (Mperm [i]) ;
239 - CHOLMOD(free) (n, sizeof (idxtype), Miperm, Common) ;
240 - CHOLMOD(free) (n, sizeof (idxtype), Mperm, Common) ;
241 - CHOLMOD(free) (n+1, sizeof (idxtype), Mp, Common) ;
242 - CHOLMOD(free) (nz, sizeof (idxtype), Mi, Common) ;
243 + CHOLMOD(free) (n, sizeof (idx_t), Miperm, Common) ;
244 + CHOLMOD(free) (n, sizeof (idx_t), Mperm, Common) ;
245 + CHOLMOD(free) (n+1, sizeof (idx_t), Mp, Common) ;
246 + CHOLMOD(free) (nz, sizeof (idx_t), Mi, Common) ;
249 CHOLMOD(free_sparse) (&B, Common) ;