Getting rid of SPARSE for Initial Circuit Matrix creation. Now KLU is totally independent from SPARSE. This opens up the interface for other solvers as well

SPARSE can still used through '.options sparse', but it isn't possible to switch from KLU to SPARSE and viceversa at run-time
This commit is contained in:
Francesco Lannutti 2020-07-12 17:57:16 +02:00 committed by Holger Vogt
parent 4d00b67b4d
commit fe89da2b2c
83 changed files with 997 additions and 2069 deletions

View File

@ -119,7 +119,7 @@ NUMDadmittance(ONEdevice *pDevice, double omega, SPcomplex *yd)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -315,7 +315,7 @@ NBJTadmittance(ONEdevice *pDevice, double omega, SPcomplex *yIeVce,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -580,7 +580,7 @@ NUMDys(ONEdevice *pDevice, SPcomplex *s, SPcomplex *yd)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -667,7 +667,7 @@ NBJTys(ONEdevice *pDevice, SPcomplex *s, SPcomplex *yIeVce,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif

View File

@ -251,77 +251,6 @@ ONE_jacBuild(ONEdevice *pDevice)
}
#ifdef KLU
/*
#define CREATE_KLU_BINDING_TABLE_CIDER(ptr, binding, a, b) \
printf ("Swapping Pointer %s: (%d,%d)\n", #ptr, a, b) ; \
if ((a > 0) && (b > 0)) { \
if (pNode->binding != NULL) { \
if (pNode->binding->CSC_Complex != NULL) { \
printf (" Looking for the Pointer: %p\n", pNode->binding->CSC_Complex) ; \
qsort (BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
i.COO = NULL ; \
i.CSC_Complex = pNode->binding->CSC_Complex ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
if (matched != NULL) { \
printf (" Found the Old Pointer\n") ; \
pNode->ptr = pNode->binding->CSC_Complex ; \
} else { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
if (matched != NULL) { \
printf (" Looking for the Pointer 1\n") ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} else { \
printf (" Leaving the Pointer as is\n") ; \
} \
} \
} else { \
printf (" Looking for the Pointer 2\n") ; \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} else { \
printf (" Looking for the Pointer 3\n") ; \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
}
*/
/*
#define CREATE_KLU_BINDING_TABLE_CIDER_TO_REAL(ptr, binding, a, b) \
if ((a > 0) && (b > 0)) { \
printf ("Macro\n") ; \
if (pNode->binding) { \
printf ("IF: %p\n", pNode->binding) ; \
printf ("COO: %p\n", pNode->binding->COO) ; \
printf ("CSC: %p\n", pNode->binding->CSC) ; \
if (pNode->binding->CSC_Complex) { \
printf ("CSC_Complex: %p\n", pNode->binding->CSC_Complex) ; \
pNode->ptr = pNode->binding->CSC_Complex ; \
} else { \
i = pNode->ptr ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} else { \
i = pNode->ptr ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
}
*/
void
ONEbindCSC (ONEdevice *pDevice)
{
@ -331,13 +260,13 @@ ONEbindCSC (ONEdevice *pDevice)
int psiEqn, nEqn, pEqn; /* scratch for deref'd eqn numbers */
int psiEqnL=0, nEqnL=0, pEqnL=0;
int psiEqnR=0, nEqnR=0, pEqnR=0;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
size_t nz ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -70,64 +70,19 @@ ONEQjacBuild(ONEdevice *pDevice)
}
#ifdef KLU
/*
#define CREATE_KLU_BINDING_TABLE_CIDER(ptr, binding, a, b) \
printf ("Swapping Pointer %s: (%d,%d)\n", #ptr, a, b) ; \
if ((a > 0) && (b > 0)) { \
if (pNode->binding != NULL) { \
if (pNode->binding->CSC_Complex != NULL) { \
printf (" Looking for the Pointer: %p\n", pNode->binding->CSC_Complex) ; \
qsort (BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
i.COO = NULL ; \
i.CSC_Complex = pNode->binding->CSC_Complex ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
if (matched != NULL) { \
printf (" Found the Old Pointer\n") ; \
pNode->ptr = pNode->binding->CSC_Complex ; \
} else { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
if (matched != NULL) { \
printf (" Looking for the Pointer 1\n") ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} else { \
printf (" Leaving the Pointer as is\n") ; \
} \
} \
} else { \
printf (" Looking for the Pointer 2\n") ; \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} else { \
printf (" Looking for the Pointer 3\n") ; \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
}
*/
void
ONEQbindCSC (ONEdevice *pDevice)
{
ONEelem *pElem ;
ONEnode *pNode, *pNode1 ;
int index ;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
size_t nz ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -592,7 +592,7 @@ ONEequilSolve(ONEdevice *pDevice)
#ifdef KLU
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, CKTkluMatrixReal) ;
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, KLUmatrixReal) ;
#else
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
#endif
@ -605,7 +605,7 @@ ONEequilSolve(ONEdevice *pDevice)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
} else {
#endif
@ -636,7 +636,8 @@ ONEequilSolve(ONEdevice *pDevice)
}
}
printf ("CIDER: KLU to be fixed: spElementCount\n") ;
pDevice->numOrigEquil = 0 ; // Francesco Lannutti - Fix for KLU
pDevice->numOrigEquil = 0 ; //pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
//+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff ;
} else {
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
}
@ -666,9 +667,8 @@ ONEequilSolve(ONEdevice *pDevice)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - Fix for KLU
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
pDevice->numFillEquil = 0 ;
pDevice->numFillEquil = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
} else {
#endif
@ -752,7 +752,7 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
#ifdef KLU
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, CKTkluMatrixComplex) ;
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, KLUMatrixComplex) ;
#else
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
#endif
@ -796,7 +796,7 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
} else {
#endif
@ -826,9 +826,8 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - Fix for KLU
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
pDevice->numFillBias = 0 ;
pDevice->numFillBias = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
} else {
#endif

View File

@ -105,7 +105,7 @@ NUMD2admittance(TWOdevice *pDevice, double omega, SPcomplex *yd)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -292,7 +292,7 @@ NBJT2admittance(TWOdevice *pDevice, double omega, SPcomplex *yIeVce,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -577,7 +577,7 @@ NUMOSadmittance(TWOdevice *pDevice, double omega, struct mosAdmittances *yAc)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -1180,7 +1180,7 @@ NUMD2ys(TWOdevice *pDevice, SPcomplex *s, SPcomplex *yIn)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -1277,7 +1277,7 @@ NBJT2ys(TWOdevice *pDevice, SPcomplex *s, SPcomplex *yIeVce, SPcomplex *yIcVce,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif
@ -1399,7 +1399,7 @@ NUMOSys(TWOdevice *pDevice, SPcomplex *s, struct mosAdmittances *yAc)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - To be completed
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
} else {
#endif

View File

@ -902,7 +902,7 @@ TWObindCSC (TWOdevice *pDevice)
TWOelem *pElem;
TWOnode *pNode;
TWOchannel *pCh;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
int index ;
size_t nz ;
@ -916,10 +916,10 @@ TWObindCSC (TWOdevice *pDevice)
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -577,7 +577,7 @@ TWONbindCSC (TWOdevice *pDevice)
TWOelem *pElem;
TWOnode *pNode;
TWOchannel *pCh;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
int index ;
size_t nz ;
@ -591,10 +591,10 @@ TWONbindCSC (TWOdevice *pDevice)
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -577,7 +577,7 @@ TWOPbindCSC (TWOdevice *pDevice)
TWOelem *pElem;
TWOnode *pNode;
TWOchannel *pCh;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
int index ;
size_t nz ;
@ -591,10 +591,10 @@ TWOPbindCSC (TWOdevice *pDevice)
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -165,13 +165,13 @@ TWOQbindCSC (TWOdevice *pDevice)
TWOnode *pNode, *pNode1;
int eIndex, nIndex;
int index ;
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
size_t nz ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
for (index = 0 ; index < (int)nz ; index++) {
BindStructCSC [index] = BindStruct [index] ;
}

View File

@ -505,7 +505,7 @@ int TWOequilSolve(TWOdevice *pDevice)
#ifdef KLU
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, CKTkluMatrixReal) ;
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, KLUmatrixReal) ;
#else
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
#endif
@ -519,7 +519,7 @@ int TWOequilSolve(TWOdevice *pDevice)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
} else {
#endif
@ -550,7 +550,8 @@ int TWOequilSolve(TWOdevice *pDevice)
}
}
printf ("CIDER: KLU to be fixed: spElementCount\n") ;
pDevice->numOrigEquil = 0 ; // Francesco Lannutti - Fix for KLU
pDevice->numOrigEquil = 0 ; //pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
//+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff ;
} else {
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
}
@ -580,9 +581,8 @@ int TWOequilSolve(TWOdevice *pDevice)
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - Fix for KLU
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
pDevice->numFillEquil = 0 ;
pDevice->numFillEquil = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
} else {
#endif
@ -666,7 +666,7 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
#ifdef KLU
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, CKTkluMatrixComplex) ;
error = SMPnewMatrixKLUforCIDER (pDevice->matrix, pDevice->numEqns, KLUMatrixComplex) ;
#else
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
#endif
@ -708,7 +708,9 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
return ; // Francesco Lannutti - Fix KLU return values
}
}
pDevice->numOrigBias = 0 ; // Francesco Lannutti - Fix for KLU
printf ("CIDER: KLU to be fixed: spElementCount\n") ;
pDevice->numOrigBias = 0 ; //pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
//+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff ;
} else {
pDevice->numOrigBias = spElementCount(pDevice->matrix->SPmatrix);
}
@ -723,7 +725,7 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
} else {
#endif
@ -753,13 +755,12 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
#ifdef KLU
if (pDevice->matrix->CKTkluMODE) {
// Francesco Lannutti - Fix for KLU
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
pDevice->numFillBias = 0 ;
pDevice->numFillBias = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
} else {
#endif
pDevice->numFillBias = spFillinCount (pDevice->matrix->SPmatrix) ; // Francesco Lannutti - Fix for KLU
pDevice->numFillBias = spFillinCount (pDevice->matrix->SPmatrix) ;
#ifdef KLU
}

View File

@ -328,7 +328,7 @@ struct CKTcircuit {
#ifdef KLU
unsigned int CKTkluMODE:1;
unsigned int CKTkluMemGrowFactor : 1 ;
double CKTkluMemGrowFactor ;
#endif
};

View File

@ -1,101 +1,118 @@
#ifndef _KLU_BINDING_H
#define _KLU_BINDING_H
#include "ngspice/klu.h"
#define CREATE_KLU_BINDING_TABLE(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) { \
i = here->ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((here->a > 0) && (here->b > 0)) { \
i.COO = here->ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
if (matched == NULL) { \
printf ("Ptr %p not found in BindStruct Table\n", here->ptr) ; \
} \
here->binding = matched ; \
here->ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
if ((here->a > 0) && (here->b > 0)) \
here->ptr = here->binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
if ((here->a > 0) && (here->b > 0)) \
here->ptr = here->binding->CSC ;
#ifdef XSPICE
#define CREATE_KLU_BINDING_TABLE_XSPICE_OUTPUTS(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_out->b != 0)) { \
i = smp_data_out->ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((smp_data_out->a > 0) && (smp_data_out->b > 0)) { \
i.COO = smp_data_out->ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
smp_data_out->binding = matched ; \
smp_data_out->ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_OUTPUTS(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_out->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_out->b > 0)) \
smp_data_out->ptr = smp_data_out->binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_OUTPUTS(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_out->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_out->b > 0)) \
smp_data_out->ptr = smp_data_out->binding->CSC ;
#define CREATE_KLU_BINDING_TABLE_XSPICE_INPUTS_E(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) { \
i = smp_data_out->input[k].port[l].ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) { \
i.COO = smp_data_out->input[k].port[l].ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
smp_data_out->input[k].port[l].e.binding = matched ; \
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_E(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].e.binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_INPUTS_E(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].e.binding->CSC ;
#define CREATE_KLU_BINDING_TABLE_XSPICE_INPUTS_F(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) { \
i = smp_data_out->input[k].port[l].ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) { \
i.COO = smp_data_out->input[k].port[l].ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
smp_data_out->input[k].port[l].f.binding = matched ; \
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_F(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].f.binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_INPUTS_F(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].f.binding->CSC ;
#define CREATE_KLU_BINDING_TABLE_XSPICE_INPUTS_G(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) { \
i = smp_data_out->input[k].port[l].ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) { \
i.COO = smp_data_out->input[k].port[l].ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
smp_data_out->input[k].port[l].g.binding = matched ; \
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_G(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].g.binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_INPUTS_G(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].g.binding->CSC ;
#define CREATE_KLU_BINDING_TABLE_XSPICE_INPUTS_H(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) { \
i = smp_data_out->input[k].port[l].ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) { \
i.COO = smp_data_out->input[k].port[l].ptr ; \
i.CSC = NULL ; \
i.CSC_Complex = NULL ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
smp_data_out->input[k].port[l].h.binding = matched ; \
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_H(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].h.binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_INPUTS_H(ptr, binding, a, b) \
if ((smp_data_out->a != 0) && (smp_data_cntl->b != 0)) \
if ((smp_data_out->a > 0) && (smp_data_cntl->b > 0)) \
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].h.binding->CSC ;
#endif
@ -104,34 +121,35 @@
if ((a > 0) && (b > 0)) { \
if (pNode->binding != NULL) { \
if (pNode->binding->CSC_Complex != NULL) { \
qsort (BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
i.COO = NULL ; \
i.CSC_Complex = pNode->binding->CSC_Complex ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
if (matched == NULL) { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
if (matched != NULL) { \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} \
} else { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
qsort (BindStructCSC, nz, sizeof (BindElementKLUforCIDER), BindKluCompareCSCKLUforCIDER) ; \
i.COO = NULL ; \
i.CSC_Complex = pNode->binding->CSC_Complex ; \
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStructCSC, nz, sizeof (BindElementKLUforCIDER), BindKluCompareCSCKLUforCIDER) ; \
if (matched == NULL) { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
if (matched != NULL) { \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} \
} else { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
} else { \
pNode->ptr = matched->CSC_Complex ; \
} \
} else { \
i.COO = pNode->ptr ; \
i.CSC_Complex = NULL ; \
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
i.CSC_Complex = NULL ; \
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
pNode->binding = matched ; \
pNode->ptr = matched->CSC_Complex ; \
} \
}
#endif
#endif

View File

@ -935,34 +935,63 @@ int klu_z_convert_matrix_in_CSR
klu_common *Common
) ;
typedef struct sBindElement {
double *COO ;
double *CSC ;
double *CSC_Complex ;
} BindElement ;
#ifdef CIDER
typedef struct sBindKluElementCOO {
typedef struct sBindElementKLUforCIDER {
double *COO ;
double *CSC_Complex ;
} BindKluElementCOO ;
} BindElementKLUforCIDER ;
#endif
int BindKluCompareCOO (const void *a, const void *b) ;
int BindKluCompareCSC (const void *a, const void *b) ;
typedef struct sKluLinkedListCOO {
unsigned int row ;
unsigned int col ;
double *pointer ;
struct sKluLinkedListCOO *next ;
} KluLinkedListCOO ;
int BindCompare (const void *a, const void *b) ;
#ifdef CIDER
int BindCompareKLUforCIDER (const void *a, const void *b) ;
int BindKluCompareCSCKLUforCIDER (const void *a, const void *b) ;
#endif
typedef struct sKLUmatrix {
klu_common *KLUmatrixCommon ; /* KLU common object */
klu_symbolic *KLUmatrixSymbolic ; /* KLU symbolic object */
klu_numeric *KLUmatrixNumeric ; /* KLU numeric object */
int *KLUmatrixAp ; /* KLU column pointer */
int *KLUmatrixAi ; /* KLU row pointer */
double *KLUmatrixAxComplex ; /* KLU Complex Elements */
unsigned int KLUmatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
double *KLUmatrixIntermediateComplex ; /* KLU iRHS Intermediate for Solve Complex Step */
unsigned int KLUmatrixN ; /* KLU N, copied */
unsigned int KLUmatrixNZ ; /* KLU nz, copied for AC Analysis */
int *KLUmatrixColCOO ; /* KLU Col Index for COO storage */
int *KLUmatrixRowCOO ; /* KLU Row Index for COO storage */
double *KLUmatrixValueComplexCOO ; /* KLU Complex Elements for COO storage */
BindKluElementCOO *KLUmatrixBindStructCOO ; /* KLU COO Binding Structure */
double *KLUmatrixTrashCOO ; /* KLU COO Trash Pointer for Ground Node not Stored in the Matrix */
} KLUmatrix ;
klu_common *KLUmatrixCommon ; /* KLU common object */
klu_symbolic *KLUmatrixSymbolic ; /* KLU symbolic object */
klu_numeric *KLUmatrixNumeric ; /* KLU numeric object */
int *KLUmatrixAp ; /* KLU column pointer */
int *KLUmatrixAi ; /* KLU row pointer */
double *KLUmatrixAx ; /* KLU Real Elements */
double *KLUmatrixAxComplex ; /* KLU Complex Elements */
unsigned int KLUmatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
#define KLUmatrixReal 0 /* KLU Matrix Real definition */
#define KLUMatrixComplex 1 /* KLU Matrix Complex definition */
double *KLUmatrixIntermediate ; /* KLU RHS Intermediate for Solve Real Step */
double *KLUmatrixIntermediateComplex ; /* KLU iRHS Intermediate for Solve Complex Step */
unsigned int KLUmatrixN ; /* KLU N */
unsigned int KLUmatrixNZ ; /* KLU nz */
BindElement *KLUmatrixBindStructCOO ; /* KLU COO Binding Structure */
KluLinkedListCOO *KLUmatrixLinkedListCOO ; /* KLU COO in Linked List Format for Initial Parsing */
unsigned int KLUmatrixLinkedListNZ ; /* KLU nz for the Initial Parsing */
double *KLUmatrixTrashCOO ; /* KLU COO Trash Pointer for Ground Node not Stored in the Matrix */
double **KLUmatrixDiag ; /* KLU pointer to diagonal element to perform Gmin */
#ifdef CIDER
int *KLUmatrixColCOOforCIDER ; /* KLU Col Index for COO storage (for CIDER) */
int *KLUmatrixRowCOOforCIDER ; /* KLU Row Index for COO storage (for CIDER) */
double *KLUmatrixValueComplexCOOforCIDER ; /* KLU Complex Elements for COO storage (for CIDER) */
BindElementKLUforCIDER *KLUmatrixBindStructForCIDER ; /* KLU COO Binding Structure (for CIDER) */
#endif
} KLUmatrix ;
/* ========================================================================== */
/* === KLU version ========================================================== */
/* ========================================================================== */

