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 10 - (view) (download) (as text)

1 : bates 10 #include "Metis_utils.h"
2 :    
3 :     void ssc_metis_order(int n, int nnz,
4 :     const int Tp [], const int Ti [],
5 :     idxtype* perm, idxtype* iperm)
6 :     {
7 :     int i, j, ip, nnodes, num_flag = 0, options_flag = 0;
8 :     idxtype *xadj, *adj;
9 :    
10 :     nnodes = 2 * (nnz - n);
11 :     xadj = (idxtype *) R_alloc(n + 1, sizeof(idxtype));
12 :     adj = (idxtype *) R_alloc(nnodes, sizeof(idxtype));
13 :     /* temporarily use perm to store lengths */
14 :     for (j = 0; j < n; j++) perm[j] = 0;
15 :     for (j = 0; j < n; j++) {
16 :     for (ip = Tp[j]; ip < Tp[j+1]; ip++) {
17 :     i = Ti[ip];
18 :     if (i != j) {
19 :     perm[i]++;
20 :     perm[j]++;
21 :     }
22 :     }
23 :     }
24 :     xadj[0] = 0;
25 :     for (j = 0; j < n; j++) xadj[j+1] = xadj[j] + perm[j];
26 :     /* temporarily use perm to store pointers */
27 :     for (j = 0; j < n; j++) perm[j] = xadj[j];
28 :     for (j = 0; j < n; j++) {
29 :     for (ip = Tp[j]; ip < Tp[j+1]; ip++) {
30 :     i = Ti[ip];
31 :     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