diff --git a/src/maths/KLU/klusmp.c b/src/maths/KLU/klusmp.c index d22c36f94..6519b189c 100644 --- a/src/maths/KLU/klusmp.c +++ b/src/maths/KLU/klusmp.c @@ -593,6 +593,10 @@ SMPluFac (SMPmatrix *Matrix, double PivTol, double Gmin) if (ret == 0) { + if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { + fprintf (stderr, "Error (ReFactor): KLUcommon object is NULL. A problem occurred\n") ; + return 1; + } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) { if (ft_ngdebug) { fprintf(stderr, "Warning (ReFactor): KLU Matrix is SINGULAR\n"); @@ -601,9 +605,6 @@ SMPluFac (SMPmatrix *Matrix, double PivTol, double Gmin) } return E_SINGULAR ; } - if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { - fprintf (stderr, "Error (ReFactor): KLUcommon object is NULL. A problem occurred\n") ; - } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX) { fprintf (stderr, "Error (ReFactor): KLU Matrix is empty\n") ; @@ -611,8 +612,8 @@ SMPluFac (SMPmatrix *Matrix, double PivTol, double Gmin) } if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL) { fprintf (stderr, "Error (ReFactor): KLUnumeric object is NULL. A problem occurred\n") ; + return 1 ; } - return 1 ; } else { return 0 ; } @@ -660,6 +661,10 @@ SMPluFacKLUforCIDER (SMPmatrix *Matrix) if (ret == 0) { + if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { + fprintf (stderr, "Error (ReFactor for CIDER): KLUcommon object is NULL. A problem occurred\n") ; + return 1; + } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) { if (ft_ngdebug) { fprintf(stderr, "Warning (ReFactor for CIDER): KLU Matrix is SINGULAR\n"); @@ -668,9 +673,6 @@ SMPluFacKLUforCIDER (SMPmatrix *Matrix) } return E_SINGULAR ; } - if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { - fprintf (stderr, "Error (ReFactor for CIDER): KLUcommon object is NULL. A problem occurred\n") ; - } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX) { fprintf (stderr, "Error (ReFactor for CIDER): KLU Matrix is empty\n") ; @@ -678,8 +680,8 @@ SMPluFacKLUforCIDER (SMPmatrix *Matrix) } if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL) { fprintf (stderr, "Error (ReFactor for CIDER): KLUnumeric object is NULL. A problem occurred\n") ; + return 1 ; } - return 1 ; } else { return 0 ; } @@ -785,6 +787,7 @@ SMPreorder (SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin) if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { fprintf (stderr, "Error (Factor): KLUnumeric object is NULL. A problem occurred\n") ; fprintf (stderr, "Error (Factor): KLUcommon object is NULL. A problem occurred\n") ; + return 1; } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX) { fprintf (stderr, "Error (Factor): KLU Matrix is empty\n") ; @@ -846,6 +849,11 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix) if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL) { + if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { + fprintf (stderr, "Error (Factor for CIDER): KLUnumeric object is NULL. A problem occurred\n") ; + fprintf (stderr, "Error (Factor for CIDER): KLUcommon object is NULL. A problem occurred\n") ; + return 1; + } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) { if (ft_ngdebug) { fprintf(stderr, "Warning (Factor for CIDER): KLU Matrix is SINGULAR\n"); @@ -854,10 +862,6 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix) } return E_SINGULAR ; } - if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) { - fprintf (stderr, "Error (Factor for CIDER): KLUnumeric object is NULL. A problem occurred\n") ; - fprintf (stderr, "Error (Factor for CIDER): KLUcommon object is NULL. A problem occurred\n") ; - } if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_EMPTY_MATRIX) { fprintf (stderr, "Error (Factor for CIDER): KLU Matrix is empty\n") ; return 0 ; @@ -865,8 +869,8 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix) if (Matrix->SMPkluMatrix->KLUmatrixSymbolic == NULL) { fprintf (stderr, "Error (Factor for CIDER): KLUnumeric object is NULL. A problem occurred\n") ; fprintf (stderr, "Error (Factor for CIDER): KLUsymbolic object is NULL. A problem occurred\n") ; + return 1 ; } - return 1 ; } else { return 0 ; }