View File

@ -38,10 +38,10 @@ typedef struct sONEelem {
double *KLUrightLeftNode ;
double *KLUrightRightNode ;
BindKluElementCOO *KLUleftLeftNodeBinding ;
BindKluElementCOO *KLUleftRightNodeBinding ;
BindKluElementCOO *KLUrightLeftNodeBinding ;
BindKluElementCOO *KLUrightRightNodeBinding ;
BindElementKLUforCIDER *KLUleftLeftNodeBinding ;
BindElementKLUforCIDER *KLUleftRightNodeBinding ;
BindElementKLUforCIDER *KLUrightLeftNodeBinding ;
BindElementKLUforCIDER *KLUrightRightNodeBinding ;
#endif
@ -132,29 +132,29 @@ typedef struct sONEnode {
double *fPNiP1;
#ifdef KLU
BindKluElementCOO *fPsiPsiiM1Binding ;
BindKluElementCOO *fPsiPsiBinding ;
BindKluElementCOO *fPsiPsiiP1Binding ;
BindKluElementCOO *fPsiNBinding ;
BindKluElementCOO *fPsiPBinding ;
BindKluElementCOO *fNPsiiM1Binding ;
BindKluElementCOO *fNPsiBinding ;
BindKluElementCOO *fNPsiiP1Binding ;
BindKluElementCOO *fNNiM1Binding ;
BindKluElementCOO *fNNBinding ;
BindKluElementCOO *fNNiP1Binding ;
BindKluElementCOO *fNPiM1Binding ;
BindKluElementCOO *fNPBinding ;
BindKluElementCOO *fNPiP1Binding ;
BindKluElementCOO *fPPsiiM1Binding ;
BindKluElementCOO *fPPsiBinding ;
BindKluElementCOO *fPPsiiP1Binding ;
BindKluElementCOO *fPPiM1Binding ;
BindKluElementCOO *fPPBinding ;
BindKluElementCOO *fPPiP1Binding ;
BindKluElementCOO *fPNiM1Binding ;
BindKluElementCOO *fPNBinding ;
BindKluElementCOO *fPNiP1Binding ;
BindElementKLUforCIDER *fPsiPsiiM1Binding ;
BindElementKLUforCIDER *fPsiPsiBinding ;
BindElementKLUforCIDER *fPsiPsiiP1Binding ;
BindElementKLUforCIDER *fPsiNBinding ;
BindElementKLUforCIDER *fPsiPBinding ;
BindElementKLUforCIDER *fNPsiiM1Binding ;
BindElementKLUforCIDER *fNPsiBinding ;
BindElementKLUforCIDER *fNPsiiP1Binding ;
BindElementKLUforCIDER *fNNiM1Binding ;
BindElementKLUforCIDER *fNNBinding ;
BindElementKLUforCIDER *fNNiP1Binding ;
BindElementKLUforCIDER *fNPiM1Binding ;
BindElementKLUforCIDER *fNPBinding ;
BindElementKLUforCIDER *fNPiP1Binding ;
BindElementKLUforCIDER *fPPsiiM1Binding ;
BindElementKLUforCIDER *fPPsiBinding ;
BindElementKLUforCIDER *fPPsiiP1Binding ;
BindElementKLUforCIDER *fPPiM1Binding ;
BindElementKLUforCIDER *fPPBinding ;
BindElementKLUforCIDER *fPPiP1Binding ;
BindElementKLUforCIDER *fPNiM1Binding ;
BindElementKLUforCIDER *fPNBinding ;
BindElementKLUforCIDER *fPNiP1Binding ;
#endif
} ONEnode;

View File

@ -28,39 +28,19 @@ typedef struct sSMPmatrix {
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
#ifdef KLU
klu_common *CKTkluCommon ; /* KLU common object */
klu_symbolic *CKTkluSymbolic ; /* KLU symbolic object */
klu_numeric *CKTkluNumeric ; /* KLU numeric object */
int *CKTkluAp ; /* KLU column pointer */
int *CKTkluAi ; /* KLU row pointer */
double *CKTkluAx ; /* KLU Real Elements */
double *CKTkluAx_Complex ; /* KLU Complex Elements */
unsigned int CKTkluMatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
#define CKTkluMatrixReal 0 /* KLU Matrix Real definition */
#define CKTkluMatrixComplex 1 /* KLU Matrix Complex definition */
double *CKTkluIntermediate ; /* KLU RHS Intermediate for Solve Real Step */
double *CKTkluIntermediate_Complex ; /* KLU iRHS Intermediate for Solve Complex Step */
BindElement *CKTbindStruct ; /* KLU - Sparse Binding Structure */
double **CKTdiag_CSC ; /* KLU pointer to diagonal element to perform Gmin */
int CKTkluN ; /* KLU N, copied */
int CKTklunz ; /* KLU nz, copied for AC Analysis */
KLUmatrix *SMPkluMatrix ; /* KLU Pointer to the KLU Matrix Data Structure (only for CIDER, for the moment) */
unsigned int CKTkluMODE:1 ; /* KLU MODE parameter to enable KLU or not from the heuristic */
#define CKTkluON 1 /* KLU MODE ON definition */
#define CKTkluOFF 0 /* KLU MODE OFF definition */
#ifdef CIDER
KLUmatrix *SMPkluMatrix ; /* KLU Pointer to the KLU Matrix Data Structure (only for CIDER, for the moment) */
#endif
double CKTkluMemGrowFactor ; /* KLU Memory Grow Factor - default = 1.2 */
#endif
} SMPmatrix ;
#ifdef KLU
void SMPmatrix_CSC (SMPmatrix *) ;
void SMPnnz (SMPmatrix *) ;
void spDeterminant_KLU (SMPmatrix *, int *, double *, double *) ;
void SMPconvertCOOtoCSC (SMPmatrix *) ;
#ifdef CIDER
void SMPsolveKLUforCIDER (SMPmatrix *, double [], double [], double [], double []) ;
@ -74,9 +54,10 @@ int SMPluFacKLUforCIDER (SMPmatrix *) ;
void SMPprintKLUforCIDER (SMPmatrix *, char *) ;
#endif
#else
int SMPaddElt (SMPmatrix *, int, int, double) ;
#endif
int SMPaddElt( SMPmatrix *, int , int , double );
double * SMPmakeElt( SMPmatrix * , int , int );
void SMPcClear( SMPmatrix *);
void SMPclear( SMPmatrix *);
@ -112,3 +93,4 @@ void SMPsolveForCIDER (SMPmatrix *, double [], double []) ;
#endif
#endif

View File

@ -296,20 +296,7 @@ extern void spMultTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
extern void spSolve( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* );
extern void spSolveTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
/* Francesco Lannutti - CSC Data Structure Conversion */
#ifdef KLU
typedef struct sBindElement {
double *Sparse ;
double *CSC ;
double *CSC_Complex ;
} BindElement ;
extern int WriteCol_original (MatrixPtr, int, spREAL *, spREAL *, int *, BindElement *, spREAL **) ;
extern int WriteCol_original_dump (MatrixPtr, int, spREAL *, int *, unsigned int) ;
extern void spMatrix_CSC (MatrixPtr, int *, int *, double *, double *, int, BindElement *, double **) ;
extern void spMatrix_CSC_dump (MatrixPtr, unsigned int, char *) ;
extern void spRHS_CSC_dump (spREAL *, char *, MatrixPtr) ;
#endif
/* ------------------------------------------------------ */
#endif /* spOKAY */

View File

@ -76,7 +76,7 @@ struct TSKtask {
#ifdef KLU
unsigned int TSKkluMODE:1;
unsigned int TSKkluMemGrowFactor : 1 ;
double TSKkluMemGrowFactor ;
#endif
};

View File

@ -55,11 +55,10 @@ typedef struct sTWOelem
double *KLUrightLeftNode ;
double *KLUrightRightNode ;
BindKluElementCOO *KLUleftLeftNodeBinding ;
BindKluElementCOO *KLUleftRightNodeBinding ;
BindKluElementCOO *KLUrightLeftNodeBinding ;
BindKluElementCOO *KLUrightRightNodeBinding ;
BindElementKLUforCIDER *KLUleftLeftNodeBinding ;
BindElementKLUforCIDER *KLUleftRightNodeBinding ;
BindElementKLUforCIDER *KLUrightLeftNodeBinding ;
BindElementKLUforCIDER *KLUrightRightNodeBinding ;
#endif
} TWOelem;
@ -213,63 +212,63 @@ typedef struct sTWOnode {
double *fPPsiOxP1;
#ifdef KLU
BindKluElementCOO *fPsiPsiBinding ;
BindKluElementCOO *fPsiNBinding ;
BindKluElementCOO *fPsiPBinding ;
BindKluElementCOO *fNPsiBinding ;
BindKluElementCOO *fNNBinding ;
BindKluElementCOO *fNPBinding ;
BindKluElementCOO *fPPsiBinding ;
BindKluElementCOO *fPNBinding ;
BindKluElementCOO *fPPBinding ;
BindKluElementCOO *fPsiPsiiP1Binding ;
BindKluElementCOO *fPsiPsijP1Binding ;
BindKluElementCOO *fNPsiiP1Binding ;
BindKluElementCOO *fNNiP1Binding ;
BindKluElementCOO *fNPsijP1Binding ;
BindKluElementCOO *fNNjP1Binding ;
BindKluElementCOO *fPPsiiP1Binding ;
BindKluElementCOO *fPPiP1Binding ;
BindKluElementCOO *fPPsijP1Binding ;
BindKluElementCOO *fPPjP1Binding ;
BindKluElementCOO *fNPsiiP1jP1Binding ;
BindKluElementCOO *fNNiP1jP1Binding ;
BindKluElementCOO *fPPsiiP1jP1Binding ;
BindKluElementCOO *fPPiP1jP1Binding ;
BindKluElementCOO *fPsiPsiiM1Binding ;
BindKluElementCOO *fNPsiiM1Binding ;
BindKluElementCOO *fNNiM1Binding ;
BindKluElementCOO *fPPsiiM1Binding ;
BindKluElementCOO *fPPiM1Binding ;
BindKluElementCOO *fNPsiiM1jP1Binding ;
BindKluElementCOO *fNNiM1jP1Binding ;
BindKluElementCOO *fPPsiiM1jP1Binding ;
BindKluElementCOO *fPPiM1jP1Binding ;
BindKluElementCOO *fPsiPsijM1Binding ;
BindKluElementCOO *fNPsijM1Binding ;
BindKluElementCOO *fNNjM1Binding ;
BindKluElementCOO *fPPsijM1Binding ;
BindKluElementCOO *fPPjM1Binding ;
BindKluElementCOO *fNPsiiM1jM1Binding ;
BindKluElementCOO *fNNiM1jM1Binding ;
BindKluElementCOO *fPPsiiM1jM1Binding ;
BindKluElementCOO *fPPiM1jM1Binding ;
BindKluElementCOO *fNPsiiP1jM1Binding ;
BindKluElementCOO *fNNiP1jM1Binding ;
BindKluElementCOO *fPPsiiP1jM1Binding ;
BindKluElementCOO *fPPiP1jM1Binding ;
BindKluElementCOO *fNPsiInBinding ;
BindKluElementCOO *fNPsiInP1Binding ;
BindKluElementCOO *fNPsiOxBinding ;
BindKluElementCOO *fNPsiOxP1Binding ;
BindKluElementCOO *fPPsiInBinding ;
BindKluElementCOO *fPPsiInP1Binding ;
BindKluElementCOO *fPPsiOxBinding ;
BindKluElementCOO *fPPsiOxP1Binding ;
BindKluElementCOO *fNPsiInM1Binding ;
BindKluElementCOO *fNPsiOxM1Binding ;
BindKluElementCOO *fPPsiInM1Binding ;
BindKluElementCOO *fPPsiOxM1Binding ;
BindElementKLUforCIDER *fPsiPsiBinding ;
BindElementKLUforCIDER *fPsiNBinding ;
BindElementKLUforCIDER *fPsiPBinding ;
BindElementKLUforCIDER *fNPsiBinding ;
BindElementKLUforCIDER *fNNBinding ;
BindElementKLUforCIDER *fNPBinding ;
BindElementKLUforCIDER *fPPsiBinding ;
BindElementKLUforCIDER *fPNBinding ;
BindElementKLUforCIDER *fPPBinding ;
BindElementKLUforCIDER *fPsiPsiiP1Binding ;
BindElementKLUforCIDER *fPsiPsijP1Binding ;
BindElementKLUforCIDER *fNPsiiP1Binding ;
BindElementKLUforCIDER *fNNiP1Binding ;
BindElementKLUforCIDER *fNPsijP1Binding ;
BindElementKLUforCIDER *fNNjP1Binding ;
BindElementKLUforCIDER *fPPsiiP1Binding ;
BindElementKLUforCIDER *fPPiP1Binding ;
BindElementKLUforCIDER *fPPsijP1Binding ;
BindElementKLUforCIDER *fPPjP1Binding ;
BindElementKLUforCIDER *fNPsiiP1jP1Binding ;
BindElementKLUforCIDER *fNNiP1jP1Binding ;
BindElementKLUforCIDER *fPPsiiP1jP1Binding ;
BindElementKLUforCIDER *fPPiP1jP1Binding ;
BindElementKLUforCIDER *fPsiPsiiM1Binding ;
BindElementKLUforCIDER *fNPsiiM1Binding ;
BindElementKLUforCIDER *fNNiM1Binding ;
BindElementKLUforCIDER *fPPsiiM1Binding ;
BindElementKLUforCIDER *fPPiM1Binding ;
BindElementKLUforCIDER *fNPsiiM1jP1Binding ;
BindElementKLUforCIDER *fNNiM1jP1Binding ;
BindElementKLUforCIDER *fPPsiiM1jP1Binding ;
BindElementKLUforCIDER *fPPiM1jP1Binding ;
BindElementKLUforCIDER *fPsiPsijM1Binding ;
BindElementKLUforCIDER *fNPsijM1Binding ;
BindElementKLUforCIDER *fNNjM1Binding ;
BindElementKLUforCIDER *fPPsijM1Binding ;
BindElementKLUforCIDER *fPPjM1Binding ;
BindElementKLUforCIDER *fNPsiiM1jM1Binding ;
BindElementKLUforCIDER *fNNiM1jM1Binding ;
BindElementKLUforCIDER *fPPsiiM1jM1Binding ;
BindElementKLUforCIDER *fPPiM1jM1Binding ;
BindElementKLUforCIDER *fNPsiiP1jM1Binding ;
BindElementKLUforCIDER *fNNiP1jM1Binding ;
BindElementKLUforCIDER *fPPsiiP1jM1Binding ;
BindElementKLUforCIDER *fPPiP1jM1Binding ;
BindElementKLUforCIDER *fNPsiInBinding ;
BindElementKLUforCIDER *fNPsiInP1Binding ;
BindElementKLUforCIDER *fNPsiOxBinding ;
BindElementKLUforCIDER *fNPsiOxP1Binding ;
BindElementKLUforCIDER *fPPsiInBinding ;
BindElementKLUforCIDER *fPPsiInP1Binding ;
BindElementKLUforCIDER *fPPsiOxBinding ;
BindElementKLUforCIDER *fPPsiOxP1Binding ;
BindElementKLUforCIDER *fNPsiInM1Binding ;
BindElementKLUforCIDER *fNPsiOxM1Binding ;
BindElementKLUforCIDER *fPPsiInM1Binding ;
BindElementKLUforCIDER *fPPsiOxM1Binding ;
#endif
} TWOnode;

