Skip to content

Commit 9e384e7

Browse files
committed
Small fixes
1 parent c824b1c commit 9e384e7

File tree

10 files changed

+27
-28
lines changed

10 files changed

+27
-28
lines changed

highs/io/HighsIO.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ void highsLogHeader(const HighsLogOptions& log_options,
3333
hipo::getIntegerModelString(hipo::getBlasIntegerModel());
3434

3535
#ifdef BLAS_LIBRARIES
36-
highsLogUser(log_options, HighsLogType::kInfo, "Using blas: %s - %s\n",
36+
highsLogUser(log_options, HighsLogType::kInfo, "Using BLAS: %s - %s\n",
3737
BLAS_LIBRARIES, blas_model.c_str());
3838
#else
3939
#ifdef HIPO_USES_OPENBLAS
40-
highsLogUser(log_options, HighsLogType::kInfo, "Using blas: OpenBLAS - %s\n",
40+
highsLogUser(log_options, HighsLogType::kInfo, "Using BLAS: OpenBLAS - %s\n",
4141
blas_model.c_str());
4242
#else
43-
highsLogUser(log_options, HighsLogType::kInfo, "Using blas: unknown - %s\n",
43+
highsLogUser(log_options, HighsLogType::kInfo, "Using BLAS: unknown - %s\n",
4444
blas_model.c_str());
4545
#endif
4646
#endif

highs/ipm/hipo/auxiliary/Auxiliary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Int64 getDiagStart(Int n, Int k, Int nb, Int n_blocks,
203203
}
204204

205205
Int jb = std::min(nb, k - (n_blocks - 1) * nb);
206-
Int64 result = start.back() + (n - (n_blocks - 1) * nb) * jb;
206+
Int64 result = start.back() + (Int64)(n - (n_blocks - 1) * nb) * jb;
207207
if (triang) result -= jb * (jb - 1) / 2;
208208
return result;
209209
}

highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ HybridHybridFormatHandler::HybridHybridFormatHandler(
1515
: FormatHandler(S, sn, regul, frontal, clique_ptr), data_{data} {
1616
// initialise frontal and clique
1717
initFrontal();
18+
19+
// if CliqueStack is used, clique_ptr already points to a valid region of
20+
// memory for the clique. Otherwise, allocate it locally.
1821
if (!clique_ptr_) initClique();
1922
}
2023

@@ -26,7 +29,8 @@ void HybridHybridFormatHandler::initFrontal() {
2629
frontal_.resize(frontal_size);
2730
std::memset(frontal_.data(), 0, frontal_size * sizeof(double));
2831

29-
// extra_space is not needed, but it avoid some weird issue on windows
32+
// extra_space is not needed, but if I remove it Windows in debug freezes...
33+
// who knows what's happening
3034

3135
// frontal_ is actually allocated just the first time, then the memory is
3236
// reused from the previous factorisations and just initialised.

highs/ipm/hipo/factorhighs/HybridSolveHandler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace hipo {
1212
HybridSolveHandler::HybridSolveHandler(
1313
const Symbolic& S, const std::vector<std::vector<double>>& sn_columns,
1414
const std::vector<std::vector<Int>>& swaps,
15-
const std::vector<std::vector<double>>& pivot_2x2)
16-
: SolveHandler(S, sn_columns), swaps_{swaps}, pivot_2x2_{pivot_2x2} {}
15+
const std::vector<std::vector<double>>& pivot_2x2, DataCollector& data)
16+
: SolveHandler(S, sn_columns, data), swaps_{swaps}, pivot_2x2_{pivot_2x2} {}
1717

1818
void HybridSolveHandler::forwardSolve(std::vector<double>& x) const {
1919
// Forward solve.
@@ -73,7 +73,7 @@ void HybridSolveHandler::forwardSolve(std::vector<double>& x) const {
7373
clock.start();
7474
#endif
7575
callAndTime_dtrsv('U', 'T', 'U', jb, &sn_columns_[sn][SnCol_ind], jb,
76-
&x[x_start], 1, *data_);
76+
&x[x_start], 1, data_);
7777

7878
SnCol_ind += diag_entries;
7979

@@ -82,7 +82,7 @@ void HybridSolveHandler::forwardSolve(std::vector<double>& x) const {
8282
std::vector<double> y(gemv_space);
8383

8484
callAndTime_dgemv('T', jb, gemv_space, 1.0, &sn_columns_[sn][SnCol_ind],
85-
jb, &x[x_start], 1, 0.0, y.data(), 1, *data_);
85+
jb, &x[x_start], 1, 0.0, y.data(), 1, data_);
8686
SnCol_ind += jb * gemv_space;
8787
#if HIPO_TIMING_LEVEL >= 2
8888
if (data_) data_->sumTime(kTimeSolveSolve_dense, clock.stop());
@@ -191,11 +191,11 @@ void HybridSolveHandler::backwardSolve(std::vector<double>& x) const {
191191
#endif
192192
SnCol_ind -= jb * gemv_space;
193193
callAndTime_dgemv('N', jb, gemv_space, -1.0, &sn_columns_[sn][SnCol_ind],
194-
jb, y.data(), 1, 1.0, &x[x_start], 1, *data_);
194+
jb, y.data(), 1, 1.0, &x[x_start], 1, data_);
195195

196196
SnCol_ind -= diag_entries;
197197
callAndTime_dtrsv('U', 'N', 'U', jb, &sn_columns_[sn][SnCol_ind], jb,
198-
&x[x_start], 1, *data_);
198+
&x[x_start], 1, data_);
199199
#if HIPO_TIMING_LEVEL >= 2
200200
if (data_) data_->sumTime(kTimeSolveSolve_dense, clock.stop());
201201
#endif

highs/ipm/hipo/factorhighs/HybridSolveHandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class HybridSolveHandler : public SolveHandler {
1717
HybridSolveHandler(const Symbolic& S,
1818
const std::vector<std::vector<double>>& sn_columns,
1919
const std::vector<std::vector<Int>>& swaps,
20-
const std::vector<std::vector<double>>& pivot_2x2);
20+
const std::vector<std::vector<double>>& pivot_2x2,
21+
DataCollector& data);
2122
};
2223

2324
} // namespace hipo

highs/ipm/hipo/factorhighs/Numeric.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ Int Numeric::solve(std::vector<double>& x) const {
1919
if (!sn_columns_ || !S_) return kRetInvalidPointer;
2020

2121
// initialise solve handler
22-
SH_.reset(new HybridSolveHandler(*S_, *sn_columns_, swaps_, pivot_2x2_));
23-
24-
SH_->setData(data_);
22+
SH_.reset(
23+
new HybridSolveHandler(*S_, *sn_columns_, swaps_, pivot_2x2_, *data_));
2524

2625
#if HIPO_TIMING_LEVEL >= 1
2726
Clock clock{};
@@ -44,9 +43,6 @@ Int Numeric::solve(std::vector<double>& x) const {
4443

4544
#if HIPO_TIMING_LEVEL >= 2
4645
if (data_) data_->sumTime(kTimeSolveSolve, clock_fine.stop());
47-
#endif
48-
49-
#if HIPO_TIMING_LEVEL >= 2
5046
clock_fine.start();
5147
#endif
5248
// unpermute solution

highs/ipm/hipo/factorhighs/SolveHandler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
namespace hipo {
44

55
SolveHandler::SolveHandler(const Symbolic& S,
6-
const std::vector<std::vector<double>>& sn_columns)
7-
: S_{S}, sn_columns_{sn_columns} {}
8-
9-
void SolveHandler::setData(DataCollector* data) { data_ = data; }
6+
const std::vector<std::vector<double>>& sn_columns,
7+
DataCollector& data)
8+
: S_{S}, sn_columns_{sn_columns}, data_{data} {}
109

1110
} // namespace hipo

highs/ipm/hipo/factorhighs/SolveHandler.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class SolveHandler {
2020
protected:
2121
const Symbolic& S_;
2222
const std::vector<std::vector<double>>& sn_columns_;
23-
DataCollector* data_;
23+
DataCollector& data_;
2424

2525
public:
2626
SolveHandler(const Symbolic& S,
27-
const std::vector<std::vector<double>>& sn_columns);
27+
const std::vector<std::vector<double>>& sn_columns,
28+
DataCollector& data);
2829

2930
// avoid copies
3031
SolveHandler(const SolveHandler&) = delete;
@@ -40,8 +41,6 @@ class SolveHandler {
4041
virtual void forwardSolve(std::vector<double>& x) const = 0;
4142
virtual void backwardSolve(std::vector<double>& x) const = 0;
4243
virtual void diagSolve(std::vector<double>& x) const = 0;
43-
44-
void setData(DataCollector* data);
4544
};
4645

4746
} // namespace hipo

highs/ipm/hipo/factorhighs/Symbolic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Int Symbolic::consecutiveSums(Int i, Int j) const {
3838
Int64 Symbolic::cliqueBlockStart(Int sn, Int bl) const {
3939
return clique_block_start_[sn][bl];
4040
}
41-
Int64 Symbolic::cliqueSize(Int64 sn) const {
41+
Int64 Symbolic::cliqueSize(Int sn) const {
4242
return clique_block_start_[sn].back();
4343
}
4444
Int64 Symbolic::maxStackSize() const { return max_stack_size_; }

highs/ipm/hipo/factorhighs/Symbolic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Symbolic {
124124
Int relindClique(Int i, Int j) const;
125125
Int consecutiveSums(Int i, Int j) const;
126126
Int64 cliqueBlockStart(Int sn, Int bl) const;
127-
Int64 cliqueSize(Int64 sn) const;
127+
Int64 cliqueSize(Int sn) const;
128128
Int64 maxStackSize() const;
129129
bool parTree() const;
130130
bool parNode() const;

0 commit comments

Comments
 (0)