diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index 2808c2175..2d376c2cd 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -186,7 +186,7 @@ com_version(wordlist *wl) #ifdef KLU "** Compiled with KLU Direct Linear Solver\n" - "** (NDEV and URC models not supported yet)\n" + "** (NDEV model not supported yet)\n" #else "** Compiled with Sparse Direct Linear Solver\n" #endif @@ -231,7 +231,7 @@ com_version(wordlist *wl) #ifdef KLU "** Compiled with KLU Direct Linear Solver\n" - "** (NDEV and URC models not supported yet)\n" + "** (NDEV model not supported yet)\n" #else "** Compiled with Sparse Direct Linear Solver\n" #endif diff --git a/src/maths/KLU/klusmp.c b/src/maths/KLU/klusmp.c index a457ca660..4b24faa0e 100644 --- a/src/maths/KLU/klusmp.c +++ b/src/maths/KLU/klusmp.c @@ -126,6 +126,32 @@ void SMPconvertCOOtoCSC (SMPmatrix *Matrix) KluLinkedListCOO *current, *temp ; unsigned int *Ap_COO, current_group, i, j ; + if (Matrix->SMPkluMatrix->KLUmatrixLinkedListNZ == 0) { + /* Assign N and NZ */ + Matrix->SMPkluMatrix->KLUmatrixN = 0 ; + Matrix->SMPkluMatrix->KLUmatrixNZ = 0 ; + + /* Allocate Diag Gmin CSC Vector */ + Matrix->SMPkluMatrix->KLUmatrixDiag = NULL ; + + /* Allocate the temporary COO Column Index */ + Ap_COO = NULL ; + + /* Allocate the needed KLU data structures */ + Matrix->SMPkluMatrix->KLUmatrixAp = (int *) malloc (sizeof (int)) ; + Matrix->SMPkluMatrix->KLUmatrixAi = NULL ; + Matrix->SMPkluMatrix->KLUmatrixBindStructCOO = NULL ; + Matrix->SMPkluMatrix->KLUmatrixAx = NULL ; + Matrix->SMPkluMatrix->KLUmatrixAxComplex = NULL ; + Matrix->SMPkluMatrix->KLUmatrixIntermediate = NULL ; + Matrix->SMPkluMatrix->KLUmatrixIntermediateComplex = NULL ; + + /* Set the Matrix as Real */ + Matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ; + + return ; + } + /* Allocate the compressed COO elements */ MatrixCOO = (Element *) malloc (Matrix->SMPkluMatrix->KLUmatrixLinkedListNZ * sizeof (Element)) ; @@ -1181,8 +1207,13 @@ SMPgetError (SMPmatrix *Matrix, int *Col, int *Row) { if (Matrix->CKTkluMODE) { - *Row = Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1 ; - *Col = Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1 ; + if (Matrix->SMPkluMatrix->KLUmatrixNZ == 0) { + *Row = 0 ; + *Col = 0 ; + } else { + *Row = Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1 ; + *Col = Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1 ; + } } else { spWhereSingular (Matrix->SPmatrix, Row, Col) ; }