View File

@ -18,8 +18,8 @@ Int KLU_defaults
/* parameters */
Common->tol = 0.001 ; /* pivot tolerance for diagonal */
Common->memgrow = 1.2; /* realloc size ratio increase for LU factors */
Common->initmem_amd = 1.2 ; /* init. mem with AMD: c*nnz(L) + n */
Common->memgrow = 10; /* realloc size ratio increase for LU factors */
Common->initmem_amd = 10 ; /* init. mem with AMD: c*nnz(L) + n */
Common->initmem = 10 ; /* init. mem otherwise: c*nnz(A) + n */
Common->btf = TRUE ; /* use BTF pre-ordering, or not */
Common->maxwork = 0 ; /* no limit to work done by btf_order */

File diff suppressed because it is too large Load Diff

View File

@ -32,25 +32,11 @@ NIinit(CKTcircuit *ckt)
ckt->CKTmatrix = TMALLOC (SMPmatrix, 1) ;
#ifdef KLU
ckt->CKTmatrix->CKTkluCommon = TMALLOC (klu_common, 1) ;
ckt->CKTmatrix->CKTkluSymbolic = NULL ;
ckt->CKTmatrix->CKTkluNumeric = NULL ;
ckt->CKTmatrix->CKTkluAp = NULL ;
ckt->CKTmatrix->CKTkluAi = NULL ;
ckt->CKTmatrix->CKTkluAx = NULL ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
ckt->CKTmatrix->CKTkluIntermediate = NULL ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = NULL ;
ckt->CKTmatrix->CKTbindStruct = NULL ;
ckt->CKTmatrix->CKTdiag_CSC = NULL ;
ckt->CKTmatrix->CKTkluN = 0 ;
ckt->CKTmatrix->CKTklunz = 0 ;
ckt->CKTmatrix->CKTkluMODE = ckt->CKTkluMODE ; /* TO BE SUBSTITUTED WITH THE HEURISTICS */
klu_defaults (ckt->CKTmatrix->CKTkluCommon) ;
ckt->CKTmatrix->CKTkluCommon->memgrow = ckt->CKTkluMemGrowFactor ;
ckt->CKTmatrix->CKTkluMemGrowFactor = ckt->CKTkluMemGrowFactor ;
#endif
ckt->CKTniState = NIUNINITIALIZED;
return SMPnewMatrix(ckt->CKTmatrix, 0);
}

View File

@ -13,10 +13,7 @@ libsparse_la_SOURCES = \
spsolve.c \
sputils.c
if KLU_WANTED
libsparse_la_SOURCES += spCSC.c
else
if !KLU_WANTED
libsparse_la_SOURCES += spsmp.c
endif
@ -24,3 +21,4 @@ AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
AM_CFLAGS = $(STATIC)
MAINTAINERCLEANFILES = Makefile.in

View File

@ -1,174 +0,0 @@
/* Sparse Matrix to CSC Matrix Conversion Routines
* Including Dump Routines
*
* Author: Francesco Lannutti 2011-2012
*
* Instructions:
* spMatrix_CSC_dump and spRHS_CSC_dump are the dump routines;
* insert them in a point in your code after that the Sparse Matrix
* is filled in to dump the whole matrix in the CSC format.
* To solve correctly the resulting CSC linear system, it's crucial
* to perform another inversion of the Solution Vector following this code:
*
* pExtOrder = IntToExtColMap [n] ;
* for (i = n - 1 ; i >= 0 ; i--)
* RHS [*(pExtOrder--)] = Intermediate [i] ;
*/
/* Includes */
#include "ngspice/spmatrix.h"
#include "spdefs.h"
/* Body */
int
WriteCol_original (MatrixPtr Matrix, int Col, spREAL *CSC_Element, spREAL *CSC_Element_Complex, int *CSC_Row, BindElement *BindSparseCSC, spREAL **diag)
{
int i ;
ElementPtr current ;
i = 0 ;
current = Matrix->FirstInCol [Col] ;
while (current != NULL) {
BindSparseCSC [i].Sparse = (double *)current ;
BindSparseCSC [i].CSC = &(CSC_Element [i]) ;
BindSparseCSC [i].CSC_Complex = &(CSC_Element_Complex [2 * i]) ;
CSC_Row [i] = (current->Row) - 1 ;
if (CSC_Row [i] == Col - 1)
diag [0] = &(CSC_Element [i]) ;
i++ ;
current = current->NextInCol ;
}
return i ;
}
int
WriteCol_original_dump (MatrixPtr Matrix, int Col, spREAL *CSC_Element, int *CSC_Row, unsigned int complex)
{
int i ;
ElementPtr current ;
i = 0 ;
current = Matrix->FirstInCol [Col] ;
while (current != NULL)
{
if (complex)
{
CSC_Element [2 * i] = current->Real ;
CSC_Element [2 * i + 1] = current->Imag ;
} else {
CSC_Element [i] = current->Real ;
}
CSC_Row [i] = (current->Row) - 1 ;
i++ ;
current = current->NextInCol ;
}
return i ;
}
void
spMatrix_CSC (MatrixPtr Matrix, int *Ap, int *Ai, double *Ax, double *Ax_Complex, int n, BindElement *BindSparseCSC, double **diag)
{
int offset, i ;
offset = 0 ;
Ap[0] = offset ;
for (i = 1 ; i <= n ; i++) {
offset += WriteCol_original (Matrix, i, (spREAL *)(Ax + offset), (spREAL *)(Ax_Complex + 2 * offset),
(int *)(Ai + offset), BindSparseCSC + offset, (spREAL **)(diag + (i - 1))) ;
Ap[i] = offset ;
}
}
void
spMatrix_CSC_dump (MatrixPtr Matrix, unsigned int complex, char *CSC_output)
{
FILE *output ;
int offset, i, j, *Ap, *Ai, n, nz ;
double *Ax ;
n = spGetSize (Matrix, 1) ;
nz = Matrix->Elements ;
Ap = (int *) SP_MALLOC (int, n + 1) ;
Ai = (int *) SP_MALLOC (int, nz) ;
if (complex)
{
Ax = (double *) SP_MALLOC (double, 2 * nz) ;
} else {
Ax = (double *) SP_MALLOC (double, nz) ;
}
offset = 0 ;
Ap [0] = offset ;
for (i = 1 ; i <= n ; i++) {
offset += WriteCol_original_dump (Matrix, i, (spREAL *)(Ax + offset), (int *)(Ai + offset), complex) ;
Ap [i] = offset ;
}
if (!complex && CSC_output != NULL)
{
output = fopen (CSC_output, "w") ;
fprintf (output, "%%%%MatrixMarket matrix coordinate real general\n") ;
fprintf (output, "%%-------------------------------------------------------------------------------\n") ;
fprintf (output, "%% Transient Matrix Dump\n%% Family: ISCAS Circuit\n") ;
fprintf (output, "%%-------------------------------------------------------------------------------\n") ;
fprintf (output, "%d %d %d\n", n, n, offset) ;
for (i = 0 ; i < n ; i++)
for (j = Ap [i] ; j < Ap [i + 1] ; j++)
fprintf (output, "%d %d %-.9g\n", Ai [j] + 1, i + 1, Ax [j]) ;
fclose (output) ;
output = fopen ("IntToExtColMap.txt", "w") ;
for (i = 1 ; i <= n ; i++)
fprintf (output, "%d\n", Matrix->IntToExtColMap [i]) ;
fclose (output) ;
} else {
fprintf (stderr, "CSC Matrix converted from SPARSE 1.3 matrix\n") ;
for (i = 0 ; i < n ; i++)
{
for (j = Ap [i] ; j < Ap [i + 1] ; j++)
{
if (complex)
{
fprintf (stderr, "Row: %d\tCol: %d\tValue: %-.9g j%-.9g\n", Ai [j] + 1, i + 1, Ax [2 * j], Ax [2 * j + 1]) ;
} else {
fprintf (stderr, "Row: %d\tCol: %d\tValue: %-.9g\n", Ai [j] + 1, i + 1, Ax [j]) ;
}
}
}
}
SP_FREE (Ap) ;
SP_FREE (Ai) ;
SP_FREE (Ax) ;
}
void
spRHS_CSC_dump (RealNumber *RHS, char *CSC_output_b, MatrixPtr Matrix)
{
FILE *output ;
int i, n, *pExtOrder ;
double *Intermediate ;
n = spGetSize (Matrix, 1) ;
Intermediate = (double *) SP_MALLOC (double, n) ;
pExtOrder = &Matrix->IntToExtRowMap [n] ;
for (i = n - 1 ; i >= 0 ; i--)
Intermediate [i] = RHS [*(pExtOrder--)] ;
output = fopen (CSC_output_b, "w") ;
fprintf (output, "%%%%MatrixMarket matrix array real general\n") ;
fprintf (output, "%%-------------------------------------------------------------------------------\n") ;
fprintf (output, "%% Transient RHS Vector Dump\n%% Family: ISCAS Circuit\n") ;
fprintf (output, "%%-------------------------------------------------------------------------------\n") ;
fprintf (output, "%d %d\n", n, 1) ;
for (i = 1 ; i < n + 1 ; i++)
fprintf (output, "%-.9g\n", Intermediate [i]) ;
fclose (output) ;
SP_FREE (Intermediate) ;
}

