From a5f01ca9532718a16791fd1fc76473be6d1f6916 Mon Sep 17 00:00:00 2001 From: JAJHall Date: Fri, 10 Jan 2025 23:29:45 +0000 Subject: [PATCH] Now passing HighsSparseMatrix matrix to getSubVectors and getSubVectorsTranspose by reference, not value; formatted --- src/Highs.h | 8 ++++++++ src/lp_data/HighsLpUtils.cpp | 5 ++--- src/lp_data/HighsLpUtils.h | 4 ++-- src/util/HighsTimer.h | 10 ++++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Highs.h b/src/Highs.h index 50b4da9da6..53326c8707 100644 --- a/src/Highs.h +++ b/src/Highs.h @@ -1316,6 +1316,14 @@ class Highs { return ekk_instance_.primal_phase1_dual_; } + /** + * @brief Development methods + */ + HighsInt defineClock(const char* name) { + return this->timer_.clock_def(name); + } + void writeAllClocks() { this->timer_.writeAllClocks(); } + // Start of deprecated methods std::string compilationDate() const { return "deprecated"; } diff --git a/src/lp_data/HighsLpUtils.cpp b/src/lp_data/HighsLpUtils.cpp index 266938f467..6b6042fc03 100644 --- a/src/lp_data/HighsLpUtils.cpp +++ b/src/lp_data/HighsLpUtils.cpp @@ -23,7 +23,6 @@ #include "util/HighsCDouble.h" #include "util/HighsMatrixUtils.h" #include "util/HighsSort.h" -#include "util/HighsTimer.h" using std::fabs; using std::max; @@ -3081,7 +3080,7 @@ void removeRowsOfCountOne(const HighsLogOptions& log_options, HighsLp& lp) { void getSubVectors(const HighsIndexCollection& index_collection, const HighsInt data_dim, const double* data0, const double* data1, const double* data2, - const HighsSparseMatrix matrix, HighsInt& num_sub_vector, + const HighsSparseMatrix& matrix, HighsInt& num_sub_vector, double* sub_vector_data0, double* sub_vector_data1, double* sub_vector_data2, HighsInt& sub_matrix_num_nz, HighsInt* sub_matrix_start, HighsInt* sub_matrix_index, @@ -3137,7 +3136,7 @@ void getSubVectors(const HighsIndexCollection& index_collection, void getSubVectorsTranspose(const HighsIndexCollection& index_collection, const HighsInt data_dim, const double* data0, const double* data1, const double* data2, - const HighsSparseMatrix matrix, + const HighsSparseMatrix& matrix, HighsInt& num_sub_vector, double* sub_vector_data0, double* sub_vector_data1, double* sub_vector_data2, HighsInt& sub_matrix_num_nz, diff --git a/src/lp_data/HighsLpUtils.h b/src/lp_data/HighsLpUtils.h index 318999ed1f..867e92c12c 100644 --- a/src/lp_data/HighsLpUtils.h +++ b/src/lp_data/HighsLpUtils.h @@ -278,7 +278,7 @@ void removeRowsOfCountOne(const HighsLogOptions& log_options, HighsLp& lp); void getSubVectors(const HighsIndexCollection& index_collection, const HighsInt data_dim, const double* data0, const double* data1, const double* data2, - const HighsSparseMatrix matrix, HighsInt& num_sub_vector, + const HighsSparseMatrix& matrix, HighsInt& num_sub_vector, double* sub_vector_data0, double* sub_vector_data1, double* sub_vector_data2, HighsInt& sub_matrix_num_nz, HighsInt* sub_matrix_start, HighsInt* sub_matrix_index, @@ -287,7 +287,7 @@ void getSubVectors(const HighsIndexCollection& index_collection, void getSubVectorsTranspose(const HighsIndexCollection& index_collection, const HighsInt data_dim, const double* data0, const double* data1, const double* data2, - const HighsSparseMatrix matrix, + const HighsSparseMatrix& matrix, HighsInt& num_sub_vector, double* sub_vector_data0, double* sub_vector_data1, double* sub_vector_data2, HighsInt& sub_matrix_num_nz, diff --git a/src/util/HighsTimer.h b/src/util/HighsTimer.h index 71f1c63223..a171866fe5 100644 --- a/src/util/HighsTimer.h +++ b/src/util/HighsTimer.h @@ -126,6 +126,16 @@ class HighsTimer { } } + /** + * @brief write all clocks + */ + void writeAllClocks() { + for (HighsInt i = 0; i < num_clock; i++) + if (clock_num_call[i]) + printf("Time %7.5f for %9d calls of clock %3d: %s\n", clock_time[i], + int(clock_num_call[i]), int(i), clock_names[i].c_str()); + } + /** * @brief Start a clock */