Sketcher: Optimize eliminateNonZerosOverPivotInUpperTriangularMatrix for sparse matrices
Matrix processing function eliminateNonZerosOverPivotInUpperTriangularMatrix tried to eliminate ALL non zero values in the upper triangle, even values under a small epsilon. This makes the routine take much more time than it should be. Not considering small values significantly speeds it up, ultimately increasing sketch constraint solving performance.
This commit is contained in:
committed by
Kacper Donat
parent
26a1e452c0
commit
0b44a3f6c8
@@ -5423,12 +5423,12 @@ void System::eliminateNonZerosOverPivotInUpperTriangularMatrix(Eigen::MatrixXd&
|
||||
// eliminate non zeros above pivot
|
||||
assert(R(i, i) != 0);
|
||||
for (int row = 0; row < i; row++) {
|
||||
if (R(row, i) != 0) {
|
||||
if (fabs(R(row, i)) > 1e-10) {
|
||||
double coef = R(row, i) / R(i, i);
|
||||
R.block(row, i + 1, 1, R.cols() - i - 1) -= coef
|
||||
* R.block(i, i + 1, 1, R.cols() - i - 1);
|
||||
R(row, i) = 0;
|
||||
}
|
||||
R(row, i) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user