Browse Source

Fixed KLU returns values so that NIiter can Factor again, if the matrix is numerically singular from the refactorization

Fixed the NIiter code to perform a factorization without reloading the matrix
pre-master-46
Francesco Lannutti 6 years ago
committed by Holger Vogt
parent
commit
710341bbfd
  1. 3
      src/maths/KLU/klusmp.c
  2. 11
      src/maths/ni/niiter.c

3
src/maths/KLU/klusmp.c

@ -568,6 +568,7 @@ SMPcReorder (SMPmatrix *Matrix, double PivTol, double PivRel, int *NumSwaps)
} else {
if (Matrix->CKTkluCommon->status == KLU_SINGULAR) {
fprintf (stderr, "Warning: KLU Matrix is SINGULAR\n") ;
return E_SINGULAR ;
}
return 0 ;
}
@ -614,6 +615,7 @@ SMPreorder (SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin)
} else {
if (Matrix->CKTkluCommon->status == KLU_SINGULAR) {
fprintf (stderr, "Warning: KLU Matrix is SINGULAR\n") ;
return E_SINGULAR ;
}
return 0 ;
}
@ -673,6 +675,7 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix)
} else {
if (Matrix->CKTkluCommon->status == KLU_SINGULAR) {
fprintf (stderr, "Warning (CIDER): KLU Matrix is SINGULAR\n") ;
return E_SINGULAR ;
}
return 0 ;
}

11
src/maths/ni/niiter.c

@ -145,9 +145,20 @@ NIiter(CKTcircuit *ckt, int maxIter)
SPfrontEnd->IFseconds() - startTime;
if (error) {
if (error == E_SINGULAR) {
#ifdef KLU
error = SMPreorder(ckt->CKTmatrix, ckt->CKTpivotAbsTol, ckt->CKTpivotRelTol, ckt->CKTdiagGmin);
ckt->CKTstat->STATreorderTime += SPfrontEnd->IFseconds() - startTime;
if (error) {
SMPgetError(ckt->CKTmatrix, &i, &j);
SPfrontEnd->IFerrorf (ERR_WARNING, "singular matrix: check nodes %s and %s\n", NODENAME(ckt, i), NODENAME(ckt, j));
}
#else
ckt->CKTniState |= NISHOULDREORDER;
DEBUGMSG(" forced reordering....\n");
continue;
#endif
}
/* CKTload(ckt); */
/* SMPprint(ckt->CKTmatrix, stdout); */

Loading…
Cancel
Save