MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / analyseVectorValues

Function analyseVectorValues

highs/util/HighsUtils.cpp:305–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void analyseVectorValues(const HighsLogOptions* log_options,
306 const std::string& message, HighsInt vecDim,
307 const std::vector<double>& vec, bool analyseValueList,
308 const std::string& model_name) {
309 assert(vecDim == int(vec.size()));
310 if (vecDim == 0) return;
311 double log10 = log(10.0);
312 const HighsInt nVK = 20;
313 HighsInt nNz = 0;
314 HighsInt nPosInfV = 0;
315 HighsInt nNegInfV = 0;
316 std::vector<HighsInt> posVK;
317 std::vector<HighsInt> negVK;
318 posVK.resize(nVK + 1, 0);
319 negVK.resize(nVK + 1, 0);
320
321 const HighsInt VLsMxZ = 10;
322 std::vector<HighsInt> VLsK;
323 std::vector<double> VLsV;
324 VLsK.resize(VLsMxZ, 0);
325 VLsV.resize(VLsMxZ, 0);
326 // Ensure that 1.0 and -1.0 are counted
327 const HighsInt PlusOneIx = 0;
328 const HighsInt MinusOneIx = 1;
329 bool excessVLsV = false;
330 HighsInt VLsZ = 2;
331 VLsV[PlusOneIx] = 1.0;
332 VLsV[MinusOneIx] = -1.0;
333 double min_abs_value = kHighsInf;
334 double max_abs_value = 0;
335 for (HighsInt ix = 0; ix < vecDim; ix++) {
336 double v = vec[ix];
337 double absV = std::fabs(v);
338 if (absV) {
339 min_abs_value = std::min(absV, min_abs_value);
340 max_abs_value = std::max(absV, max_abs_value);
341 }
342 HighsInt log10V;
343 if (absV > 0) {
344 // Nonzero value
345 nNz++;
346 if (highs_isInfinity(-v)) {
347 //-Inf value
348 nNegInfV++;
349 } else if (highs_isInfinity(v)) {
350 //+Inf value
351 nPosInfV++;
352 } else {
353 // Finite nonzero value
354 if (absV == 1) {
355 log10V = 0;
356 } else if (absV == 10) {
357 log10V = 1;
358 } else if (absV == 100) {
359 log10V = 2;
360 } else if (absV == 1000) {
361 log10V = 3;
362 } else {

Callers 7

debugComputeDualMethod · 0.85
reportVectorMethod · 0.85
reportArraySparseMethod · 0.85
reportPackValueMethod · 0.85
analyseLpFunction · 0.85
assessSmallValuesMethod · 0.85
analyseMatrixSparsityFunction · 0.85

Calls 9

highs_isInfinityFunction · 0.85
highsReportDevInfoFunction · 0.85
highsFormatToStringFunction · 0.85
c_strMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected