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

Function writeMatrixPicToFile

highs/util/HighsMatrixPic.cpp:33–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33HighsStatus writeMatrixPicToFile(const HighsOptions& options,
34 const std::string& fileprefix,
35 const HighsInt numRow, const HighsInt numCol,
36 const std::vector<HighsInt>& Astart,
37 const std::vector<HighsInt>& Aindex) {
38 if (numRow == 0 || numCol == 0) {
39 highsLogUser(options.log_options, HighsLogType::kError,
40 "Cannot generate image of matrix with a zero dimension\n");
41 return HighsStatus::kError;
42 }
43 assert(numRow > 0);
44 assert(numCol > 0);
45 std::vector<HighsInt> ARlength;
46 std::vector<HighsInt> ARstart;
47 std::vector<HighsInt> ARindex;
48 const HighsInt numNz = Astart[numCol];
49 ARlength.assign(numRow, 0);
50 ARstart.resize(numRow + 1);
51 ARindex.resize(numNz);
52 for (HighsInt iEl = 0; iEl < numNz; iEl++) ARlength[Aindex[iEl]]++;
53 ARstart[0] = 0;
54 for (HighsInt iRow = 0; iRow < numRow; iRow++)
55 ARstart[iRow + 1] = ARstart[iRow] + ARlength[iRow];
56 for (HighsInt iCol = 0; iCol < numCol; iCol++) {
57 for (HighsInt iEl = Astart[iCol]; iEl < Astart[iCol + 1]; iEl++) {
58 HighsInt iRow = Aindex[iEl];
59 ARindex[ARstart[iRow]++] = iCol;
60 }
61 }
62 ARstart[0] = 0;
63 for (HighsInt iRow = 0; iRow < numRow; iRow++)
64 ARstart[iRow + 1] = ARstart[iRow] + ARlength[iRow];
65
66 return writeRmatrixPicToFile(options, fileprefix, numRow, numCol, ARstart,
67 ARindex);
68}
69
70HighsStatus writeRmatrixPicToFile(const HighsOptions& options,
71 const std::string& fileprefix,

Callers 2

writeLpMatrixPicToFileFunction · 0.85
writeHessianPicToFileFunction · 0.85

Calls 3

highsLogUserFunction · 0.85
writeRmatrixPicToFileFunction · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected