SCM

SCM Repository

[matrix] Annotation of /pkg/src/Metis_utils.c
ViewVC logotype

Annotation of /pkg/src/Metis_utils.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (view) (download) (as text)

1 : bates 10 #include "Metis_utils.h"
2 :    
3 : bates 70 void ssc_metis_order(int n, const int Tp [], const int Ti [],
4 : bates 10 idxtype* perm, idxtype* iperm)
5 :     {
6 : bates 70 int j, num_flag = 0, options_flag = 0;
7 : bates 10 idxtype *xadj, *adj;
8 :    
9 :     xadj = (idxtype *) R_alloc(n + 1, sizeof(idxtype));
10 : bates 70 adj = (idxtype *) R_alloc(2 * (Tp[n] - n), sizeof(idxtype));
11 : bates 10 /* temporarily use perm to store lengths */
12 : bates 70 memset(perm, 0, sizeof(idxtype) * n);
13 : bates 10 for (j = 0; j < n; j++) {
14 : bates 70 int ip, p2 = Tp[j+1];
15 :     for (ip = Tp[j]; ip < p2; ip++) {
16 :     int i = Ti[ip];
17 : bates 10 if (i != j) {
18 :     perm[i]++;
19 :     perm[j]++;
20 :     }
21 :     }
22 :     }
23 :     xadj[0] = 0;
24 :     for (j = 0; j < n; j++) xadj[j+1] = xadj[j] + perm[j];
25 :     /* temporarily use perm to store pointers */
26 : bates 70 Memcpy(perm, xadj, n);
27 : bates 10 for (j = 0; j < n; j++) {
28 : bates 70 int ip, p2 = Tp[j+1];
29 :     for (ip = Tp[j]; ip < p2; ip++) {
30 :     int i = Ti[ip];
31 : bates 10 if (i != j) {
32 :     adj[perm[i]] = j;
33 :     adj[perm[j]] = i;
34 :     perm[i]++;
35 :     perm[j]++;
36 :     }
37 :     }
38 :     }
39 :     METIS_NodeND(&n, xadj, adj, &num_flag, &options_flag, perm, iperm);
40 :     }

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge