Skip to content

Commit 8aa9f01

Browse files
yuxiestkralphs
authored andcommitted
revert the action of copy; instead throw an error.
1 parent 14fd222 commit 8aa9f01

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/MibSModel.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,10 @@ MibSModel::loadProblemData(const CoinPackedMatrix& matrix,
11201120
CoinPackedMatrix *newMatrix = NULL;
11211121
CoinPackedMatrix *matrix1 = NULL; // YX: w/ appended equality constrs
11221122

1123-
// YX: need col mat to start; cp to matrix1 if row-ordered
1123+
// YX: note that MibS defaults to using a column matrix.
11241124
if(!matType){
1125-
matrix1 = new CoinPackedMatrix();
1126-
matrix1->copyOf(matrix);
1127-
matrix1->reverseOrdering();
1125+
throw CoinError("Expect a column-oriented matrix. Try matrix.reverseOrdering() before loading the matrix.",
1126+
"loadProblemData", "MibSModel");
11281127
}
11291128

11301129
// --- prepare for equality constraints (if any) ---
@@ -1184,17 +1183,12 @@ MibSModel::loadProblemData(const CoinPackedMatrix& matrix,
11841183

11851184
// YX: add rows to the problem matrix and link pointers to vectors
11861185
if(numRows > inputNumRows){
1187-
if(!matrix1){
1188-
matrix1 = new CoinPackedMatrix();
1189-
matrix1->copyOf(matrix);
1190-
}
1186+
matrix1 = new CoinPackedMatrix();
1187+
matrix1->copyOf(matrix);
11911188
matrix1->reverseOrdering();
11921189

11931190
rowMatrix = matrix;
1194-
// YX: switch if matrix was col ordered
1195-
if(matType){
1196-
rowMatrix.reverseOrdering();
1197-
}
1191+
rowMatrix.reverseOrdering();
11981192
const double * matElements = rowMatrix.getElements();
11991193
const int * matIndices = rowMatrix.getIndices();
12001194
const int * matStarts = rowMatrix.getVectorStarts();

0 commit comments

Comments
 (0)