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

Function checkIncreasingSort

check/TestSort.cpp:56–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void checkIncreasingSort(const HighsInt num_sorted,
57 const vector<double>& values,
58 const vector<HighsInt>& indices,
59 const vector<double>& original_values) {
60 // Check that the random numbers are ascending and that the indices
61 // point from the original values to their new positions
62 bool error0 = false;
63 bool error1 = false;
64 double previous = -kHighsInf;
65 for (HighsInt ix = 0; ix < num_sorted; ix++) {
66 if (values[1 + ix] < previous) {
67 printf("Values[%2" HIGHSINT_FORMAT "] = %f5.4 < %f5.4 = previous\n",
68 1 + ix, values[1 + ix], previous);
69 error0 = true;
70 }
71 previous = values[1 + ix];
72 if (values[1 + ix] != original_values[1 + indices[1 + ix]]) {
73 printf("Values[%2" HIGHSINT_FORMAT
74 "] = %f5.4 != %f5.4 = original_values[indices[%2" HIGHSINT_FORMAT
75 "]]\n",
76 1 + ix, values[1 + ix], original_values[indices[1 + ix]], 1 + ix);
77 error1 = true;
78 }
79 }
80
81 REQUIRE(error0 == false);
82 REQUIRE(error1 == false);
83}
84
85void checkDecreasingSort(const HighsInt num_sorted,
86 const vector<double>& values,

Callers 1

TestSort.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected