NeoPZ
profi1.cpp
Go to the documentation of this file.
1 // I DON'T NEED THIS ROUTINE-ARIEL!
2 #include "sloan.h"
3 
4  /* @brief Purpose: Compute the profiles using both original and new numbers */
5 int profi1_ (int64_t *n, int64_t *nnn, int64_t *, int64_t *adj, int64_t *xadj, int64_t *oldpro, int64_t *newpro)
6 //n, nnn, e2, adj, xadj, oldpro, newpro
7 {
8  /* System generated locals */
9  int64_t i__1, i__2, i__3, i__4;
10 
11  /* Local variables */
12  static int64_t i, j, jstop, jstrt, oldmin, newmin;
13 
14 
15 /* INPUT: */
16 /* ------ */
17 /* N - Number of nodes in graph */
18 /* NNN - List of new node numbers for graph */
19 /* - New node number for node I is given by NNN(I) */
20 /* E2 - Twice the number of edges in the graph = XADJ(N+1)-1 */
21 /* ADJ - Adjacency list for all nodes in graph */
22 /* - List of length 2E where E is the number of edges in */
23 /* the graph and 2E = XADJ(N+1)-1 */
24 /* XADJ - Index number for ADJ */
25 /* - Nodes adjacent to node I are found in ADJ(I), where */
26 /* J=XADJ(I), XADJ(I)+1, ..., XADJ(I+1)-1 */
27 /* OLDPRO - Undefined */
28 /* NEWPRO - Undefined */
29 
30 /* OUTPUT: */
31 /* ------- */
32 /* N - Unchanged */
33 /* NNN - Unchanged */
34 /* E2 - Unchanged */
35 /* ADJ - Unchanged */
36 /* XADJ - Unchanged */
37 /* OLDPRO - Profile with original node numbering */
38 /* NEWPRO - Profile with new node numbering */
39 
40 /* NOTE: Profiles include diagonal terms */
41 /* ----- */
42 
43 /* PROGRAMMER: Scott Sloan */
44 /* ----------- */
45 
46 /* LAST MODIFIED: 10 March 1989 Scott Sloan */
47 /* -------------- */
48 /* *********************************************************************** */
49 
50 
51 /* Set profiles and loop over each node in graph */
52 
53  /* Parameter adjustments */
54  --xadj;
55  --nnn;
56  --adj;
57 
58  /* Function Body */
59  if (*oldpro)
60  *oldpro = 0;
61  if (*newpro)
62  *newpro = 0;
63  i__1 = *n;
64  for (i = 1; i <= i__1; ++i)
65  {
66  jstrt = xadj[i];
67  jstop = xadj[i + 1] - 1;
68  oldmin = adj[jstrt];
69  newmin = nnn[adj[jstrt]];
70 
71 /* Find lowest numbered neighbour of node I */
72 /* (using both old and new node numbers) */
73 
74  i__2 = jstop;
75  for (j = jstrt + 1; j <= i__2; ++j)
76  {
77 /* Computing MIN */
78  i__3 = oldmin, i__4 = adj[j];
79  oldmin = (i__3 < i__4) ? i__3 : i__4;
80  //oldmin = min(i__3,i__4);
81 /* Computing MIN */
82  i__3 = newmin, i__4 = nnn[adj[j]];
83  newmin = (i__3 < i__4) ? i__3 : i__4;
84 /* L10: */
85  }
86 
87 /* Update profiles */
88 
89  *oldpro += i_dim(i, oldmin);
90  *newpro += i_dim(nnn[i], newmin);
91 
92 /* L20: */
93  }
94 
95 /* Add diagonal terms to profiles */
96 
97  *oldpro += *n;
98  *newpro += *n;
99  return 0;
100 } /* profi1_ */
101 
102 int64_t i_dim(int64_t value_1, int64_t value_2)
103 {
104  if(value_1<=value_2)
105  {
106  return value_1;
107  }
108  else
109  {
110  return value_2;
111  }
112 }
int64_t i_dim(int64_t value_1, int64_t value_2)
Definition: profi1.cpp:102
int profi1_(int64_t *n, int64_t *nnn, int64_t *, int64_t *adj, int64_t *xadj, int64_t *oldpro, int64_t *newpro)
Definition: profi1.cpp:5