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

Function equalSparseVectors

check/TestLpModification.cpp:1901–1932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1899}
1900
1901bool equalSparseVectors(const HighsInt dim, const HighsInt num_nz0,
1902 const HighsInt* index0, const double* value0,
1903 const HighsInt num_nz1, const HighsInt* index1,
1904 const double* value1) {
1905 if (num_nz0 != num_nz1) {
1906 if (dev_run) printf("num_nz0 != num_nz1\n");
1907 return false;
1908 }
1909 std::vector<double> full_vector;
1910 full_vector.assign(dim, 0);
1911 for (HighsInt iEl = 0; iEl < num_nz0; iEl++)
1912 full_vector[index0[iEl]] = value0[iEl];
1913 for (HighsInt iEl = 0; iEl < num_nz1; iEl++) {
1914 HighsInt iRow = index1[iEl];
1915 if (full_vector[iRow] != value1[iEl]) {
1916 if (dev_run)
1917 printf("vector0[%d] = %g <> %g = vector1[%d]\n", int(iRow),
1918 full_vector[iRow], value1[iEl], int(iRow));
1919 return false;
1920 }
1921
1922 full_vector[iRow] = 0;
1923 }
1924 for (HighsInt iRow = 0; iRow < dim; iRow++)
1925 if (full_vector[iRow]) {
1926 if (dev_run)
1927 printf("Full vector[%d] = %g, not zero\n", int(iRow),
1928 full_vector[iRow]);
1929 return false;
1930 }
1931 return true;
1932}
1933
1934TEST_CASE("resize-integrality", "[highs_data]") {
1935 Highs highs;

Callers 2

testAvgasGetRowFunction · 0.85
testAvgasGetColFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected