Handled an empty circuit with KLU

This commit is contained in:
Francesco Lannutti 2023-05-06 15:59:47 +02:00 committed by Holger Vogt
parent 4427a1f6dd
commit 937325e2ce
2 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -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) ;
}