| 31 | } |
| 32 | |
| 33 | HighsStatus 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 | |
| 70 | HighsStatus writeRmatrixPicToFile(const HighsOptions& options, |
| 71 | const std::string& fileprefix, |
no test coverage detected