]> git.pld-linux.org Git - packages/CHOLMOD.git/blob - CHOLMOD-metis.patch
- updated to 1.7.4
[packages/CHOLMOD.git] / CHOLMOD-metis.patch
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
4 @@ -76,7 +76,7 @@
5  #ifdef DUMP_GRAPH
6  #include <stdio.h>
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)
11  {
12      UF_long i, j, p, nz ;
13 @@ -162,7 +162,7 @@
14      s = GUESS ((double) nz, (double) n) ;
15      s *= Common->metis_memory ;
16  
17 -    if (s * sizeof (idxtype) >= ((double) Size_max))
18 +    if (s * sizeof (idx_t) >= ((double) Size_max))
19      {
20         /* don't even attempt to malloc such a large block */
21         return (FALSE) ;
22 @@ -173,7 +173,7 @@
23      metis_guard *= Common->metis_memory ;
24  
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) ;
28      if (p == NULL)
29      {
30         /* failure - return out-of-memory condition */
31 @@ -181,7 +181,7 @@
32      }
33  
34      /* success - free the block */
35 -    CHOLMOD(free) (metis_guard, sizeof (idxtype), p, Common) ;
36 +    CHOLMOD(free) (metis_guard, sizeof (idx_t), p, Common) ;
37      return (TRUE) ;
38  }
39  
40 @@ -211,7 +211,7 @@
41  )
42  {
43      Int *Ap, *Ai ;
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 ;
48      size_t n1 ;
49 @@ -260,7 +260,7 @@
50      /* ---------------------------------------------------------------------- */
51  
52  #ifdef LONG
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))
55      {
56         /* CHOLMOD's matrix is too large for METIS */
57         return (EMPTY) ;
58 @@ -283,34 +283,34 @@
59      DEBUG (for (j = 0 ; j < n ; j++) ASSERT (Anw [j] > 0)) ;
60  
61      /* ---------------------------------------------------------------------- */
62 -    /* copy Int to METIS idxtype, if necessary */
63 +    /* copy Int to METIS idx_t, if necessary */
64      /* ---------------------------------------------------------------------- */
65  
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))
69      {
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 ;
76 +       Mi    = (idx_t *) Ai ;
77 +       Mew   = (idx_t *) Aew ;
78 +       Mp    = (idx_t *) Ap ;
79 +       Mnw   = (idx_t *) Anw ;
80 +       Mpart = (idx_t *) Partition ;
81      }
82      else
83      {
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)
97         {
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) ;
108             return (EMPTY) ;
109         }
110         for (p = 0 ; p < nz ; p++)
111 @@ -338,13 +338,13 @@
112      if (!metis_memory_ok (n, nz, Common))
113      {
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))
117         {
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) ;
128         }
129         return (EMPTY) ;
130      }
131 @@ -370,27 +370,27 @@
132  #endif
133  
134      nn = n ;
135 -    METIS_NodeComputeSeparator (&nn, Mp, Mi, Mnw, Mew, Opt, &csp, Mpart) ;
136 +    METIS_ComputeVertexSeparator (&nn, Mp, Mi, Mnw, Opt, &csp, Mpart) ;
137      n = nn ;
138      csep = csp ;
139  
140      PRINT1 (("METIS csep "ID"\n", csep)) ;
141  
142      /* ---------------------------------------------------------------------- */
143 -    /* copy the results back from idxtype, if required */
144 +    /* copy the results back from idx_t, if required */
145      /* ---------------------------------------------------------------------- */
146  
147 -    if (sizeof (Int) != sizeof (idxtype))
148 +    if (sizeof (Int) != sizeof (idx_t))
149      {
150         for (j = 0 ; j < n ; j++)
151         {
152             Partition [j] = Mpart [j] ;
153         }
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) ;
164      }
165  
166      /* ---------------------------------------------------------------------- */
167 @@ -508,7 +508,7 @@
168  {
169      double d ;
170      Int *Iperm, *Iwork, *Bp, *Bi ;
171 -    idxtype *Mp, *Mi, *Mperm, *Miperm ;
172 +    idx_t *Mp, *Mi, *Mperm, *Miperm ;
173      cholmod_sparse *B ;
174      Int i, j, n, nz, p, identity, uncol ;
175      int Opt [8], nn, zero = 0 ;
176 @@ -601,7 +601,7 @@
177      /* ---------------------------------------------------------------------- */
178  
179  #ifdef LONG
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))
182      {
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      /* ---------------------------------------------------------------------- */
188  
189 -    if (sizeof (Int) == sizeof (idxtype))
190 +    if (sizeof (Int) == sizeof (idx_t))
191      {
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 ;
201      }
202      else
203      {
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)
215         {
216             /* out of memory */
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) ;
226             return (FALSE) ;
227         }
228         for (j = 0 ; j <= n ; j++)
229 @@ -741,16 +741,16 @@
230      /* free the METIS input arrays */
231      /* ---------------------------------------------------------------------- */
232  
233 -    if (sizeof (Int) != sizeof (idxtype))
234 +    if (sizeof (Int) != sizeof (idx_t))
235      {
236         for (i = 0 ; i < n ; i++)
237         {
238             Perm [i] = (Int) (Mperm [i]) ;
239         }
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) ;
248      }
249  
250      CHOLMOD(free_sparse) (&B, Common) ;
251 Only in .: metis.patch
This page took 0.131602 seconds and 3 git commands to generate.