In the very rare case of pPivot being NULL, prevent a crsh

by reordering the matrix.
This commit is contained in:
Holger Vogt 2023-02-22 15:31:47 +01:00
parent d9b52eb3e1
commit da77fad749
1 changed files with 5 additions and 0 deletions

View File

@ -228,6 +228,11 @@ spOrderAndFactor(MatrixPtr Matrix, RealNumber RHS[], RealNumber RelThreshold,
INCRESP;
#endif
pPivot = Matrix->Diag[Step];
if (!pPivot) {
fprintf(stderr, "Warning: spfactor.c, 230, Pivot for step = %d not found\n", Step);
ReorderingRequired = YES;
break; /* for loop */
}
LargestInCol = FindLargestInCol(pPivot->NextInCol);
if ((LargestInCol * RelThreshold < ELEMENT_MAG(pPivot))) {
if (Matrix->Complex)