MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / solveHyper

Function solveHyper

highs/util/HFactor.cpp:61–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static void solveHyper(const HighsInt h_size, const HighsInt* h_lookup,
62 const HighsInt* h_pivot_index,
63 const double* h_pivot_value, const HighsInt* h_start,
64 const HighsInt* h_end, const HighsInt* h_index,
65 const double* h_value, HVector* rhs) {
66 HighsInt rhs_count = rhs->count;
67 HighsInt* rhs_index = rhs->index.data();
68 double* rhs_array = rhs->array.data();
69
70 // Take count
71
72 // Build list
73 char* list_mark = rhs->cwork.data();
74 HighsInt* list_index = rhs->iwork.data();
75 HighsInt* list_stack = &rhs->iwork[h_size];
76 HighsInt list_count = 0;
77
78 HighsInt count_pivot = 0;
79 HighsInt count_entry = 0;
80
81 for (HighsInt i = 0; i < rhs_count; i++) {
82 // Skip touched index
83 HighsInt i_trans =
84 h_lookup[rhs_index[i]]; // XXX: this contains a bug iTran
85 if (list_mark[i_trans]) // XXX bug here
86 continue;
87
88 HighsInt Hi = i_trans; // H matrix pivot index
89 HighsInt Hk = h_start[Hi]; // H matrix non zero position
90 HighsInt n_stack = -1; // Usage of the stack (-1 not used)
91
92 list_mark[Hi] = 1; // Mark this as touched
93
94 for (;;) {
95 if (Hk < h_end[Hi]) {
96 HighsInt Hi_sub = h_lookup[h_index[Hk++]];
97 if (list_mark[Hi_sub] == 0) { // Go to a child
98 list_mark[Hi_sub] = 1; // Mark as touched
99 list_stack[++n_stack] = Hi; // Store current into stack
100 list_stack[++n_stack] = Hk;
101 Hi = Hi_sub; // Replace current with child
102 Hk = h_start[Hi];
103 if (Hi >= h_size) {
104 count_pivot++;
105 count_entry += h_end[Hi] - h_start[Hi];
106 }
107 }
108 } else {
109 list_index[list_count++] = Hi;
110 if (n_stack == -1) // Quit on empty stack
111 break;
112 Hk = list_stack[n_stack--]; // Back to last in stack
113 Hi = list_stack[n_stack--];
114 }
115 }
116 }
117
118 rhs->synthetic_tick += count_pivot * 20 + count_entry * 10;

Callers 4

ftranLMethod · 0.85
btranLMethod · 0.85
ftranUMethod · 0.85
btranUMethod · 0.85

Calls 1

dataMethod · 0.80

Tested by

no test coverage detected