Skip to content

Commit b29e728

Browse files
committed
NE values also use linked lists
1 parent a980884 commit b29e728

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

highs/ipm/hipo/ipm/FactorHiGHSSolver.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,30 @@ Int FactorHiGHSSolver::buildNEvalues(const HighsSparseMatrix& A,
8585
for (Int row = 0; row < A.num_row_; ++row) {
8686
// go along the entries of the row, and then down each column.
8787
// this builds the lower triangular part of the row-th column of AAt.
88-
for (Int rowEl = AT_.start_[row]; rowEl < AT_.start_[row + 1]; ++rowEl) {
89-
Int col = AT_.index_[rowEl];
88+
89+
Int current = headNE_[row];
90+
while (current != -1) {
91+
Int col = colNE_[current];
9092

9193
const double theta =
9294
scaling.empty() ? 1.0 : 1.0 / (scaling[col] + regul_.primal);
9395

94-
const double row_value = theta * AT_.value_[rowEl];
96+
const double row_value = theta * A.value_[current];
9597

96-
// for each nonzero in the row, go down corresponding column
97-
for (Int colEl = A.start_[col]; colEl < A.start_[col + 1]; ++colEl) {
98+
// for each nonzero in the row, go down corresponding column, starting
99+
// from current position
100+
for (Int colEl = current; colEl < A.start_[col + 1]; ++colEl) {
98101
Int row2 = A.index_[colEl];
99102

100-
// skip when row2 is above row
101-
if (row2 < row) continue;
103+
// row2 is guaranteed to be larger or equal than row
104+
// (provided that the columns of A are sorted)
102105

103106
// compute and accumulate value
104107
double value = row_value * A.value_[colEl];
105108
work[row2] += value;
106109
}
110+
111+
current = nextNE_[current];
107112
}
108113
// intersection of row with rows below finished.
109114

@@ -124,10 +129,6 @@ Int FactorHiGHSSolver::buildNEstructure(const HighsSparseMatrix& A,
124129
// This approach uses a column-wise copy of A and a collection of linked lists
125130
// to access the rows
126131

127-
// create row-wise copy of the matrix (to be removed later!!!!!!!!)
128-
AT_ = A;
129-
AT_.ensureRowwise();
130-
131132
// NB: A must have sorted columns for this to work
132133

133134
// colNE stores the index of the column of each entry.

highs/ipm/hipo/ipm/FactorHiGHSSolver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class FactorHiGHSSolver : public LinearSolver {
2222
// normal equations data
2323
std::vector<Int> ptrNE_, rowsNE_;
2424
std::vector<double> valNE_;
25-
HighsSparseMatrix AT_;
2625
std::vector<Int> colNE_, nextNE_, headNE_;
2726

2827
const Regularisation& regul_;

0 commit comments

Comments
 (0)