Skip to content

Commit 1a20eb6

Browse files
committed
Do not refer to matrix to factorise as A
1 parent adfb8ea commit 1a20eb6

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

highs/ipm/hipo/factorhighs/Factorise.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
namespace hipo {
1616

17-
Factorise::Factorise(const Symbolic& S, const std::vector<Int>& rowsA,
18-
const std::vector<Int>& ptrA,
19-
const std::vector<double>& valA, const Regul& regul,
17+
Factorise::Factorise(const Symbolic& S, const std::vector<Int>& rowsM,
18+
const std::vector<Int>& ptrM,
19+
const std::vector<double>& valM, const Regul& regul,
2020
const Log* log, DataCollector& data,
2121
std::vector<std::vector<double>>& sn_columns,
2222
CliqueStack* stack)
@@ -30,7 +30,7 @@ Factorise::Factorise(const Symbolic& S, const std::vector<Int>& rowsA,
3030
// factorisation coming from Analyse.
3131
// Only the lower triangular part of the matrix is used.
3232

33-
n_ = ptrA.size() - 1;
33+
n_ = ptrM.size() - 1;
3434

3535
if (n_ != S_.size()) {
3636
if (log_)
@@ -41,22 +41,22 @@ Factorise::Factorise(const Symbolic& S, const std::vector<Int>& rowsA,
4141
}
4242

4343
// Make a copy of the matrix to be factorised
44-
rowsA_ = rowsA;
45-
valA_ = valA;
46-
ptrA_ = ptrA;
44+
rowsM_ = rowsM;
45+
valM_ = valM;
46+
ptrM_ = ptrM;
4747

4848
// Permute the matrix.
4949
// This also removes any entry not in the lower triangle.
5050
permute(S_.iperm());
5151

52-
nzA_ = ptrA_.back();
52+
nzM_ = ptrM_.back();
5353

5454
// Double transpose to sort columns
5555
std::vector<Int> temp_ptr(n_ + 1);
56-
std::vector<Int> temp_rows(nzA_);
57-
std::vector<double> temp_val(nzA_);
58-
transpose(ptrA_, rowsA_, valA_, temp_ptr, temp_rows, temp_val);
59-
transpose(temp_ptr, temp_rows, temp_val, ptrA_, rowsA_, valA_);
56+
std::vector<Int> temp_rows(nzM_);
57+
std::vector<double> temp_val(nzM_);
58+
transpose(ptrM_, rowsM_, valM_, temp_ptr, temp_rows, temp_val);
59+
transpose(temp_ptr, temp_rows, temp_val, ptrM_, rowsM_, valM_);
6060

6161
// create linked lists of children in supernodal elimination tree
6262
childrenLinkedList(S_.snParent(), first_child_, next_child_);
@@ -70,28 +70,28 @@ Factorise::Factorise(const Symbolic& S, const std::vector<Int>& rowsA,
7070
max_diag_ = 0.0;
7171
min_diag_ = kHighsInf;
7272
for (Int col = 0; col < n_; ++col) {
73-
double val = std::abs(valA_[ptrA_[col]]);
73+
double val = std::abs(valM_[ptrM_[col]]);
7474
max_diag_ = std::max(max_diag_, val);
7575
min_diag_ = std::min(min_diag_, val);
7676
}
7777

78-
// one norm of columns of A
78+
// one norm of columns of M
7979
std::vector<double> one_norm_cols(n_, 0.0);
8080
for (Int col = 0; col < n_; ++col) {
81-
for (Int el = ptrA_[col]; el < ptrA_[col + 1]; ++el) {
82-
Int row = rowsA_[el];
83-
double val = valA_[el];
81+
for (Int el = ptrM_[col]; el < ptrM_[col + 1]; ++el) {
82+
Int row = rowsM_[el];
83+
double val = valM_[el];
8484
one_norm_cols[col] += std::abs(val);
8585
if (row != col) one_norm_cols[row] += std::abs(val);
8686
}
8787
}
88-
A_norm1_ = *std::max_element(one_norm_cols.begin(), one_norm_cols.end());
88+
M_norm1_ = *std::max_element(one_norm_cols.begin(), one_norm_cols.end());
8989

90-
data_.setNorms(A_norm1_, max_diag_);
90+
data_.setNorms(M_norm1_, max_diag_);
9191
}
9292

9393
void Factorise::permute(const std::vector<Int>& iperm) {
94-
// Symmetric permutation of the lower triangular matrix A based on inverse
94+
// Symmetric permutation of the lower triangular matrix M based on inverse
9595
// permutation iperm.
9696
// The resulting matrix is lower triangular, regardless of the input matrix.
9797

@@ -103,8 +103,8 @@ void Factorise::permute(const std::vector<Int>& iperm) {
103103
const Int col = iperm[j];
104104

105105
// go through elements of column
106-
for (Int el = ptrA_[j]; el < ptrA_[j + 1]; ++el) {
107-
const Int i = rowsA_[el];
106+
for (Int el = ptrM_[j]; el < ptrM_[j + 1]; ++el) {
107+
const Int i = rowsM_[el];
108108

109109
// ignore potential entries in upper triangular part
110110
if (i < j) continue;
@@ -133,8 +133,8 @@ void Factorise::permute(const std::vector<Int>& iperm) {
133133
const Int col = iperm[j];
134134

135135
// go through elements of column
136-
for (Int el = ptrA_[j]; el < ptrA_[j + 1]; ++el) {
137-
const Int i = rowsA_[el];
136+
for (Int el = ptrM_[j]; el < ptrM_[j + 1]; ++el) {
137+
const Int i = rowsM_[el];
138138

139139
// ignore potential entries in upper triangular part
140140
if (i < j) continue;
@@ -148,13 +148,13 @@ void Factorise::permute(const std::vector<Int>& iperm) {
148148

149149
Int pos = work[actual_col]++;
150150
new_rows[pos] = actual_row;
151-
new_val[pos] = valA_[el];
151+
new_val[pos] = valM_[el];
152152
}
153153
}
154154

155-
ptrA_ = std::move(new_ptr);
156-
rowsA_ = std::move(new_rows);
157-
valA_ = std::move(new_val);
155+
ptrM_ = std::move(new_ptr);
156+
rowsM_ = std::move(new_rows);
157+
valM_ = std::move(new_val);
158158
}
159159

160160
class TaskGroupSpecial : public highs::parallel::TaskGroup {
@@ -232,7 +232,7 @@ void Factorise::processSupernode(Int sn) {
232232
HIPO_CLOCK_STOP(2, data_, kTimeFactorisePrepare);
233233

234234
// ===================================================
235-
// Assemble original matrix A into frontal
235+
// Assemble original matrix M into frontal
236236
// ===================================================
237237
HIPO_CLOCK_START(2);
238238
// j is relative column index in the frontal matrix
@@ -241,11 +241,11 @@ void Factorise::processSupernode(Int sn) {
241241
const Int col = sn_begin + j;
242242

243243
// go through the column
244-
for (Int el = ptrA_[col]; el < ptrA_[col + 1]; ++el) {
244+
for (Int el = ptrM_[col]; el < ptrM_[col + 1]; ++el) {
245245
// relative row index in the frontal matrix
246246
const Int i = S_.relindCols(el);
247247

248-
FH->assembleFrontal(i, j, valA_[el]);
248+
FH->assembleFrontal(i, j, valM_[el]);
249249
}
250250
}
251251
HIPO_CLOCK_STOP(2, data_, kTimeFactoriseAssembleOriginal);
@@ -343,7 +343,7 @@ void Factorise::processSupernode(Int sn) {
343343
HIPO_CLOCK_START(2);
344344
// threshold for regularisation
345345
// const double reg_thresh = max_diag_ * kDynamicDiagCoeff;
346-
const double reg_thresh = A_norm1_ * kDynamicDiagCoeff;
346+
const double reg_thresh = M_norm1_ * kDynamicDiagCoeff;
347347

348348
if (Int flag = FH->denseFactorise(reg_thresh)) {
349349
flag_stop_ = true;

highs/ipm/hipo/factorhighs/Factorise.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ namespace hipo {
1414
class Factorise {
1515
public:
1616
// matrix to factorise
17-
std::vector<Int> rowsA_{};
18-
std::vector<Int> ptrA_{};
19-
std::vector<double> valA_{};
17+
std::vector<Int> rowsM_{};
18+
std::vector<Int> ptrM_{};
19+
std::vector<double> valM_{};
2020
Int n_{};
21-
Int nzA_{};
21+
Int nzM_{};
2222

2323
// symbolic factorisation
2424
const Symbolic& S_;
@@ -51,7 +51,7 @@ class Factorise {
5151
// largest diagonal element in the original matrix and norms of columns
5252
double max_diag_{};
5353
double min_diag_{};
54-
double A_norm1_{};
54+
double M_norm1_{};
5555

5656
// regularisation
5757
std::vector<double> total_reg_{};
@@ -72,8 +72,8 @@ class Factorise {
7272
void processSupernode(Int sn);
7373

7474
public:
75-
Factorise(const Symbolic& S, const std::vector<Int>& rowsA,
76-
const std::vector<Int>& ptrA, const std::vector<double>& valA,
75+
Factorise(const Symbolic& S, const std::vector<Int>& rowsM,
76+
const std::vector<Int>& ptrM, const std::vector<double>& valM,
7777
const Regul& regul, const Log* log, DataCollector& data,
7878
std::vector<std::vector<double>>& sn_columns, CliqueStack* stack);
7979

highs/ipm/hipo/factorhighs/Symbolic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class Symbolic {
5555
// Relative indices of original columns wrt columns of L.
5656
// - relind_cols_[i] contains the relative indices of entry i, with respect to
5757
// the numbering of the frontal matrix of the corresponding supernode.
58-
// - Given the row indices of the original matrix, rowsA:
58+
// - Given the row indices of the original matrix, rowsM:
5959
// relind_cols_[i] = k implies that the i-th entry of the original matrix
60-
// (which has original row index given by rowsA[i]) corresponds to the row
60+
// (which has original row index given by rowsM[i]) corresponds to the row
6161
// in position k in the frontal matrix of the supernode corresponding to the
6262
// column to which the i-th entry belongs.
6363
// This is useful when assemblying the entries of the original matrix into

0 commit comments

Comments
 (0)