44
55namespace hipo {
66
7- void counts2Ptr (std::vector<Int64>& ptr, std::vector<Int64>& w) {
8- // Given the column counts in the vector w (of size n),
9- // compute the column pointers in the vector ptr (of size n+1),
10- // and copy the first n pointers back into w.
11-
12- Int64 temp_nz{};
13- Int64 n = w.size ();
14- for (Int64 j = 0 ; j < n; ++j) {
15- ptr[j] = temp_nz;
16- temp_nz += w[j];
17- w[j] = ptr[j];
18- }
19- ptr[n] = temp_nz;
20- }
21-
22- void inversePerm (const std::vector<Int64>& perm, std::vector<Int64>& iperm) {
7+ void inversePerm (const std::vector<Int>& perm, std::vector<Int>& iperm) {
238 // Given the permutation perm, produce the inverse permutation iperm.
249 // perm[i] : i-th entry to use in the new order.
2510 // iperm[i]: where entry i is located in the new order.
2611
27- for (Int64 i = 0 ; i < perm.size (); ++i) {
12+ for (Int i = 0 ; i < perm.size (); ++i) {
2813 iperm[perm[i]] = i;
2914 }
3015}
@@ -41,56 +26,56 @@ void subtreeSize(const std::vector<Int64>& parent, std::vector<Int64>& sizes) {
4126 }
4227}
4328
44- void transpose (const std::vector<Int64 >& ptr, const std::vector<Int64 >& rows,
45- std::vector<Int64 >& ptrT, std::vector<Int64 >& rowsT) {
29+ void transpose (const std::vector<Int >& ptr, const std::vector<Int >& rows,
30+ std::vector<Int >& ptrT, std::vector<Int >& rowsT) {
4631 // Compute the transpose of the matrix and return it in rowsT and ptrT
4732
48- Int64 n = ptr.size () - 1 ;
33+ Int n = ptr.size () - 1 ;
4934
50- std::vector<Int64 > work (n);
35+ std::vector<Int > work (n);
5136
5237 // count the entries in each row into work
53- for (Int64 i = 0 ; i < ptr.back (); ++i) {
38+ for (Int i = 0 ; i < ptr.back (); ++i) {
5439 ++work[rows[i]];
5540 }
5641
5742 // sum row sums to obtain pointers
5843 counts2Ptr (ptrT, work);
5944
60- for (Int64 j = 0 ; j < n; ++j) {
61- for (Int64 el = ptr[j]; el < ptr[j + 1 ]; ++el) {
62- Int64 i = rows[el];
45+ for (Int j = 0 ; j < n; ++j) {
46+ for (Int el = ptr[j]; el < ptr[j + 1 ]; ++el) {
47+ Int i = rows[el];
6348
6449 // entry (i,j) becomes entry (j,i)
65- Int64 pos = work[i]++;
50+ Int pos = work[i]++;
6651 rowsT[pos] = j;
6752 }
6853 }
6954}
7055
71- void transpose (const std::vector<Int64 >& ptr, const std::vector<Int64 >& rows,
72- const std::vector<double >& val, std::vector<Int64 >& ptrT,
73- std::vector<Int64 >& rowsT, std::vector<double >& valT) {
56+ void transpose (const std::vector<Int >& ptr, const std::vector<Int >& rows,
57+ const std::vector<double >& val, std::vector<Int >& ptrT,
58+ std::vector<Int >& rowsT, std::vector<double >& valT) {
7459 // Compute the transpose of the matrix and return it in rowsT, ptrT and valT
7560
76- Int64 n = ptr.size () - 1 ;
61+ Int n = ptr.size () - 1 ;
7762
78- std::vector<Int64 > work (n);
63+ std::vector<Int > work (n);
7964
8065 // count the entries in each row into work
81- for (Int64 i = 0 ; i < ptr.back (); ++i) {
66+ for (Int i = 0 ; i < ptr.back (); ++i) {
8267 ++work[rows[i]];
8368 }
8469
8570 // sum row sums to obtain pointers
8671 counts2Ptr (ptrT, work);
8772
88- for (Int64 j = 0 ; j < n; ++j) {
89- for (Int64 el = ptr[j]; el < ptr[j + 1 ]; ++el) {
90- Int64 i = rows[el];
73+ for (Int j = 0 ; j < n; ++j) {
74+ for (Int el = ptr[j]; el < ptr[j + 1 ]; ++el) {
75+ Int i = rows[el];
9176
9277 // entry (i,j) becomes entry (j,i)
93- Int64 pos = work[i]++;
78+ Int pos = work[i]++;
9479 rowsT[pos] = j;
9580 valT[pos] = val[el];
9681 }
@@ -140,7 +125,7 @@ void reverseLinkedList(std::vector<Int64>& head, std::vector<Int64>& next) {
140125}
141126
142127void dfsPostorder (Int64 node, Int64& start, std::vector<Int64>& head,
143- const std::vector<Int64>& next, std::vector<Int64 >& order) {
128+ const std::vector<Int64>& next, std::vector<Int >& order) {
144129 // Perform depth first search starting from root node and order the nodes
145130 // starting from the value start. head and next contain the linked list of
146131 // children.
0 commit comments