Browse Source

Fixed a crash when SPARSE is used

pre-master-46
Francesco Lannutti 6 years ago
committed by Holger Vogt
parent
commit
caf1ee7c47
  1. 22
      src/maths/ni/niiter.c

22
src/maths/ni/niiter.c

@ -114,7 +114,9 @@ NIiter(CKTcircuit *ckt, int maxIter)
startTime = SPfrontEnd->IFseconds();
#ifdef KLU
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 1 ;
if (ckt->CKTkluMODE) {
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 1 ;
}
#endif
error = SMPreorder(ckt->CKTmatrix, ckt->CKTpivotAbsTol,
@ -146,7 +148,9 @@ NIiter(CKTcircuit *ckt, int maxIter)
startTime = SPfrontEnd->IFseconds();
#ifdef KLU
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 1 ;
if (ckt->CKTkluMODE) {
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 1 ;
}
#endif
error = SMPluFac(ckt->CKTmatrix, ckt->CKTpivotAbsTol,
@ -155,7 +159,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
SPfrontEnd->IFseconds() - startTime;
#ifdef KLU
if (error == E_SINGULAR) {
if ((ckt->CKTkluMODE) && (error == E_SINGULAR)) {
/* Francesco Lannutti - 25 Aug 2020
* If the matrix is numerically singular during ReFactorization, take the same matrix and factor it from scratch in the same iteration.
@ -183,9 +187,17 @@ NIiter(CKTcircuit *ckt, int maxIter)
return(error);
}
} else 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));
if (!(ckt->CKTkluMODE) && (error == E_SINGULAR)) {
/* Francesco Lannutti - 25 Aug 2020
* If the matrix is numerically singular during ReFactorization, factor it from scratch at the next iteration.
* This is the original SPICE3F5 code and uses SPARSE.
*/
ckt->CKTniState |= NISHOULDREORDER;
DEBUGMSG(" forced reordering....\n");
continue;
}
/* CKTload(ckt); */
/* SMPprint(ckt->CKTmatrix, stdout); */
/* seems to be singular - pass the bad news up */

Loading…
Cancel
Save