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

Function highsSparseTranspose

highs/util/HighsUtils.cpp:60–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void highsSparseTranspose(HighsInt numRow, HighsInt numCol,
61 const std::vector<HighsInt>& Astart,
62 const std::vector<HighsInt>& Aindex,
63 const std::vector<double>& Avalue,
64 std::vector<HighsInt>& ARstart,
65 std::vector<HighsInt>& ARindex,
66 std::vector<double>& ARvalue) {
67 // Make a AR copy
68 std::vector<HighsInt> iwork(numRow, 0);
69 ARstart.resize(numRow + 1, 0);
70 HighsInt AcountX = Aindex.size();
71 ARindex.resize(AcountX);
72 ARvalue.resize(AcountX);
73 for (HighsInt k = 0; k < AcountX; k++) {
74 assert(Aindex[k] < numRow);
75 iwork[Aindex[k]]++;
76 }
77 for (HighsInt i = 1; i <= numRow; i++)
78 ARstart[i] = ARstart[i - 1] + iwork[i - 1];
79 for (HighsInt i = 0; i < numRow; i++) iwork[i] = ARstart[i];
80 for (HighsInt iCol = 0; iCol < numCol; iCol++) {
81 for (HighsInt k = Astart[iCol]; k < Astart[iCol + 1]; k++) {
82 HighsInt iRow = Aindex[k];
83 HighsInt iPut = iwork[iRow]++;
84 ARindex[iPut] = iCol;
85 ARvalue[iPut] = Avalue[k];
86 }
87 }
88}
89
90bool ok(const HighsIndexCollection& index_collection) {
91 // Check parameter for each technique of defining an index collection

Callers 3

runSetupMethod · 0.85
debugMethod · 0.85

Calls 2

resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected