Skip to content

Commit c820cf0

Browse files
committed
make local functions static
- avoid missing-declaration warnings, and allows inlining
1 parent 3728494 commit c820cf0

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

highs/ipm/hipo/auxiliary/KrylovMethods.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
namespace hipo {
1010

11-
void applyRotation(double& x, double& y, double c, double s) {
11+
static void applyRotation(double& x, double& y, double c, double s) {
1212
double t = c * x + s * y;
1313
y = -s * x + c * y;
1414
x = t;
1515
}
16-
void getRotation(double x, double y, double& c, double& s) {
16+
static void getRotation(double x, double y, double& c, double& s) {
1717
if (y == 0.0) {
1818
c = 1.0;
1919
s = 0.0;
@@ -27,8 +27,8 @@ void getRotation(double x, double y, double& c, double& s) {
2727
s = t * c;
2828
}
2929
}
30-
void update(std::vector<double>& x, Int k, std::vector<double>& H, Int ldh,
31-
std::vector<double>& s, std::vector<std::vector<double>>& V) {
30+
static void update(std::vector<double>& x, Int k, std::vector<double>& H, Int ldh,
31+
std::vector<double>& s, std::vector<std::vector<double>>& V) {
3232
// Solve H * y = s
3333
std::vector<double> y = s;
3434
for (Int i = k; i >= 0; --i) {

highs/ipm/hipo/factorhighs/DenseFactKernel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace hipo {
1111

1212
// Dense Factorisation kernel
1313

14-
std::pair<Int, double> maxInCol(Int j, Int n, Int m, double* A, Int lda) {
14+
static std::pair<Int, double> maxInCol(Int j, Int n, Int m, double* A, Int lda) {
1515
// Given the symemtric matrix A, of size nxn, accessed with leading dimension
1616
// lda, in upper triangular format, ignoring rows 0:j-1, find the maximum in
1717
// row/col m.
@@ -37,7 +37,7 @@ std::pair<Int, double> maxInCol(Int j, Int n, Int m, double* A, Int lda) {
3737
return {r, maxval};
3838
}
3939

40-
void staticReg(double& pivot, Int sign, const Regul& regval, double& totalreg) {
40+
static void staticReg(double& pivot, Int sign, const Regul& regval, double& totalreg) {
4141
// apply static regularisation
4242

4343
double old_pivot = pivot;
@@ -48,9 +48,9 @@ void staticReg(double& pivot, Int sign, const Regul& regval, double& totalreg) {
4848
totalreg = pivot - old_pivot;
4949
}
5050

51-
bool blockBunchKaufman(Int j, Int n, double* A, Int lda, Int* swaps, Int* sign,
52-
double thresh, const Regul& regval, double* totalreg,
53-
DataCollector& data) {
51+
static bool blockBunchKaufman(Int j, Int n, double* A, Int lda, Int* swaps, Int* sign,
52+
double thresh, const Regul& regval, double* totalreg,
53+
DataCollector& data) {
5454
// Perform Bunch-Kaufman pivoting within a block of the supernode (see Schenk,
5555
// Gartner, ETNA 2006).
5656
// It works only for upper triangular A.

highs/ipm/hipo/factorhighs/SymScaling.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
namespace hipo {
99

10-
void product(const std::vector<double>& x, std::vector<double>& y,
11-
const std::vector<Int>& ptr, const std::vector<Int>& rows,
12-
const std::vector<double>& N) {
10+
static void product(const std::vector<double>& x, std::vector<double>& y,
11+
const std::vector<Int>& ptr, const std::vector<Int>& rows,
12+
const std::vector<double>& N) {
1313
// Multiply by matrix E, i.e. matrix A with all entries equal to one, in lower
1414
// triangular form, and sum component-wise product of N with x.
1515
// E * x + N .* x= y
@@ -30,10 +30,10 @@ void product(const std::vector<double>& x, std::vector<double>& y,
3030
// multiply by N
3131
for (Int i = 0; i < n; ++i) y[i] += N[i] * x[i];
3232
}
33-
void CG_for_CR_scaling(const std::vector<double>& b, std::vector<double>& x,
34-
const std::vector<double>& N,
35-
const std::vector<Int>& ptr,
36-
const std::vector<Int>& rows) {
33+
static void CG_for_CR_scaling(const std::vector<double>& b, std::vector<double>& x,
34+
const std::vector<double>& N,
35+
const std::vector<Int>& ptr,
36+
const std::vector<Int>& rows) {
3737
Int n = N.size();
3838

3939
// initial residual

highs/ipm/hipo/factorhighs/Symbolic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const std::vector<Int>& Symbolic::snParent() const { return sn_parent_; }
4545
const std::vector<Int>& Symbolic::snStart() const { return sn_start_; }
4646
const std::vector<Int>& Symbolic::pivotSign() const { return pivot_sign_; }
4747

48-
std::string memoryString(double mem) {
48+
static std::string memoryString(double mem) {
4949
std::stringstream ss;
5050

5151
if (mem < 1024)

highs/ipm/hipo/ipm/CurtisReidScaling.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace hipo {
99

10-
void product(const double* x, std::vector<double>& y,
11-
const std::vector<Int>& ptr, const std::vector<Int>& rows) {
10+
static void product(const double* x, std::vector<double>& y,
11+
const std::vector<Int>& ptr, const std::vector<Int>& rows) {
1212
// Multiply by matrix E, i.e. matrix A with all entries equal to one
1313
// E * x = y
1414
Int n = ptr.size() - 1;
@@ -19,9 +19,9 @@ void product(const double* x, std::vector<double>& y,
1919
}
2020
}
2121

22-
void product_transpose(const double* x, std::vector<double>& y,
23-
const std::vector<Int>& ptr,
24-
const std::vector<Int>& rows) {
22+
static void product_transpose(const double* x, std::vector<double>& y,
23+
const std::vector<Int>& ptr,
24+
const std::vector<Int>& rows) {
2525
// Multiply by matrix E^T, i.e. matrix A^T with all entries equal to one
2626
// E^T * x = y
2727
Int n = ptr.size() - 1;

highs/ipm/hipo/ipm/FactorHiGHSSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ void FactorHiGHSSolver::clear() {
2525
FH_.newIter();
2626
}
2727

28-
Int getASstructure(const HighsSparseMatrix& A, std::vector<Int>& ptr,
29-
std::vector<Int>& rows) {
28+
static Int getASstructure(const HighsSparseMatrix& A, std::vector<Int>& ptr,
29+
std::vector<Int>& rows) {
3030
// Augmented system structure
3131

3232
Int nA = A.num_col_;

0 commit comments

Comments
 (0)