View File

@ -259,13 +259,13 @@ ACan(CKTcircuit* ckt, int restart)
if (ckt->CKTmatrix->CKTkluMODE)
{
/* Conversion from Real Matrix to Complex Matrix */
if (!ckt->CKTmatrix->CKTkluMatrixIsComplex)
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
{
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
}
#endif
@ -290,7 +290,7 @@ ACan(CKTcircuit* ckt, int restart)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
}
#endif
@ -331,7 +331,7 @@ ACan(CKTcircuit* ckt, int restart)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
#endif
@ -443,7 +443,7 @@ endsweep:
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
}
#endif

View File

@ -40,7 +40,16 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
break;
case OPT_ORIGNZ:
if ( ckt->CKTmatrix != NULL ) {
#ifdef KLU
if (ckt->CKTkluMODE)
val->iValue = (int)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNZ ;
else
val->iValue = spOriginalCount (ckt->CKTmatrix->SPmatrix) ;
#else
val->iValue = spOriginalCount(ckt->CKTmatrix->SPmatrix);
#endif
} else {
val->iValue = 0;
}
@ -49,7 +58,8 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
if ( ckt->CKTmatrix != NULL ) {
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
val->iValue = ckt->CKTmatrix->CKTkluNumeric->lnz + ckt->CKTmatrix->CKTkluNumeric->unz + ckt->CKTmatrix->CKTkluNumeric->nzoff - ckt->CKTmatrix->CKTklunz ;
val->iValue = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->lnz + ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNZ ;
else
val->iValue = spFillinCount(ckt->CKTmatrix->SPmatrix);
#else
@ -63,7 +73,8 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
if ( ckt->CKTmatrix != NULL ) {
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
val->iValue = ckt->CKTmatrix->CKTkluNumeric->lnz + ckt->CKTmatrix->CKTkluNumeric->unz + ckt->CKTmatrix->CKTkluNumeric->nzoff ;
val->iValue = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->lnz + ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->unz
+ ckt->CKTmatrix->SMPkluMatrix->KLUmatrixNumeric->nzoff ;
else
val->iValue = spElementCount(ckt->CKTmatrix->SPmatrix);
#else

View File

@ -14,21 +14,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
#include "ngspice/devdefs.h"
#include "ngspice/sperror.h"
#ifdef KLU
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
#endif
int
CKTpzSetup(CKTcircuit *ckt, int type)
{
@ -104,35 +89,12 @@ CKTpzSetup(CKTcircuit *ckt, int type)
job->PZnumswaps = 1;
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
if (matrix->CKTkluMODE)
{
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ;
int i ;
int n = SMPmatSize (ckt->CKTmatrix) ;
ckt->CKTmatrix->CKTkluN = n ;
SMPnnz (ckt->CKTmatrix) ;
int nz = ckt->CKTmatrix->CKTklunz ;
ckt->CKTmatrix->CKTkluAp = TMALLOC (int, n + 1) ;
ckt->CKTmatrix->CKTkluAi = TMALLOC (int, nz) ;
ckt->CKTmatrix->CKTkluAx = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluIntermediate = TMALLOC (double, n) ;
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ;
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ;
/* Complex Stuff needed for AC Analysis */
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * n) ;
/* Binding Table from Sparse to CSC Format Creation */
SMPmatrix_CSC (ckt->CKTmatrix) ;
/* Binding Table Sorting */
qsort (ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare) ;
/* Convert the COO Storage to CSC for KLU and Fill the Binding Table */
SMPconvertCOOtoCSC (matrix) ;
/* KLU Pointers Assignment */
for (i = 0 ; i < DEVmaxnum ; i++)
@ -140,34 +102,48 @@ CKTpzSetup(CKTcircuit *ckt, int type)
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ;
/* ReOrder */
error = SMPpreOrder (ckt->CKTmatrix) ;
error = SMPpreOrder (matrix) ;
if (error) {
fprintf (stderr, "Error during ReOrdering\n") ;
}
/* Conversion from Real Matrix to Complex Matrix */
/* Conversion from Real Circuit Matrix to Complex Circuit Matrix */
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
/* Input Pos */
if ((input_pos != 0) && (solution_col != 0))
if ((input_pos > 0) && (solution_col > 0))
{
double *j ;
BindElement j, *matched ;
j = job->PZdrive_pptr ;
job->PZdrive_pptr = ((BindElement *) bsearch (&j, ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare))->CSC_Complex ;
j.COO = job->PZdrive_pptr ;
j.CSC = NULL ;
j.CSC_Complex = NULL ;
matched = (BindElement *) bsearch (&j, matrix->SMPkluMatrix->KLUmatrixBindStructCOO,
matrix->SMPkluMatrix->KLUmatrixLinkedListNZ, sizeof (BindElement), BindCompare) ;
if (matched == NULL) {
printf ("Ptr %p not found in BindStruct Table\n", job->PZdrive_pptr) ;
}
job->PZdrive_pptr = matched->CSC_Complex ;
}
/* Input Neg */
if ((input_neg != 0) && (solution_col != 0))
if ((input_neg > 0) && (solution_col > 0))
{
double *j ;
BindElement j, *matched ;
j = job->PZdrive_nptr ;
job->PZdrive_nptr = ((BindElement *) bsearch (&j, ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare))->CSC_Complex ;
j.COO = job->PZdrive_nptr ;
j.CSC = NULL ;
j.CSC_Complex = NULL ;
matched = (BindElement *) bsearch (&j, matrix->SMPkluMatrix->KLUmatrixBindStructCOO,
matrix->SMPkluMatrix->KLUmatrixLinkedListNZ, sizeof (BindElement), BindCompare) ;
if (matched == NULL) {
printf ("Ptr %p not found in BindStruct Table\n", job->PZdrive_nptr) ;
}
job->PZdrive_nptr = matched->CSC_Complex ;
}
} else {
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ;
@ -180,3 +156,4 @@ CKTpzSetup(CKTcircuit *ckt, int type)
return OK;
}

View File

@ -45,22 +45,6 @@ static double inc_freq(double freq, int type, double step_size);
}
#ifdef KLU
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
#endif
/*
* Procedure:
*
@ -117,7 +101,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
SMPmatrix *saved_matrix = NULL;
#ifdef KLU
int nz, size_CSC;
int size_CSC ;
#endif
#ifndef notdef
@ -173,33 +157,14 @@ int sens_sens(CKTcircuit *ckt, int restart)
/* Create the perturbation matrix */
delta_Y = TMALLOC(SMPmatrix, 1);
#ifdef KLU
delta_Y->CKTkluSymbolic = NULL;
delta_Y->CKTkluNumeric = NULL;
delta_Y->CKTkluAp = NULL;
delta_Y->CKTkluAi = NULL;
delta_Y->CKTkluAx = NULL;
delta_Y->CKTkluMatrixIsComplex = CKTkluMatrixReal;
delta_Y->CKTkluIntermediate = NULL;
delta_Y->CKTkluIntermediate_Complex = NULL;
delta_Y->CKTbindStruct = NULL;
delta_Y->CKTdiag_CSC = NULL;
delta_Y->CKTkluN = 0;
delta_Y->CKTklunz = 0;
delta_Y->CKTkluMODE = ckt->CKTkluMODE;
if (ckt->CKTkluMODE) {
delta_Y->CKTkluCommon = TMALLOC(klu_common, 1);
klu_defaults(delta_Y->CKTkluCommon);
} else {
delta_Y->CKTkluCommon = NULL;
}
#endif
error = SMPnewMatrix(delta_Y, size);
if (error)
return error;
#ifdef KLU
delta_Y->SMPkluMatrix->KLUmatrixDiag = NULL ;
#endif
// SMPprint(delta_Y, NULL);
size += 1;
@ -300,15 +265,15 @@ int sens_sens(CKTcircuit *ckt, int restart)
#ifdef KLU
if (ckt->CKTkluMODE) {
/* Convert the KLU matrix to complex */
for (i = 0 ; i < Y->CKTklunz ; i++) {
Y->CKTkluAx_Complex [2 * i] = Y->CKTkluAx [i];
Y->CKTkluAx_Complex [2 * i + 1] = 0.0;
/* Convert the KLU Circuit Matrix to Complex */
for (i = 0 ; i < (int)Y->SMPkluMatrix->KLUmatrixNZ ; i++) {
Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i] = Y->SMPkluMatrix->KLUmatrixAx [i] ;
Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i + 1] = 0.0 ;
}
Y->CKTkluMatrixIsComplex = CKTkluMatrixComplex;
Y->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
SMPcReorder(Y, ckt->CKTpivotAbsTol, ckt->CKTpivotRelTol, &size_CSC); // size_CSC is just a placeholder here
SMPcReorder (Y, ckt->CKTpivotAbsTol, ckt->CKTpivotRelTol, &size_CSC) ; // size_CSC is just a placeholder here
}
#endif
@ -378,14 +343,14 @@ int sens_sens(CKTcircuit *ckt, int restart)
/* ReOrder */
error = SMPpreOrder (ckt->CKTmatrix) ;
/* Conversion from Real Matrix to Complex Matrix */
if (!ckt->CKTmatrix->CKTkluMatrixIsComplex)
/* Conversion from Real Circuit Matrix to Complex Circuit Matrix */
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
{
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
}
#endif
@ -470,43 +435,23 @@ int sens_sens(CKTcircuit *ckt, int restart)
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
size_CSC = SMPmatSize (ckt->CKTmatrix) ;
ckt->CKTmatrix->CKTkluN = size_CSC ;
/* Populate the delta_Y KLU Matrix */
SMPnnz (ckt->CKTmatrix) ;
nz = ckt->CKTmatrix->CKTklunz ;
ckt->CKTmatrix->CKTkluAp = TMALLOC (int, size_CSC + 1) ;
ckt->CKTmatrix->CKTkluAi = TMALLOC (int, nz) ;
ckt->CKTmatrix->CKTkluAx = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluIntermediate = TMALLOC (double, size_CSC) ;
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ;
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, size_CSC) ;
/* Complex Stuff needed for AC Analysis */
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * size_CSC) ;
/* Binding Table from Sparse to CSC Format Creation */
SMPmatrix_CSC (ckt->CKTmatrix) ;
/* Binding Table Sorting */
qsort (ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare) ;
/* Convert the COO Storage to CSC for KLU and Fill the Binding Table */
SMPconvertCOOtoCSC (delta_Y) ;
/* KLU Pointers Assignment */
if (DEVices [sg->dev]->DEVbindCSC)
DEVices [sg->dev]->DEVbindCSC (sg->model, ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
delta_Y->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
/* Clear KLU Vectors */
for (i = 0 ; i < nz ; i++)
for (i = 0 ; i < (int)delta_Y->SMPkluMatrix->KLUmatrixNZ ; i++)
{
ckt->CKTmatrix->CKTkluAx [i] = 0 ;
ckt->CKTmatrix->CKTkluAx_Complex [2 * i] = 0 ;
ckt->CKTmatrix->CKTkluAx_Complex [2 * i + 1] = 0 ;
delta_Y->SMPkluMatrix->KLUmatrixAx [i] = 0 ;
delta_Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i] = 0 ;
delta_Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i + 1] = 0 ;
}
}
#endif
@ -529,7 +474,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
if (DEVices [sg->dev]->DEVbindCSCComplex)
DEVices [sg->dev]->DEVbindCSCComplex (sg->model, ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
delta_Y->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
}
#endif

