Some KLU warnings are useless for the normal user, as she or he
does not have any means to further analyze or repair the issue:
Warning: KLU ReFactor failed. Factoring again...
Warning (ReFactor Complex): KLU Matrix is SINGULAR
Numerical Rank: %d\n
Singular Node: %d\n
So print these messages only in debug mode.
This commit is contained in:
parent
64307ba907
commit
a6d5ce8ea6
|
|
@ -10,6 +10,7 @@
|
|||
#include "ngspice/spmatrix.h"
|
||||
#include "../sparse/spdefs.h"
|
||||
#include "ngspice/smpdefs.h"
|
||||
#include "ngspice/fteext.h"
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
extern double scalbn(double, int);
|
||||
|
|
@ -535,9 +536,11 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -590,9 +593,11 @@ SMPluFac (SMPmatrix *Matrix, double PivTol, double Gmin)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -655,9 +660,11 @@ SMPluFacKLUforCIDER (SMPmatrix *Matrix)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor for CIDER): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor for CIDER): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -707,9 +714,11 @@ SMPcReorder (SMPmatrix *Matrix, double PivTol, double PivRel, int *NumSwaps)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor Complex): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor Complex): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -765,9 +774,11 @@ SMPreorder (SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -835,9 +846,11 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor for CIDER): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor for CIDER): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -960,9 +973,12 @@ SMPsolve (SMPmatrix *Matrix, double RHS[], double Spare[])
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Solve): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Solve): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
/* FIXME: Do we need a 'return E_SINGULAR' here? */
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
fprintf (stderr, "Error (Solve): KLUcommon object is NULL. A problem occurred\n") ;
|
||||
|
|
|
|||
|
|
@ -166,8 +166,8 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
* This is my mod with KLU. It saves run-time, but also the system at the next iteration may be different.
|
||||
* How do we guarantee that the system is the same at the next iteration? So, the original SPARSE version below sounds like a bug.
|
||||
*/
|
||||
|
||||
fprintf (stderr, "Warning: KLU ReFactor failed. Factoring again...\n") ;
|
||||
if (ft_ngdebug)
|
||||
fprintf (stderr, "Warning: KLU ReFactor failed. Factoring again...\n") ;
|
||||
ckt->CKTniState |= NISHOULDREORDER;
|
||||
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 0 ;
|
||||
error = SMPreorder(ckt->CKTmatrix, ckt->CKTpivotAbsTol, ckt->CKTpivotRelTol, ckt->CKTdiagGmin);
|
||||
|
|
|
|||
Loading…
Reference in New Issue