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