View File

@ -31,21 +31,6 @@ int nthreads;
return(E_NOMEM);\
}
#ifdef KLU
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
#endif
int
CKTsetup(CKTcircuit *ckt)
{
@ -123,6 +108,23 @@ CKTsetup(CKTcircuit *ckt)
}
}
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ;
/* Convert the COO Storage to CSC for KLU and Fill the Binding Table */
SMPconvertCOOtoCSC (matrix) ;
/* Assign the KLU Pointers */
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSC && ckt->CKThead [i])
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ;
} else {
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ;
}
#endif
for(i=0;i<=MAX(2,ckt->CKTmaxOrder)+1;i++) { /* dctran needs 3 states as minimum */
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double);
}
@ -171,48 +173,6 @@ CKTsetup(CKTcircuit *ckt)
/* gtri - end - Setup for adding rshunt option resistors */
#endif
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ;
int i ;
int n = SMPmatSize (ckt->CKTmatrix) ;
ckt->CKTmatrix->CKTkluN = n ;
SMPnnz (ckt->CKTmatrix) ;
int nz = ckt->CKTmatrix->CKTklunz ;
ckt->CKTmatrix->CKTkluAp = TMALLOC (int, n + 1) ;
ckt->CKTmatrix->CKTkluAi = TMALLOC (int, nz) ;
ckt->CKTmatrix->CKTkluAx = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluIntermediate = TMALLOC (double, n) ;
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ;
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ;
/* Complex Stuff needed for AC Analysis */
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * n) ;
/* Binding Table from Sparse to CSC Format Creation */
SMPmatrix_CSC (ckt->CKTmatrix) ;
/* Binding Table Sorting */
qsort (ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare) ;
/* KLU Pointers Assignment */
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSC && ckt->CKThead [i])
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
} else {
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ;
}
#endif
return(OK);
}

View File

@ -51,30 +51,16 @@ Author: 2020 Francesco Lannutti
#include &quot;ngspice/sperror.h&quot;
#include &quot;ngspice/klu-binding.h&quot;
#include &lt;stdlib.h&gt;
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
$(module)bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
$(module)model *model = ($(module)model *)inModel ;
$(module)instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the $(module) models */
for ( ; model != NULL ; model = $(module)nextModel(model))

View File

@ -8,31 +8,17 @@ Author: 2015 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
ASRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
ASRCmodel *model = (ASRCmodel *)inModel ;
ASRCinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
int j, k ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the ASRC models */
for ( ; model != NULL ; model = ASRCnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BJTmodel *model = (BJTmodel *)inModel ;
BJTinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BJT models */
for ( ; model != NULL ; model = BJTnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B1model *model = (B1model *)inModel ;
B1instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B1 models */
for ( ; model != NULL ; model = B1nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B2model *model = (B2model *)inModel ;
B2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B2 models */
for ( ; model != NULL ; model = B2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM3model *model = (BSIM3model *)inModel ;
BSIM3instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM3 models */
for ( ; model != NULL ; model = BSIM3nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B3SOIDDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B3SOIDDmodel *model = (B3SOIDDmodel *)inModel ;
B3SOIDDinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B3SOIDD models */
for ( ; model != NULL ; model = B3SOIDDnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B3SOIFDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B3SOIFDmodel *model = (B3SOIFDmodel *)inModel ;
B3SOIFDinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B3SOIFD models */
for ( ; model != NULL ; model = B3SOIFDnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B3SOIPDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B3SOIPDmodel *model = (B3SOIPDmodel *)inModel ;
B3SOIPDinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B3SOIPD models */
for ( ; model != NULL ; model = B3SOIPDnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM3v0bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM3v0model *model = (BSIM3v0model *)inModel ;
BSIM3v0instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM3v0 models */
for ( ; model != NULL ; model = BSIM3v0nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM3v1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM3v1model *model = (BSIM3v1model *)inModel ;
BSIM3v1instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM3v1 models */
for ( ; model != NULL ; model = BSIM3v1nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM3v32bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM3v32model *model = (BSIM3v32model *)inModel ;
BSIM3v32instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM3v32 models */
for ( ; model != NULL ; model = BSIM3v32nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM4bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM4model *model = (BSIM4model *)inModel ;
BSIM4instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM4 models */
for ( ; model != NULL ; model = BSIM4nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM4v5bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM4v5model *model = (BSIM4v5model *)inModel ;
BSIM4v5instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM4v5 models */
for ( ; model != NULL ; model = BSIM4v5nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM4v6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM4v6model *model = (BSIM4v6model *)inModel ;
BSIM4v6instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM4v6 models */
for ( ; model != NULL ; model = BSIM4v6nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
BSIM4v7bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM4v7model *model = (BSIM4v7model *)inModel ;
BSIM4v7instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the BSIM4v7 models */
for ( ; model != NULL ; model = BSIM4v7nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
B4SOIbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
B4SOImodel *model = (B4SOImodel *)inModel ;
B4SOIinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the B4SOI models */
for ( ; model != NULL ; model = B4SOInextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
CAPbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
CAPmodel *model = (CAPmodel *)inModel ;
CAPinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the CAP models */
for ( ; model != NULL ; model = CAPnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
CCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
CCCSmodel *model = (CCCSmodel *)inModel ;
CCCSinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the CCCS models */
for ( ; model != NULL ; model = CCCSnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
CCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
CCVSmodel *model = (CCVSmodel *)inModel ;
CCVSinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the CCVS models */
for ( ; model != NULL ; model = CCVSnextModel(model))

View File

@ -8,32 +8,17 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
CPLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
CPLmodel *model = (CPLmodel *)inModel ;
CPLinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
int m, p ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the CPL models */
for ( ; model != NULL ; model = CPLnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
CSWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
CSWmodel *model = (CSWmodel *)inModel ;
CSWinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the CSW models */
for ( ; model != NULL ; model = CSWnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
DIObindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
DIOmodel *model = (DIOmodel *)inModel ;
DIOinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the DIO models */
for ( ; model != NULL ; model = DIOnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
HFETAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
HFETAmodel *model = (HFETAmodel *)inModel ;
HFETAinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the HFETA models */
for ( ; model != NULL ; model = HFETAnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
HFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
HFET2model *model = (HFET2model *)inModel ;
HFET2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the HFET2 models */
for ( ; model != NULL ; model = HFET2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
HSM2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
HSM2model *model = (HSM2model *)inModel ;
HSM2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the HSM2 models */
for ( ; model != NULL ; model = HSM2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
HSMHVbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
HSMHVmodel *model = (HSMHVmodel *)inModel ;
HSMHVinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the HSMHV models */
for ( ; model != NULL ; model = HSMHVnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2016 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
HSMHV2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
HSMHV2model *model = (HSMHV2model *)inModel ;
HSMHV2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the HSMHV2 models */
for ( ; model != NULL ; model = HSMHV2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
INDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
INDmodel *model = (INDmodel *)inModel ;
INDinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the IND models */
for ( ; model != NULL ; model = INDnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MUTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MUTmodel *model = (MUTmodel *)inModel ;
MUTinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MUT models */
for ( ; model != NULL ; model = MUTnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
JFETbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
JFETmodel *model = (JFETmodel *)inModel ;
JFETinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the JFET models */
for ( ; model != NULL ; model = JFETnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
JFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
JFET2model *model = (JFET2model *)inModel ;
JFET2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the JFET2 models */
for ( ; model != NULL ; model = JFET2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
LTRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
LTRAmodel *model = (LTRAmodel *)inModel ;
LTRAinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the LTRA models */
for ( ; model != NULL ; model = LTRAnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MESmodel *model = (MESmodel *)inModel ;
MESinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MES models */
for ( ; model != NULL ; model = MESnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MESAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MESAmodel *model = (MESAmodel *)inModel ;
MESAinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MESA models */
for ( ; model != NULL ; model = MESAnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MOS1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MOS1model *model = (MOS1model *)inModel ;
MOS1instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MOS1 models */
for ( ; model != NULL ; model = MOS1nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MOS2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MOS2model *model = (MOS2model *)inModel ;
MOS2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MOS2 models */
for ( ; model != NULL ; model = MOS2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MOS3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MOS3model *model = (MOS3model *)inModel ;
MOS3instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MOS3 models */
for ( ; model != NULL ; model = MOS3nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2012 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MOS6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MOS6model *model = (MOS6model *)inModel ;
MOS6instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MOS6 models */
for ( ; model != NULL ; model = MOS6nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MOS9bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MOS9model *model = (MOS9model *)inModel ;
MOS9instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MOS9 models */
for ( ; model != NULL ; model = MOS9nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
NBJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
NBJTmodel *model = (NBJTmodel *)inModel ;
NBJTinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the NBJT models */
for ( ; model != NULL ; model = NBJTnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
NBJT2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
NBJT2model *model = (NBJT2model *)inModel ;
NBJT2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the NBJT2 models */
for ( ; model != NULL ; model = NBJT2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
NUMDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
NUMDmodel *model = (NUMDmodel *)inModel ;
NUMDinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the NUMD models */
for ( ; model != NULL ; model = NUMDnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
NUMD2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
NUMD2model *model = (NUMD2model *)inModel ;
NUMD2instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the NUMD2 models */
for ( ; model != NULL ; model = NUMD2nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
NUMOSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
NUMOSmodel *model = (NUMOSmodel *)inModel ;
NUMOSinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the NUMOS models */
for ( ; model != NULL ; model = NUMOSnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
RESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
RESmodel *model = (RESmodel *)inModel ;
RESinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the RES models */
for ( ; model != NULL ; model = RESnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
SOI3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
SOI3model *model = (SOI3model *)inModel ;
SOI3instance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the SOI3 models */
for ( ; model != NULL ; model = SOI3nextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
SWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
SWmodel *model = (SWmodel *)inModel ;
SWinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the SW models */
for ( ; model != NULL ; model = SWnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
TRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
TRAmodel *model = (TRAmodel *)inModel ;
TRAinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the TRA models */
for ( ; model != NULL ; model = TRAnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
TXLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
TXLmodel *model = (TXLmodel *)inModel ;
TXLinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the TXL models */
for ( ; model != NULL ; model = TXLnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
VBICbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
VBICmodel *model = (VBICmodel *)inModel ;
VBICinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the VBIC models */
for ( ; model != NULL ; model = VBICnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
VCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
VCCSmodel *model = (VCCSmodel *)inModel ;
VCCSinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the VCCS models */
for ( ; model != NULL ; model = VCCSnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
VCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
VCVSmodel *model = (VCVSmodel *)inModel ;
VCVSinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the VCVS models */
for ( ; model != NULL ; model = VCVSnextModel(model))

View File

@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
#include "ngspice/sperror.h"
#include "ngspice/klu-binding.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
VSRCmodel *model = (VSRCmodel *)inModel ;
VSRCinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the VSRC models */
for ( ; model != NULL ; model = VSRCnextModel(model))
@ -47,7 +33,9 @@ VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
/* Pole-Zero Analysis */
if (here->VSRCibrIbrPtr)
{
i = here->VSRCibrIbrPtr ;
i.COO = here->VSRCibrIbrPtr ;
i.CSC = NULL ;
i.CSC_Complex = NULL ;
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ;
here->VSRCibrIbrBinding = matched ;
if (matched != NULL)

View File

@ -12,26 +12,12 @@
#include "ngspice/mifproto.h"
#include "ngspice/mifdefs.h"
#include <stdlib.h>
static
int
BindCompare (const void *a, const void *b)
{
BindElement *A, *B ;
A = (BindElement *)a ;
B = (BindElement *)b ;
return ((int)(A->Sparse - B->Sparse)) ;
}
int
MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt)
{
MIFmodel *model = (MIFmodel *)inModel ;
MIFinstance *here ;
double *i ;
BindElement *matched, *BindStruct ;
BindElement i, *matched, *BindStruct ;
int ii, j, k, l, num_conn, num_port, num_port_k ;
Mif_Boolean_t is_input, is_output ;
Mif_Cntl_Src_Type_t cntl_src_type ;
@ -39,8 +25,8 @@ MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt)
Mif_Smp_Ptr_t *smp_data_cntl, *smp_data_out ;
size_t nz ;
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
/* loop through all the MIF models */
for ( ; model != NULL ; model = MIFnextModel(model))