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:
parent
4d00b67b4d
commit
fe89da2b2c
|
|
@ -119,7 +119,7 @@ NUMDadmittance(ONEdevice *pDevice, double omega, SPcomplex *yd)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -315,7 +315,7 @@ NBJTadmittance(ONEdevice *pDevice, double omega, SPcomplex *yIeVce,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -580,7 +580,7 @@ NUMDys(ONEdevice *pDevice, SPcomplex *s, SPcomplex *yd)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -667,7 +667,7 @@ NBJTys(ONEdevice *pDevice, SPcomplex *s, SPcomplex *yIeVce,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,77 +251,6 @@ ONE_jacBuild(ONEdevice *pDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KLU
|
#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
|
void
|
||||||
ONEbindCSC (ONEdevice *pDevice)
|
ONEbindCSC (ONEdevice *pDevice)
|
||||||
{
|
{
|
||||||
|
|
@ -331,13 +260,13 @@ ONEbindCSC (ONEdevice *pDevice)
|
||||||
int psiEqn, nEqn, pEqn; /* scratch for deref'd eqn numbers */
|
int psiEqn, nEqn, pEqn; /* scratch for deref'd eqn numbers */
|
||||||
int psiEqnL=0, nEqnL=0, pEqnL=0;
|
int psiEqnL=0, nEqnL=0, pEqnL=0;
|
||||||
int psiEqnR=0, nEqnR=0, pEqnR=0;
|
int psiEqnR=0, nEqnR=0, pEqnR=0;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
|
||||||
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,64 +70,19 @@ ONEQjacBuild(ONEdevice *pDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KLU
|
#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
|
void
|
||||||
ONEQbindCSC (ONEdevice *pDevice)
|
ONEQbindCSC (ONEdevice *pDevice)
|
||||||
{
|
{
|
||||||
ONEelem *pElem ;
|
ONEelem *pElem ;
|
||||||
ONEnode *pNode, *pNode1 ;
|
ONEnode *pNode, *pNode1 ;
|
||||||
int index ;
|
int index ;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
|
||||||
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,7 @@ ONEequilSolve(ONEdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
|
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
|
#else
|
||||||
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
|
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -605,7 +605,7 @@ ONEequilSolve(ONEdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -636,7 +636,8 @@ ONEequilSolve(ONEdevice *pDevice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf ("CIDER: KLU to be fixed: spElementCount\n") ;
|
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 {
|
} else {
|
||||||
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
|
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
|
||||||
}
|
}
|
||||||
|
|
@ -666,9 +667,8 @@ ONEequilSolve(ONEdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - Fix for KLU
|
pDevice->numFillEquil = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
|
||||||
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
|
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
pDevice->numFillEquil = 0 ;
|
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -752,7 +752,7 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
|
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
|
#else
|
||||||
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
|
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -796,7 +796,7 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -826,9 +826,8 @@ ONEbiasSolve(ONEdevice *pDevice, int iterationLimit,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - Fix for KLU
|
pDevice->numFillBias = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
|
||||||
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
|
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
pDevice->numFillBias = 0 ;
|
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ NUMD2admittance(TWOdevice *pDevice, double omega, SPcomplex *yd)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -292,7 +292,7 @@ NBJT2admittance(TWOdevice *pDevice, double omega, SPcomplex *yIeVce,
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -577,7 +577,7 @@ NUMOSadmittance(TWOdevice *pDevice, double omega, struct mosAdmittances *yAc)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1180,7 +1180,7 @@ NUMD2ys(TWOdevice *pDevice, SPcomplex *s, SPcomplex *yIn)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1277,7 +1277,7 @@ NBJT2ys(TWOdevice *pDevice, SPcomplex *s, SPcomplex *yIeVce, SPcomplex *yIcVce,
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1399,7 +1399,7 @@ NUMOSys(TWOdevice *pDevice, SPcomplex *s, struct mosAdmittances *yAc)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - To be completed
|
// Francesco Lannutti - To be completed
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixComplex ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -902,7 +902,7 @@ TWObindCSC (TWOdevice *pDevice)
|
||||||
TWOelem *pElem;
|
TWOelem *pElem;
|
||||||
TWOnode *pNode;
|
TWOnode *pNode;
|
||||||
TWOchannel *pCh;
|
TWOchannel *pCh;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
int index ;
|
int index ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
|
|
@ -916,10 +916,10 @@ TWObindCSC (TWOdevice *pDevice)
|
||||||
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
||||||
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
|
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 ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ TWONbindCSC (TWOdevice *pDevice)
|
||||||
TWOelem *pElem;
|
TWOelem *pElem;
|
||||||
TWOnode *pNode;
|
TWOnode *pNode;
|
||||||
TWOchannel *pCh;
|
TWOchannel *pCh;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
int index ;
|
int index ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
|
|
@ -591,10 +591,10 @@ TWONbindCSC (TWOdevice *pDevice)
|
||||||
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
||||||
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
|
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 ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ TWOPbindCSC (TWOdevice *pDevice)
|
||||||
TWOelem *pElem;
|
TWOelem *pElem;
|
||||||
TWOnode *pNode;
|
TWOnode *pNode;
|
||||||
TWOchannel *pCh;
|
TWOchannel *pCh;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
int index ;
|
int index ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
|
|
@ -591,10 +591,10 @@ TWOPbindCSC (TWOdevice *pDevice)
|
||||||
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
int psiEqnInM = 0, psiEqnInP = 0; /* scratch for deref'd surface eqns */
|
||||||
int psiEqnOxM = 0, psiEqnOxP = 0; /* M= more negative, P= more positive */
|
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 ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,13 @@ TWOQbindCSC (TWOdevice *pDevice)
|
||||||
TWOnode *pNode, *pNode1;
|
TWOnode *pNode, *pNode1;
|
||||||
int eIndex, nIndex;
|
int eIndex, nIndex;
|
||||||
int index ;
|
int index ;
|
||||||
BindKluElementCOO i, *matched, *BindStruct, *BindStructCSC ;
|
BindElementKLUforCIDER i, *matched, *BindStruct, *BindStructCSC ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
BindStruct = pDevice->matrix->SMPkluMatrix->KLUmatrixBindStructForCIDER ;
|
||||||
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
nz = pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
|
|
||||||
BindStructCSC = (BindKluElementCOO *) malloc (nz * sizeof(BindKluElementCOO)) ;
|
BindStructCSC = (BindElementKLUforCIDER *) malloc (nz * sizeof (BindElementKLUforCIDER)) ;
|
||||||
for (index = 0 ; index < (int)nz ; index++) {
|
for (index = 0 ; index < (int)nz ; index++) {
|
||||||
BindStructCSC [index] = BindStruct [index] ;
|
BindStructCSC [index] = BindStruct [index] ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -505,7 +505,7 @@ int TWOequilSolve(TWOdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
|
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
|
#else
|
||||||
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
|
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 0) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -519,7 +519,7 @@ int TWOequilSolve(TWOdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -550,7 +550,8 @@ int TWOequilSolve(TWOdevice *pDevice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf ("CIDER: KLU to be fixed: spElementCount\n") ;
|
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 {
|
} else {
|
||||||
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
|
pDevice->numOrigEquil = spElementCount (pDevice->matrix->SPmatrix) ;
|
||||||
}
|
}
|
||||||
|
|
@ -580,9 +581,8 @@ int TWOequilSolve(TWOdevice *pDevice)
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - Fix for KLU
|
pDevice->numFillEquil = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
|
||||||
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
|
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
pDevice->numFillEquil = 0 ;
|
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -666,7 +666,7 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
pDevice->matrix->CKTkluMODE = CKTkluON ; /* Francesco Lannutti - To be sustitued with a value coming from the uplevel */
|
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
|
#else
|
||||||
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
|
error = SMPnewMatrixForCIDER (pDevice->matrix, pDevice->numEqns, 1) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -708,7 +708,9 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
|
||||||
return ; // Francesco Lannutti - Fix KLU return values
|
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 {
|
} else {
|
||||||
pDevice->numOrigBias = spElementCount(pDevice->matrix->SPmatrix);
|
pDevice->numOrigBias = spElementCount(pDevice->matrix->SPmatrix);
|
||||||
}
|
}
|
||||||
|
|
@ -723,7 +725,7 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = CKTkluMatrixReal ;
|
pDevice->matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -753,13 +755,12 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis,
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (pDevice->matrix->CKTkluMODE) {
|
if (pDevice->matrix->CKTkluMODE) {
|
||||||
// Francesco Lannutti - Fix for KLU
|
pDevice->numFillBias = pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->lnz + pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->unz
|
||||||
printf ("CIDER: KLU to be fixed: spFillinCount\n") ;
|
+ pDevice->matrix->SMPkluMatrix->KLUmatrixNumeric->nzoff - (int)pDevice->matrix->SMPkluMatrix->KLUmatrixNZ ;
|
||||||
pDevice->numFillBias = 0 ;
|
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pDevice->numFillBias = spFillinCount (pDevice->matrix->SPmatrix) ; // Francesco Lannutti - Fix for KLU
|
pDevice->numFillBias = spFillinCount (pDevice->matrix->SPmatrix) ;
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ struct CKTcircuit {
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
unsigned int CKTkluMODE:1;
|
unsigned int CKTkluMODE:1;
|
||||||
unsigned int CKTkluMemGrowFactor : 1 ;
|
double CKTkluMemGrowFactor ;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,101 +1,118 @@
|
||||||
#ifndef _KLU_BINDING_H
|
#ifndef _KLU_BINDING_H
|
||||||
#define _KLU_BINDING_H
|
#define _KLU_BINDING_H
|
||||||
|
|
||||||
|
#include "ngspice/klu.h"
|
||||||
|
|
||||||
#define CREATE_KLU_BINDING_TABLE(ptr, binding, a, b) \
|
#define CREATE_KLU_BINDING_TABLE(ptr, binding, a, b) \
|
||||||
if ((here->a != 0) && (here->b != 0)) { \
|
if ((here->a > 0) && (here->b > 0)) { \
|
||||||
i = here->ptr ; \
|
i.COO = here->ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
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->binding = matched ; \
|
||||||
here->ptr = matched->CSC ; \
|
here->ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(ptr, binding, a, b) \
|
#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 ;
|
here->ptr = here->binding->CSC_Complex ;
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_REAL(ptr, binding, a, b) \
|
#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 ;
|
here->ptr = here->binding->CSC ;
|
||||||
|
|
||||||
#ifdef XSPICE
|
#ifdef XSPICE
|
||||||
#define CREATE_KLU_BINDING_TABLE_XSPICE_OUTPUTS(ptr, binding, a, b) \
|
#define CREATE_KLU_BINDING_TABLE_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)) { \
|
||||||
i = smp_data_out->ptr ; \
|
i.COO = smp_data_out->ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
i.CSC = NULL ; \
|
||||||
|
i.CSC_Complex = NULL ; \
|
||||||
|
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof (BindElement), BindCompare) ; \
|
||||||
smp_data_out->binding = matched ; \
|
smp_data_out->binding = matched ; \
|
||||||
smp_data_out->ptr = matched->CSC ; \
|
smp_data_out->ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_OUTPUTS(ptr, binding, a, b) \
|
#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 ;
|
smp_data_out->ptr = smp_data_out->binding->CSC_Complex ;
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_XSPICE_OUTPUTS(ptr, binding, a, b) \
|
#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 ;
|
smp_data_out->ptr = smp_data_out->binding->CSC ;
|
||||||
|
|
||||||
#define CREATE_KLU_BINDING_TABLE_XSPICE_INPUTS_E(ptr, binding, a, b) \
|
#define CREATE_KLU_BINDING_TABLE_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)) { \
|
||||||
i = smp_data_out->input[k].port[l].ptr ; \
|
i.COO = smp_data_out->input[k].port[l].ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
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].e.binding = matched ; \
|
||||||
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_E(ptr, binding, a, b) \
|
#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 ;
|
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) \
|
#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 ;
|
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) \
|
#define CREATE_KLU_BINDING_TABLE_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)) { \
|
||||||
i = smp_data_out->input[k].port[l].ptr ; \
|
i.COO = smp_data_out->input[k].port[l].ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
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].f.binding = matched ; \
|
||||||
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_F(ptr, binding, a, b) \
|
#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 ;
|
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) \
|
#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 ;
|
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) \
|
#define CREATE_KLU_BINDING_TABLE_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)) { \
|
||||||
i = smp_data_out->input[k].port[l].ptr ; \
|
i.COO = smp_data_out->input[k].port[l].ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
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].g.binding = matched ; \
|
||||||
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_G(ptr, binding, a, b) \
|
#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 ;
|
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) \
|
#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 ;
|
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) \
|
#define CREATE_KLU_BINDING_TABLE_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)) { \
|
||||||
i = smp_data_out->input[k].port[l].ptr ; \
|
i.COO = smp_data_out->input[k].port[l].ptr ; \
|
||||||
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
|
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].h.binding = matched ; \
|
||||||
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
smp_data_out->input[k].port[l].ptr = matched->CSC ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_XSPICE_INPUTS_H(ptr, binding, a, b) \
|
#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 ;
|
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) \
|
#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 ;
|
smp_data_out->input[k].port[l].ptr = smp_data_out->input[k].port[l].h.binding->CSC ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -104,14 +121,14 @@
|
||||||
if ((a > 0) && (b > 0)) { \
|
if ((a > 0) && (b > 0)) { \
|
||||||
if (pNode->binding != NULL) { \
|
if (pNode->binding != NULL) { \
|
||||||
if (pNode->binding->CSC_Complex != NULL) { \
|
if (pNode->binding->CSC_Complex != NULL) { \
|
||||||
qsort (BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
|
qsort (BindStructCSC, nz, sizeof (BindElementKLUforCIDER), BindKluCompareCSCKLUforCIDER) ; \
|
||||||
i.COO = NULL ; \
|
i.COO = NULL ; \
|
||||||
i.CSC_Complex = pNode->binding->CSC_Complex ; \
|
i.CSC_Complex = pNode->binding->CSC_Complex ; \
|
||||||
matched = (BindKluElementCOO *) bsearch (&i, BindStructCSC, nz, sizeof(BindKluElementCOO), BindKluCompareCSC) ; \
|
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStructCSC, nz, sizeof (BindElementKLUforCIDER), BindKluCompareCSCKLUforCIDER) ; \
|
||||||
if (matched == NULL) { \
|
if (matched == NULL) { \
|
||||||
i.COO = pNode->ptr ; \
|
i.COO = pNode->ptr ; \
|
||||||
i.CSC_Complex = NULL ; \
|
i.CSC_Complex = NULL ; \
|
||||||
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
|
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
|
||||||
if (matched != NULL) { \
|
if (matched != NULL) { \
|
||||||
pNode->binding = matched ; \
|
pNode->binding = matched ; \
|
||||||
pNode->ptr = matched->CSC_Complex ; \
|
pNode->ptr = matched->CSC_Complex ; \
|
||||||
|
|
@ -120,14 +137,14 @@
|
||||||
} else { \
|
} else { \
|
||||||
i.COO = pNode->ptr ; \
|
i.COO = pNode->ptr ; \
|
||||||
i.CSC_Complex = NULL ; \
|
i.CSC_Complex = NULL ; \
|
||||||
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
|
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
|
||||||
pNode->binding = matched ; \
|
pNode->binding = matched ; \
|
||||||
pNode->ptr = matched->CSC_Complex ; \
|
pNode->ptr = matched->CSC_Complex ; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
i.COO = pNode->ptr ; \
|
i.COO = pNode->ptr ; \
|
||||||
i.CSC_Complex = NULL ; \
|
i.CSC_Complex = NULL ; \
|
||||||
matched = (BindKluElementCOO *) bsearch (&i, BindStruct, nz, sizeof(BindKluElementCOO), BindKluCompareCOO) ; \
|
matched = (BindElementKLUforCIDER *) bsearch (&i, BindStruct, nz, sizeof (BindElementKLUforCIDER), BindCompareKLUforCIDER) ; \
|
||||||
pNode->binding = matched ; \
|
pNode->binding = matched ; \
|
||||||
pNode->ptr = matched->CSC_Complex ; \
|
pNode->ptr = matched->CSC_Complex ; \
|
||||||
} \
|
} \
|
||||||
|
|
@ -135,3 +152,4 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -935,14 +935,32 @@ int klu_z_convert_matrix_in_CSR
|
||||||
klu_common *Common
|
klu_common *Common
|
||||||
) ;
|
) ;
|
||||||
|
|
||||||
|
typedef struct sBindElement {
|
||||||
|
double *COO ;
|
||||||
|
double *CSC ;
|
||||||
|
double *CSC_Complex ;
|
||||||
|
} BindElement ;
|
||||||
|
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
typedef struct sBindKluElementCOO {
|
typedef struct sBindElementKLUforCIDER {
|
||||||
double *COO ;
|
double *COO ;
|
||||||
double *CSC_Complex ;
|
double *CSC_Complex ;
|
||||||
} BindKluElementCOO ;
|
} BindElementKLUforCIDER ;
|
||||||
|
#endif
|
||||||
|
|
||||||
int BindKluCompareCOO (const void *a, const void *b) ;
|
typedef struct sKluLinkedListCOO {
|
||||||
int BindKluCompareCSC (const void *a, const void *b) ;
|
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 {
|
typedef struct sKLUmatrix {
|
||||||
klu_common *KLUmatrixCommon ; /* KLU common object */
|
klu_common *KLUmatrixCommon ; /* KLU common object */
|
||||||
|
|
@ -950,19 +968,30 @@ typedef struct sKLUmatrix {
|
||||||
klu_numeric *KLUmatrixNumeric ; /* KLU numeric object */
|
klu_numeric *KLUmatrixNumeric ; /* KLU numeric object */
|
||||||
int *KLUmatrixAp ; /* KLU column pointer */
|
int *KLUmatrixAp ; /* KLU column pointer */
|
||||||
int *KLUmatrixAi ; /* KLU row pointer */
|
int *KLUmatrixAi ; /* KLU row pointer */
|
||||||
|
double *KLUmatrixAx ; /* KLU Real Elements */
|
||||||
double *KLUmatrixAxComplex ; /* KLU Complex Elements */
|
double *KLUmatrixAxComplex ; /* KLU Complex Elements */
|
||||||
unsigned int KLUmatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
|
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 */
|
double *KLUmatrixIntermediateComplex ; /* KLU iRHS Intermediate for Solve Complex Step */
|
||||||
unsigned int KLUmatrixN ; /* KLU N, copied */
|
unsigned int KLUmatrixN ; /* KLU N */
|
||||||
unsigned int KLUmatrixNZ ; /* KLU nz, copied for AC Analysis */
|
unsigned int KLUmatrixNZ ; /* KLU nz */
|
||||||
int *KLUmatrixColCOO ; /* KLU Col Index for COO storage */
|
BindElement *KLUmatrixBindStructCOO ; /* KLU COO Binding Structure */
|
||||||
int *KLUmatrixRowCOO ; /* KLU Row Index for COO storage */
|
KluLinkedListCOO *KLUmatrixLinkedListCOO ; /* KLU COO in Linked List Format for Initial Parsing */
|
||||||
double *KLUmatrixValueComplexCOO ; /* KLU Complex Elements for COO storage */
|
unsigned int KLUmatrixLinkedListNZ ; /* KLU nz for the Initial Parsing */
|
||||||
BindKluElementCOO *KLUmatrixBindStructCOO ; /* KLU COO Binding Structure */
|
|
||||||
double *KLUmatrixTrashCOO ; /* KLU COO Trash Pointer for Ground Node not Stored in the Matrix */
|
double *KLUmatrixTrashCOO ; /* KLU COO Trash Pointer for Ground Node not Stored in the Matrix */
|
||||||
} KLUmatrix ;
|
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
|
#endif
|
||||||
|
|
||||||
|
} KLUmatrix ;
|
||||||
|
|
||||||
/* ========================================================================== */
|
/* ========================================================================== */
|
||||||
/* === KLU version ========================================================== */
|
/* === KLU version ========================================================== */
|
||||||
/* ========================================================================== */
|
/* ========================================================================== */
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ typedef struct sONEelem {
|
||||||
double *KLUrightLeftNode ;
|
double *KLUrightLeftNode ;
|
||||||
double *KLUrightRightNode ;
|
double *KLUrightRightNode ;
|
||||||
|
|
||||||
BindKluElementCOO *KLUleftLeftNodeBinding ;
|
BindElementKLUforCIDER *KLUleftLeftNodeBinding ;
|
||||||
BindKluElementCOO *KLUleftRightNodeBinding ;
|
BindElementKLUforCIDER *KLUleftRightNodeBinding ;
|
||||||
BindKluElementCOO *KLUrightLeftNodeBinding ;
|
BindElementKLUforCIDER *KLUrightLeftNodeBinding ;
|
||||||
BindKluElementCOO *KLUrightRightNodeBinding ;
|
BindElementKLUforCIDER *KLUrightRightNodeBinding ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -132,29 +132,29 @@ typedef struct sONEnode {
|
||||||
double *fPNiP1;
|
double *fPNiP1;
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
BindKluElementCOO *fPsiPsiiM1Binding ;
|
BindElementKLUforCIDER *fPsiPsiiM1Binding ;
|
||||||
BindKluElementCOO *fPsiPsiBinding ;
|
BindElementKLUforCIDER *fPsiPsiBinding ;
|
||||||
BindKluElementCOO *fPsiPsiiP1Binding ;
|
BindElementKLUforCIDER *fPsiPsiiP1Binding ;
|
||||||
BindKluElementCOO *fPsiNBinding ;
|
BindElementKLUforCIDER *fPsiNBinding ;
|
||||||
BindKluElementCOO *fPsiPBinding ;
|
BindElementKLUforCIDER *fPsiPBinding ;
|
||||||
BindKluElementCOO *fNPsiiM1Binding ;
|
BindElementKLUforCIDER *fNPsiiM1Binding ;
|
||||||
BindKluElementCOO *fNPsiBinding ;
|
BindElementKLUforCIDER *fNPsiBinding ;
|
||||||
BindKluElementCOO *fNPsiiP1Binding ;
|
BindElementKLUforCIDER *fNPsiiP1Binding ;
|
||||||
BindKluElementCOO *fNNiM1Binding ;
|
BindElementKLUforCIDER *fNNiM1Binding ;
|
||||||
BindKluElementCOO *fNNBinding ;
|
BindElementKLUforCIDER *fNNBinding ;
|
||||||
BindKluElementCOO *fNNiP1Binding ;
|
BindElementKLUforCIDER *fNNiP1Binding ;
|
||||||
BindKluElementCOO *fNPiM1Binding ;
|
BindElementKLUforCIDER *fNPiM1Binding ;
|
||||||
BindKluElementCOO *fNPBinding ;
|
BindElementKLUforCIDER *fNPBinding ;
|
||||||
BindKluElementCOO *fNPiP1Binding ;
|
BindElementKLUforCIDER *fNPiP1Binding ;
|
||||||
BindKluElementCOO *fPPsiiM1Binding ;
|
BindElementKLUforCIDER *fPPsiiM1Binding ;
|
||||||
BindKluElementCOO *fPPsiBinding ;
|
BindElementKLUforCIDER *fPPsiBinding ;
|
||||||
BindKluElementCOO *fPPsiiP1Binding ;
|
BindElementKLUforCIDER *fPPsiiP1Binding ;
|
||||||
BindKluElementCOO *fPPiM1Binding ;
|
BindElementKLUforCIDER *fPPiM1Binding ;
|
||||||
BindKluElementCOO *fPPBinding ;
|
BindElementKLUforCIDER *fPPBinding ;
|
||||||
BindKluElementCOO *fPPiP1Binding ;
|
BindElementKLUforCIDER *fPPiP1Binding ;
|
||||||
BindKluElementCOO *fPNiM1Binding ;
|
BindElementKLUforCIDER *fPNiM1Binding ;
|
||||||
BindKluElementCOO *fPNBinding ;
|
BindElementKLUforCIDER *fPNBinding ;
|
||||||
BindKluElementCOO *fPNiP1Binding ;
|
BindElementKLUforCIDER *fPNiP1Binding ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} ONEnode;
|
} ONEnode;
|
||||||
|
|
|
||||||
|
|
@ -28,39 +28,19 @@ typedef struct sSMPmatrix {
|
||||||
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
|
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
klu_common *CKTkluCommon ; /* KLU common object */
|
KLUmatrix *SMPkluMatrix ; /* KLU Pointer to the KLU Matrix Data Structure (only for CIDER, for the moment) */
|
||||||
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 */
|
|
||||||
unsigned int CKTkluMODE:1 ; /* KLU MODE parameter to enable KLU or not from the heuristic */
|
unsigned int CKTkluMODE:1 ; /* KLU MODE parameter to enable KLU or not from the heuristic */
|
||||||
#define CKTkluON 1 /* KLU MODE ON definition */
|
#define CKTkluON 1 /* KLU MODE ON definition */
|
||||||
#define CKTkluOFF 0 /* KLU MODE OFF definition */
|
#define CKTkluOFF 0 /* KLU MODE OFF definition */
|
||||||
|
double CKTkluMemGrowFactor ; /* KLU Memory Grow Factor - default = 1.2 */
|
||||||
#ifdef CIDER
|
|
||||||
KLUmatrix *SMPkluMatrix ; /* KLU Pointer to the KLU Matrix Data Structure (only for CIDER, for the moment) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} SMPmatrix ;
|
} SMPmatrix ;
|
||||||
|
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
void SMPmatrix_CSC (SMPmatrix *) ;
|
|
||||||
void SMPnnz (SMPmatrix *) ;
|
|
||||||
void spDeterminant_KLU (SMPmatrix *, int *, double *, double *) ;
|
void spDeterminant_KLU (SMPmatrix *, int *, double *, double *) ;
|
||||||
|
void SMPconvertCOOtoCSC (SMPmatrix *) ;
|
||||||
|
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
void SMPsolveKLUforCIDER (SMPmatrix *, double [], double [], double [], double []) ;
|
void SMPsolveKLUforCIDER (SMPmatrix *, double [], double [], double [], double []) ;
|
||||||
|
|
@ -74,9 +54,10 @@ int SMPluFacKLUforCIDER (SMPmatrix *) ;
|
||||||
void SMPprintKLUforCIDER (SMPmatrix *, char *) ;
|
void SMPprintKLUforCIDER (SMPmatrix *, char *) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
int SMPaddElt (SMPmatrix *, int, int, double) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int SMPaddElt( SMPmatrix *, int , int , double );
|
|
||||||
double * SMPmakeElt( SMPmatrix * , int , int );
|
double * SMPmakeElt( SMPmatrix * , int , int );
|
||||||
void SMPcClear( SMPmatrix *);
|
void SMPcClear( SMPmatrix *);
|
||||||
void SMPclear( SMPmatrix *);
|
void SMPclear( SMPmatrix *);
|
||||||
|
|
@ -112,3 +93,4 @@ void SMPsolveForCIDER (SMPmatrix *, double [], double []) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -296,20 +296,7 @@ extern void spMultTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
|
||||||
extern void spSolve( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* );
|
extern void spSolve( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* );
|
||||||
extern void spSolveTransposed(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 */
|
#endif /* spOKAY */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ struct TSKtask {
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
unsigned int TSKkluMODE:1;
|
unsigned int TSKkluMODE:1;
|
||||||
unsigned int TSKkluMemGrowFactor : 1 ;
|
double TSKkluMemGrowFactor ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,10 @@ typedef struct sTWOelem
|
||||||
double *KLUrightLeftNode ;
|
double *KLUrightLeftNode ;
|
||||||
double *KLUrightRightNode ;
|
double *KLUrightRightNode ;
|
||||||
|
|
||||||
BindKluElementCOO *KLUleftLeftNodeBinding ;
|
BindElementKLUforCIDER *KLUleftLeftNodeBinding ;
|
||||||
BindKluElementCOO *KLUleftRightNodeBinding ;
|
BindElementKLUforCIDER *KLUleftRightNodeBinding ;
|
||||||
BindKluElementCOO *KLUrightLeftNodeBinding ;
|
BindElementKLUforCIDER *KLUrightLeftNodeBinding ;
|
||||||
BindKluElementCOO *KLUrightRightNodeBinding ;
|
BindElementKLUforCIDER *KLUrightRightNodeBinding ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} TWOelem;
|
} TWOelem;
|
||||||
|
|
@ -213,63 +212,63 @@ typedef struct sTWOnode {
|
||||||
double *fPPsiOxP1;
|
double *fPPsiOxP1;
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
BindKluElementCOO *fPsiPsiBinding ;
|
BindElementKLUforCIDER *fPsiPsiBinding ;
|
||||||
BindKluElementCOO *fPsiNBinding ;
|
BindElementKLUforCIDER *fPsiNBinding ;
|
||||||
BindKluElementCOO *fPsiPBinding ;
|
BindElementKLUforCIDER *fPsiPBinding ;
|
||||||
BindKluElementCOO *fNPsiBinding ;
|
BindElementKLUforCIDER *fNPsiBinding ;
|
||||||
BindKluElementCOO *fNNBinding ;
|
BindElementKLUforCIDER *fNNBinding ;
|
||||||
BindKluElementCOO *fNPBinding ;
|
BindElementKLUforCIDER *fNPBinding ;
|
||||||
BindKluElementCOO *fPPsiBinding ;
|
BindElementKLUforCIDER *fPPsiBinding ;
|
||||||
BindKluElementCOO *fPNBinding ;
|
BindElementKLUforCIDER *fPNBinding ;
|
||||||
BindKluElementCOO *fPPBinding ;
|
BindElementKLUforCIDER *fPPBinding ;
|
||||||
BindKluElementCOO *fPsiPsiiP1Binding ;
|
BindElementKLUforCIDER *fPsiPsiiP1Binding ;
|
||||||
BindKluElementCOO *fPsiPsijP1Binding ;
|
BindElementKLUforCIDER *fPsiPsijP1Binding ;
|
||||||
BindKluElementCOO *fNPsiiP1Binding ;
|
BindElementKLUforCIDER *fNPsiiP1Binding ;
|
||||||
BindKluElementCOO *fNNiP1Binding ;
|
BindElementKLUforCIDER *fNNiP1Binding ;
|
||||||
BindKluElementCOO *fNPsijP1Binding ;
|
BindElementKLUforCIDER *fNPsijP1Binding ;
|
||||||
BindKluElementCOO *fNNjP1Binding ;
|
BindElementKLUforCIDER *fNNjP1Binding ;
|
||||||
BindKluElementCOO *fPPsiiP1Binding ;
|
BindElementKLUforCIDER *fPPsiiP1Binding ;
|
||||||
BindKluElementCOO *fPPiP1Binding ;
|
BindElementKLUforCIDER *fPPiP1Binding ;
|
||||||
BindKluElementCOO *fPPsijP1Binding ;
|
BindElementKLUforCIDER *fPPsijP1Binding ;
|
||||||
BindKluElementCOO *fPPjP1Binding ;
|
BindElementKLUforCIDER *fPPjP1Binding ;
|
||||||
BindKluElementCOO *fNPsiiP1jP1Binding ;
|
BindElementKLUforCIDER *fNPsiiP1jP1Binding ;
|
||||||
BindKluElementCOO *fNNiP1jP1Binding ;
|
BindElementKLUforCIDER *fNNiP1jP1Binding ;
|
||||||
BindKluElementCOO *fPPsiiP1jP1Binding ;
|
BindElementKLUforCIDER *fPPsiiP1jP1Binding ;
|
||||||
BindKluElementCOO *fPPiP1jP1Binding ;
|
BindElementKLUforCIDER *fPPiP1jP1Binding ;
|
||||||
BindKluElementCOO *fPsiPsiiM1Binding ;
|
BindElementKLUforCIDER *fPsiPsiiM1Binding ;
|
||||||
BindKluElementCOO *fNPsiiM1Binding ;
|
BindElementKLUforCIDER *fNPsiiM1Binding ;
|
||||||
BindKluElementCOO *fNNiM1Binding ;
|
BindElementKLUforCIDER *fNNiM1Binding ;
|
||||||
BindKluElementCOO *fPPsiiM1Binding ;
|
BindElementKLUforCIDER *fPPsiiM1Binding ;
|
||||||
BindKluElementCOO *fPPiM1Binding ;
|
BindElementKLUforCIDER *fPPiM1Binding ;
|
||||||
BindKluElementCOO *fNPsiiM1jP1Binding ;
|
BindElementKLUforCIDER *fNPsiiM1jP1Binding ;
|
||||||
BindKluElementCOO *fNNiM1jP1Binding ;
|
BindElementKLUforCIDER *fNNiM1jP1Binding ;
|
||||||
BindKluElementCOO *fPPsiiM1jP1Binding ;
|
BindElementKLUforCIDER *fPPsiiM1jP1Binding ;
|
||||||
BindKluElementCOO *fPPiM1jP1Binding ;
|
BindElementKLUforCIDER *fPPiM1jP1Binding ;
|
||||||
BindKluElementCOO *fPsiPsijM1Binding ;
|
BindElementKLUforCIDER *fPsiPsijM1Binding ;
|
||||||
BindKluElementCOO *fNPsijM1Binding ;
|
BindElementKLUforCIDER *fNPsijM1Binding ;
|
||||||
BindKluElementCOO *fNNjM1Binding ;
|
BindElementKLUforCIDER *fNNjM1Binding ;
|
||||||
BindKluElementCOO *fPPsijM1Binding ;
|
BindElementKLUforCIDER *fPPsijM1Binding ;
|
||||||
BindKluElementCOO *fPPjM1Binding ;
|
BindElementKLUforCIDER *fPPjM1Binding ;
|
||||||
BindKluElementCOO *fNPsiiM1jM1Binding ;
|
BindElementKLUforCIDER *fNPsiiM1jM1Binding ;
|
||||||
BindKluElementCOO *fNNiM1jM1Binding ;
|
BindElementKLUforCIDER *fNNiM1jM1Binding ;
|
||||||
BindKluElementCOO *fPPsiiM1jM1Binding ;
|
BindElementKLUforCIDER *fPPsiiM1jM1Binding ;
|
||||||
BindKluElementCOO *fPPiM1jM1Binding ;
|
BindElementKLUforCIDER *fPPiM1jM1Binding ;
|
||||||
BindKluElementCOO *fNPsiiP1jM1Binding ;
|
BindElementKLUforCIDER *fNPsiiP1jM1Binding ;
|
||||||
BindKluElementCOO *fNNiP1jM1Binding ;
|
BindElementKLUforCIDER *fNNiP1jM1Binding ;
|
||||||
BindKluElementCOO *fPPsiiP1jM1Binding ;
|
BindElementKLUforCIDER *fPPsiiP1jM1Binding ;
|
||||||
BindKluElementCOO *fPPiP1jM1Binding ;
|
BindElementKLUforCIDER *fPPiP1jM1Binding ;
|
||||||
BindKluElementCOO *fNPsiInBinding ;
|
BindElementKLUforCIDER *fNPsiInBinding ;
|
||||||
BindKluElementCOO *fNPsiInP1Binding ;
|
BindElementKLUforCIDER *fNPsiInP1Binding ;
|
||||||
BindKluElementCOO *fNPsiOxBinding ;
|
BindElementKLUforCIDER *fNPsiOxBinding ;
|
||||||
BindKluElementCOO *fNPsiOxP1Binding ;
|
BindElementKLUforCIDER *fNPsiOxP1Binding ;
|
||||||
BindKluElementCOO *fPPsiInBinding ;
|
BindElementKLUforCIDER *fPPsiInBinding ;
|
||||||
BindKluElementCOO *fPPsiInP1Binding ;
|
BindElementKLUforCIDER *fPPsiInP1Binding ;
|
||||||
BindKluElementCOO *fPPsiOxBinding ;
|
BindElementKLUforCIDER *fPPsiOxBinding ;
|
||||||
BindKluElementCOO *fPPsiOxP1Binding ;
|
BindElementKLUforCIDER *fPPsiOxP1Binding ;
|
||||||
BindKluElementCOO *fNPsiInM1Binding ;
|
BindElementKLUforCIDER *fNPsiInM1Binding ;
|
||||||
BindKluElementCOO *fNPsiOxM1Binding ;
|
BindElementKLUforCIDER *fNPsiOxM1Binding ;
|
||||||
BindKluElementCOO *fPPsiInM1Binding ;
|
BindElementKLUforCIDER *fPPsiInM1Binding ;
|
||||||
BindKluElementCOO *fPPsiOxM1Binding ;
|
BindElementKLUforCIDER *fPPsiOxM1Binding ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} TWOnode;
|
} TWOnode;
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ Int KLU_defaults
|
||||||
|
|
||||||
/* parameters */
|
/* parameters */
|
||||||
Common->tol = 0.001 ; /* pivot tolerance for diagonal */
|
Common->tol = 0.001 ; /* pivot tolerance for diagonal */
|
||||||
Common->memgrow = 1.2; /* realloc size ratio increase for LU factors */
|
Common->memgrow = 10; /* realloc size ratio increase for LU factors */
|
||||||
Common->initmem_amd = 1.2 ; /* init. mem with AMD: c*nnz(L) + n */
|
Common->initmem_amd = 10 ; /* init. mem with AMD: c*nnz(L) + n */
|
||||||
Common->initmem = 10 ; /* init. mem otherwise: c*nnz(A) + n */
|
Common->initmem = 10 ; /* init. mem otherwise: c*nnz(A) + n */
|
||||||
Common->btf = TRUE ; /* use BTF pre-ordering, or not */
|
Common->btf = TRUE ; /* use BTF pre-ordering, or not */
|
||||||
Common->maxwork = 0 ; /* no limit to work done by btf_order */
|
Common->maxwork = 0 ; /* no limit to work done by btf_order */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -32,25 +32,11 @@ NIinit(CKTcircuit *ckt)
|
||||||
ckt->CKTmatrix = TMALLOC (SMPmatrix, 1) ;
|
ckt->CKTmatrix = TMALLOC (SMPmatrix, 1) ;
|
||||||
|
|
||||||
#ifdef KLU
|
#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 */
|
ckt->CKTmatrix->CKTkluMODE = ckt->CKTkluMODE ; /* TO BE SUBSTITUTED WITH THE HEURISTICS */
|
||||||
|
ckt->CKTmatrix->CKTkluMemGrowFactor = ckt->CKTkluMemGrowFactor ;
|
||||||
klu_defaults (ckt->CKTmatrix->CKTkluCommon) ;
|
|
||||||
ckt->CKTmatrix->CKTkluCommon->memgrow = ckt->CKTkluMemGrowFactor ;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ckt->CKTniState = NIUNINITIALIZED;
|
ckt->CKTniState = NIUNINITIALIZED;
|
||||||
return SMPnewMatrix(ckt->CKTmatrix, 0);
|
return SMPnewMatrix(ckt->CKTmatrix, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@ libsparse_la_SOURCES = \
|
||||||
spsolve.c \
|
spsolve.c \
|
||||||
sputils.c
|
sputils.c
|
||||||
|
|
||||||
|
if !KLU_WANTED
|
||||||
if KLU_WANTED
|
|
||||||
libsparse_la_SOURCES += spCSC.c
|
|
||||||
else
|
|
||||||
libsparse_la_SOURCES += spsmp.c
|
libsparse_la_SOURCES += spsmp.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -24,3 +21,4 @@ AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||||
AM_CFLAGS = $(STATIC)
|
AM_CFLAGS = $(STATIC)
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) ;
|
|
||||||
}
|
|
||||||
|
|
@ -259,13 +259,13 @@ ACan(CKTcircuit* ckt, int restart)
|
||||||
if (ckt->CKTmatrix->CKTkluMODE)
|
if (ckt->CKTmatrix->CKTkluMODE)
|
||||||
{
|
{
|
||||||
/* Conversion from Real Matrix to Complex Matrix */
|
/* Conversion from Real Matrix to Complex Matrix */
|
||||||
if (!ckt->CKTmatrix->CKTkluMatrixIsComplex)
|
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
|
||||||
{
|
{
|
||||||
for (i = 0 ; i < DEVmaxnum ; i++)
|
for (i = 0 ; i < DEVmaxnum ; i++)
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
|
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -290,7 +290,7 @@ ACan(CKTcircuit* ckt, int restart)
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
|
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ ACan(CKTcircuit* ckt, int restart)
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
|
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -443,7 +443,7 @@ endsweep:
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
|
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,16 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
|
||||||
break;
|
break;
|
||||||
case OPT_ORIGNZ:
|
case OPT_ORIGNZ:
|
||||||
if ( ckt->CKTmatrix != NULL ) {
|
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);
|
val->iValue = spOriginalCount(ckt->CKTmatrix->SPmatrix);
|
||||||
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
val->iValue = 0;
|
val->iValue = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +58,8 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
|
||||||
if ( ckt->CKTmatrix != NULL ) {
|
if ( ckt->CKTmatrix != NULL ) {
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (ckt->CKTmatrix->CKTkluMODE)
|
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
|
else
|
||||||
val->iValue = spFillinCount(ckt->CKTmatrix->SPmatrix);
|
val->iValue = spFillinCount(ckt->CKTmatrix->SPmatrix);
|
||||||
#else
|
#else
|
||||||
|
|
@ -63,7 +73,8 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
|
||||||
if ( ckt->CKTmatrix != NULL ) {
|
if ( ckt->CKTmatrix != NULL ) {
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (ckt->CKTmatrix->CKTkluMODE)
|
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
|
else
|
||||||
val->iValue = spElementCount(ckt->CKTmatrix->SPmatrix);
|
val->iValue = spElementCount(ckt->CKTmatrix->SPmatrix);
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -14,21 +14,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
#include "ngspice/devdefs.h"
|
#include "ngspice/devdefs.h"
|
||||||
#include "ngspice/sperror.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
|
int
|
||||||
CKTpzSetup(CKTcircuit *ckt, int type)
|
CKTpzSetup(CKTcircuit *ckt, int type)
|
||||||
{
|
{
|
||||||
|
|
@ -104,35 +89,12 @@ CKTpzSetup(CKTcircuit *ckt, int type)
|
||||||
job->PZnumswaps = 1;
|
job->PZnumswaps = 1;
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (ckt->CKTmatrix->CKTkluMODE)
|
if (matrix->CKTkluMODE)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ;
|
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ;
|
||||||
|
|
||||||
int i ;
|
/* Convert the COO Storage to CSC for KLU and Fill the Binding Table */
|
||||||
int n = SMPmatSize (ckt->CKTmatrix) ;
|
SMPconvertCOOtoCSC (matrix) ;
|
||||||
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 */
|
/* KLU Pointers Assignment */
|
||||||
for (i = 0 ; i < DEVmaxnum ; i++)
|
for (i = 0 ; i < DEVmaxnum ; i++)
|
||||||
|
|
@ -140,34 +102,48 @@ CKTpzSetup(CKTcircuit *ckt, int type)
|
||||||
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
/* ReOrder */
|
/* ReOrder */
|
||||||
error = SMPpreOrder (ckt->CKTmatrix) ;
|
error = SMPpreOrder (matrix) ;
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf (stderr, "Error during ReOrdering\n") ;
|
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++)
|
for (i = 0 ; i < DEVmaxnum ; i++)
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
|
matrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
|
|
||||||
/* Input Pos */
|
/* 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 ;
|
j.COO = job->PZdrive_pptr ;
|
||||||
job->PZdrive_pptr = ((BindElement *) bsearch (&j, ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare))->CSC_Complex ;
|
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 */
|
/* 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 ;
|
j.COO = job->PZdrive_nptr ;
|
||||||
job->PZdrive_nptr = ((BindElement *) bsearch (&j, ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare))->CSC_Complex ;
|
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 {
|
} else {
|
||||||
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ;
|
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ;
|
||||||
|
|
@ -180,3 +156,4 @@ CKTpzSetup(CKTcircuit *ckt, int type)
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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:
|
* Procedure:
|
||||||
*
|
*
|
||||||
|
|
@ -117,7 +101,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
SMPmatrix *saved_matrix = NULL;
|
SMPmatrix *saved_matrix = NULL;
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
int nz, size_CSC;
|
int size_CSC ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef notdef
|
#ifndef notdef
|
||||||
|
|
@ -173,33 +157,14 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
/* Create the perturbation matrix */
|
/* Create the perturbation matrix */
|
||||||
delta_Y = TMALLOC(SMPmatrix, 1);
|
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);
|
error = SMPnewMatrix(delta_Y, size);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
#ifdef KLU
|
||||||
|
delta_Y->SMPkluMatrix->KLUmatrixDiag = NULL ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// SMPprint(delta_Y, NULL);
|
// SMPprint(delta_Y, NULL);
|
||||||
size += 1;
|
size += 1;
|
||||||
|
|
||||||
|
|
@ -300,15 +265,15 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (ckt->CKTkluMODE) {
|
if (ckt->CKTkluMODE) {
|
||||||
|
|
||||||
/* Convert the KLU matrix to complex */
|
/* Convert the KLU Circuit Matrix to Complex */
|
||||||
for (i = 0 ; i < Y->CKTklunz ; i++) {
|
for (i = 0 ; i < (int)Y->SMPkluMatrix->KLUmatrixNZ ; i++) {
|
||||||
Y->CKTkluAx_Complex [2 * i] = Y->CKTkluAx [i];
|
Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i] = Y->SMPkluMatrix->KLUmatrixAx [i] ;
|
||||||
Y->CKTkluAx_Complex [2 * i + 1] = 0.0;
|
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
|
#endif
|
||||||
|
|
||||||
|
|
@ -378,14 +343,14 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
/* ReOrder */
|
/* ReOrder */
|
||||||
error = SMPpreOrder (ckt->CKTmatrix) ;
|
error = SMPpreOrder (ckt->CKTmatrix) ;
|
||||||
|
|
||||||
/* Conversion from Real Matrix to Complex Matrix */
|
/* Conversion from Real Circuit Matrix to Complex Circuit Matrix */
|
||||||
if (!ckt->CKTmatrix->CKTkluMatrixIsComplex)
|
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
|
||||||
{
|
{
|
||||||
for (i = 0 ; i < DEVmaxnum ; i++)
|
for (i = 0 ; i < DEVmaxnum ; i++)
|
||||||
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
|
||||||
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
|
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -470,43 +435,23 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
if (ckt->CKTmatrix->CKTkluMODE)
|
if (ckt->CKTmatrix->CKTkluMODE)
|
||||||
{
|
{
|
||||||
size_CSC = SMPmatSize (ckt->CKTmatrix) ;
|
/* Populate the delta_Y KLU Matrix */
|
||||||
ckt->CKTmatrix->CKTkluN = size_CSC ;
|
|
||||||
|
|
||||||
SMPnnz (ckt->CKTmatrix) ;
|
/* Convert the COO Storage to CSC for KLU and Fill the Binding Table */
|
||||||
nz = ckt->CKTmatrix->CKTklunz ;
|
SMPconvertCOOtoCSC (delta_Y) ;
|
||||||
|
|
||||||
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) ;
|
|
||||||
|
|
||||||
/* KLU Pointers Assignment */
|
/* KLU Pointers Assignment */
|
||||||
if (DEVices [sg->dev]->DEVbindCSC)
|
if (DEVices [sg->dev]->DEVbindCSC)
|
||||||
DEVices [sg->dev]->DEVbindCSC (sg->model, ckt) ;
|
DEVices [sg->dev]->DEVbindCSC (sg->model, ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
|
delta_Y->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
|
||||||
|
|
||||||
/* Clear KLU Vectors */
|
/* Clear KLU Vectors */
|
||||||
for (i = 0 ; i < nz ; i++)
|
for (i = 0 ; i < (int)delta_Y->SMPkluMatrix->KLUmatrixNZ ; i++)
|
||||||
{
|
{
|
||||||
ckt->CKTmatrix->CKTkluAx [i] = 0 ;
|
delta_Y->SMPkluMatrix->KLUmatrixAx [i] = 0 ;
|
||||||
ckt->CKTmatrix->CKTkluAx_Complex [2 * i] = 0 ;
|
delta_Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i] = 0 ;
|
||||||
ckt->CKTmatrix->CKTkluAx_Complex [2 * i + 1] = 0 ;
|
delta_Y->SMPkluMatrix->KLUmatrixAxComplex [2 * i + 1] = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -529,7 +474,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
||||||
if (DEVices [sg->dev]->DEVbindCSCComplex)
|
if (DEVices [sg->dev]->DEVbindCSCComplex)
|
||||||
DEVices [sg->dev]->DEVbindCSCComplex (sg->model, ckt) ;
|
DEVices [sg->dev]->DEVbindCSCComplex (sg->model, ckt) ;
|
||||||
|
|
||||||
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixComplex ;
|
delta_Y->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,6 @@ int nthreads;
|
||||||
return(E_NOMEM);\
|
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
|
int
|
||||||
CKTsetup(CKTcircuit *ckt)
|
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 */
|
for(i=0;i<=MAX(2,ckt->CKTmaxOrder)+1;i++) { /* dctran needs 3 states as minimum */
|
||||||
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double);
|
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double);
|
||||||
}
|
}
|
||||||
|
|
@ -171,48 +173,6 @@ CKTsetup(CKTcircuit *ckt)
|
||||||
/* gtri - end - Setup for adding rshunt option resistors */
|
/* gtri - end - Setup for adding rshunt option resistors */
|
||||||
#endif
|
#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);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,30 +51,16 @@ Author: 2020 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
$(module)bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
$(module)bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
$(module)model *model = ($(module)model *)inModel ;
|
$(module)model *model = ($(module)model *)inModel ;
|
||||||
$(module)instance *here ;
|
$(module)instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the $(module) models */
|
/* loop through all the $(module) models */
|
||||||
for ( ; model != NULL ; model = $(module)nextModel(model))
|
for ( ; model != NULL ; model = $(module)nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,31 +8,17 @@ Author: 2015 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
ASRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
ASRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
ASRCmodel *model = (ASRCmodel *)inModel ;
|
ASRCmodel *model = (ASRCmodel *)inModel ;
|
||||||
ASRCinstance *here ;
|
ASRCinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
int j, k ;
|
int j, k ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the ASRC models */
|
/* loop through all the ASRC models */
|
||||||
for ( ; model != NULL ; model = ASRCnextModel(model))
|
for ( ; model != NULL ; model = ASRCnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BJTmodel *model = (BJTmodel *)inModel ;
|
BJTmodel *model = (BJTmodel *)inModel ;
|
||||||
BJTinstance *here ;
|
BJTinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BJT models */
|
/* loop through all the BJT models */
|
||||||
for ( ; model != NULL ; model = BJTnextModel(model))
|
for ( ; model != NULL ; model = BJTnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B1model *model = (B1model *)inModel ;
|
B1model *model = (B1model *)inModel ;
|
||||||
B1instance *here ;
|
B1instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B1 models */
|
/* loop through all the B1 models */
|
||||||
for ( ; model != NULL ; model = B1nextModel(model))
|
for ( ; model != NULL ; model = B1nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B2model *model = (B2model *)inModel ;
|
B2model *model = (B2model *)inModel ;
|
||||||
B2instance *here ;
|
B2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B2 models */
|
/* loop through all the B2 models */
|
||||||
for ( ; model != NULL ; model = B2nextModel(model))
|
for ( ; model != NULL ; model = B2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM3model *model = (BSIM3model *)inModel ;
|
BSIM3model *model = (BSIM3model *)inModel ;
|
||||||
BSIM3instance *here ;
|
BSIM3instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM3 models */
|
/* loop through all the BSIM3 models */
|
||||||
for ( ; model != NULL ; model = BSIM3nextModel(model))
|
for ( ; model != NULL ; model = BSIM3nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B3SOIDDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B3SOIDDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B3SOIDDmodel *model = (B3SOIDDmodel *)inModel ;
|
B3SOIDDmodel *model = (B3SOIDDmodel *)inModel ;
|
||||||
B3SOIDDinstance *here ;
|
B3SOIDDinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B3SOIDD models */
|
/* loop through all the B3SOIDD models */
|
||||||
for ( ; model != NULL ; model = B3SOIDDnextModel(model))
|
for ( ; model != NULL ; model = B3SOIDDnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B3SOIFDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B3SOIFDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B3SOIFDmodel *model = (B3SOIFDmodel *)inModel ;
|
B3SOIFDmodel *model = (B3SOIFDmodel *)inModel ;
|
||||||
B3SOIFDinstance *here ;
|
B3SOIFDinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B3SOIFD models */
|
/* loop through all the B3SOIFD models */
|
||||||
for ( ; model != NULL ; model = B3SOIFDnextModel(model))
|
for ( ; model != NULL ; model = B3SOIFDnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B3SOIPDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B3SOIPDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B3SOIPDmodel *model = (B3SOIPDmodel *)inModel ;
|
B3SOIPDmodel *model = (B3SOIPDmodel *)inModel ;
|
||||||
B3SOIPDinstance *here ;
|
B3SOIPDinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B3SOIPD models */
|
/* loop through all the B3SOIPD models */
|
||||||
for ( ; model != NULL ; model = B3SOIPDnextModel(model))
|
for ( ; model != NULL ; model = B3SOIPDnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM3v0bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM3v0bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM3v0model *model = (BSIM3v0model *)inModel ;
|
BSIM3v0model *model = (BSIM3v0model *)inModel ;
|
||||||
BSIM3v0instance *here ;
|
BSIM3v0instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM3v0 models */
|
/* loop through all the BSIM3v0 models */
|
||||||
for ( ; model != NULL ; model = BSIM3v0nextModel(model))
|
for ( ; model != NULL ; model = BSIM3v0nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM3v1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM3v1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM3v1model *model = (BSIM3v1model *)inModel ;
|
BSIM3v1model *model = (BSIM3v1model *)inModel ;
|
||||||
BSIM3v1instance *here ;
|
BSIM3v1instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM3v1 models */
|
/* loop through all the BSIM3v1 models */
|
||||||
for ( ; model != NULL ; model = BSIM3v1nextModel(model))
|
for ( ; model != NULL ; model = BSIM3v1nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM3v32bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM3v32bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM3v32model *model = (BSIM3v32model *)inModel ;
|
BSIM3v32model *model = (BSIM3v32model *)inModel ;
|
||||||
BSIM3v32instance *here ;
|
BSIM3v32instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM3v32 models */
|
/* loop through all the BSIM3v32 models */
|
||||||
for ( ; model != NULL ; model = BSIM3v32nextModel(model))
|
for ( ; model != NULL ; model = BSIM3v32nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM4bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM4bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM4model *model = (BSIM4model *)inModel ;
|
BSIM4model *model = (BSIM4model *)inModel ;
|
||||||
BSIM4instance *here ;
|
BSIM4instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM4 models */
|
/* loop through all the BSIM4 models */
|
||||||
for ( ; model != NULL ; model = BSIM4nextModel(model))
|
for ( ; model != NULL ; model = BSIM4nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM4v5bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM4v5bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM4v5model *model = (BSIM4v5model *)inModel ;
|
BSIM4v5model *model = (BSIM4v5model *)inModel ;
|
||||||
BSIM4v5instance *here ;
|
BSIM4v5instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM4v5 models */
|
/* loop through all the BSIM4v5 models */
|
||||||
for ( ; model != NULL ; model = BSIM4v5nextModel(model))
|
for ( ; model != NULL ; model = BSIM4v5nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM4v6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM4v6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM4v6model *model = (BSIM4v6model *)inModel ;
|
BSIM4v6model *model = (BSIM4v6model *)inModel ;
|
||||||
BSIM4v6instance *here ;
|
BSIM4v6instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM4v6 models */
|
/* loop through all the BSIM4v6 models */
|
||||||
for ( ; model != NULL ; model = BSIM4v6nextModel(model))
|
for ( ; model != NULL ; model = BSIM4v6nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
BSIM4v7bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
BSIM4v7bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
BSIM4v7model *model = (BSIM4v7model *)inModel ;
|
BSIM4v7model *model = (BSIM4v7model *)inModel ;
|
||||||
BSIM4v7instance *here ;
|
BSIM4v7instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the BSIM4v7 models */
|
/* loop through all the BSIM4v7 models */
|
||||||
for ( ; model != NULL ; model = BSIM4v7nextModel(model))
|
for ( ; model != NULL ; model = BSIM4v7nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
B4SOIbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
B4SOIbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
B4SOImodel *model = (B4SOImodel *)inModel ;
|
B4SOImodel *model = (B4SOImodel *)inModel ;
|
||||||
B4SOIinstance *here ;
|
B4SOIinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the B4SOI models */
|
/* loop through all the B4SOI models */
|
||||||
for ( ; model != NULL ; model = B4SOInextModel(model))
|
for ( ; model != NULL ; model = B4SOInextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
CAPbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
CAPbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
CAPmodel *model = (CAPmodel *)inModel ;
|
CAPmodel *model = (CAPmodel *)inModel ;
|
||||||
CAPinstance *here ;
|
CAPinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the CAP models */
|
/* loop through all the CAP models */
|
||||||
for ( ; model != NULL ; model = CAPnextModel(model))
|
for ( ; model != NULL ; model = CAPnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
CCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
CCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
CCCSmodel *model = (CCCSmodel *)inModel ;
|
CCCSmodel *model = (CCCSmodel *)inModel ;
|
||||||
CCCSinstance *here ;
|
CCCSinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the CCCS models */
|
/* loop through all the CCCS models */
|
||||||
for ( ; model != NULL ; model = CCCSnextModel(model))
|
for ( ; model != NULL ; model = CCCSnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
CCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
CCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
CCVSmodel *model = (CCVSmodel *)inModel ;
|
CCVSmodel *model = (CCVSmodel *)inModel ;
|
||||||
CCVSinstance *here ;
|
CCVSinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the CCVS models */
|
/* loop through all the CCVS models */
|
||||||
for ( ; model != NULL ; model = CCVSnextModel(model))
|
for ( ; model != NULL ; model = CCVSnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,32 +8,17 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
CPLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
CPLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
CPLmodel *model = (CPLmodel *)inModel ;
|
CPLmodel *model = (CPLmodel *)inModel ;
|
||||||
CPLinstance *here ;
|
CPLinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
int m, p ;
|
int m, p ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the CPL models */
|
/* loop through all the CPL models */
|
||||||
for ( ; model != NULL ; model = CPLnextModel(model))
|
for ( ; model != NULL ; model = CPLnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
CSWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
CSWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
CSWmodel *model = (CSWmodel *)inModel ;
|
CSWmodel *model = (CSWmodel *)inModel ;
|
||||||
CSWinstance *here ;
|
CSWinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the CSW models */
|
/* loop through all the CSW models */
|
||||||
for ( ; model != NULL ; model = CSWnextModel(model))
|
for ( ; model != NULL ; model = CSWnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
DIObindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
DIObindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
DIOmodel *model = (DIOmodel *)inModel ;
|
DIOmodel *model = (DIOmodel *)inModel ;
|
||||||
DIOinstance *here ;
|
DIOinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the DIO models */
|
/* loop through all the DIO models */
|
||||||
for ( ; model != NULL ; model = DIOnextModel(model))
|
for ( ; model != NULL ; model = DIOnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
HFETAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
HFETAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
HFETAmodel *model = (HFETAmodel *)inModel ;
|
HFETAmodel *model = (HFETAmodel *)inModel ;
|
||||||
HFETAinstance *here ;
|
HFETAinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the HFETA models */
|
/* loop through all the HFETA models */
|
||||||
for ( ; model != NULL ; model = HFETAnextModel(model))
|
for ( ; model != NULL ; model = HFETAnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
HFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
HFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
HFET2model *model = (HFET2model *)inModel ;
|
HFET2model *model = (HFET2model *)inModel ;
|
||||||
HFET2instance *here ;
|
HFET2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the HFET2 models */
|
/* loop through all the HFET2 models */
|
||||||
for ( ; model != NULL ; model = HFET2nextModel(model))
|
for ( ; model != NULL ; model = HFET2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
HSM2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
HSM2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
HSM2model *model = (HSM2model *)inModel ;
|
HSM2model *model = (HSM2model *)inModel ;
|
||||||
HSM2instance *here ;
|
HSM2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the HSM2 models */
|
/* loop through all the HSM2 models */
|
||||||
for ( ; model != NULL ; model = HSM2nextModel(model))
|
for ( ; model != NULL ; model = HSM2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
HSMHVbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
HSMHVbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
HSMHVmodel *model = (HSMHVmodel *)inModel ;
|
HSMHVmodel *model = (HSMHVmodel *)inModel ;
|
||||||
HSMHVinstance *here ;
|
HSMHVinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the HSMHV models */
|
/* loop through all the HSMHV models */
|
||||||
for ( ; model != NULL ; model = HSMHVnextModel(model))
|
for ( ; model != NULL ; model = HSMHVnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2016 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
HSMHV2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
HSMHV2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
HSMHV2model *model = (HSMHV2model *)inModel ;
|
HSMHV2model *model = (HSMHV2model *)inModel ;
|
||||||
HSMHV2instance *here ;
|
HSMHV2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the HSMHV2 models */
|
/* loop through all the HSMHV2 models */
|
||||||
for ( ; model != NULL ; model = HSMHV2nextModel(model))
|
for ( ; model != NULL ; model = HSMHV2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
INDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
INDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
INDmodel *model = (INDmodel *)inModel ;
|
INDmodel *model = (INDmodel *)inModel ;
|
||||||
INDinstance *here ;
|
INDinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the IND models */
|
/* loop through all the IND models */
|
||||||
for ( ; model != NULL ; model = INDnextModel(model))
|
for ( ; model != NULL ; model = INDnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MUTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MUTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MUTmodel *model = (MUTmodel *)inModel ;
|
MUTmodel *model = (MUTmodel *)inModel ;
|
||||||
MUTinstance *here ;
|
MUTinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MUT models */
|
/* loop through all the MUT models */
|
||||||
for ( ; model != NULL ; model = MUTnextModel(model))
|
for ( ; model != NULL ; model = MUTnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
JFETbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
JFETbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
JFETmodel *model = (JFETmodel *)inModel ;
|
JFETmodel *model = (JFETmodel *)inModel ;
|
||||||
JFETinstance *here ;
|
JFETinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the JFET models */
|
/* loop through all the JFET models */
|
||||||
for ( ; model != NULL ; model = JFETnextModel(model))
|
for ( ; model != NULL ; model = JFETnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
JFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
JFET2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
JFET2model *model = (JFET2model *)inModel ;
|
JFET2model *model = (JFET2model *)inModel ;
|
||||||
JFET2instance *here ;
|
JFET2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the JFET2 models */
|
/* loop through all the JFET2 models */
|
||||||
for ( ; model != NULL ; model = JFET2nextModel(model))
|
for ( ; model != NULL ; model = JFET2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
LTRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
LTRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
LTRAmodel *model = (LTRAmodel *)inModel ;
|
LTRAmodel *model = (LTRAmodel *)inModel ;
|
||||||
LTRAinstance *here ;
|
LTRAinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the LTRA models */
|
/* loop through all the LTRA models */
|
||||||
for ( ; model != NULL ; model = LTRAnextModel(model))
|
for ( ; model != NULL ; model = LTRAnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MESmodel *model = (MESmodel *)inModel ;
|
MESmodel *model = (MESmodel *)inModel ;
|
||||||
MESinstance *here ;
|
MESinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MES models */
|
/* loop through all the MES models */
|
||||||
for ( ; model != NULL ; model = MESnextModel(model))
|
for ( ; model != NULL ; model = MESnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MESAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MESAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MESAmodel *model = (MESAmodel *)inModel ;
|
MESAmodel *model = (MESAmodel *)inModel ;
|
||||||
MESAinstance *here ;
|
MESAinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MESA models */
|
/* loop through all the MESA models */
|
||||||
for ( ; model != NULL ; model = MESAnextModel(model))
|
for ( ; model != NULL ; model = MESAnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MOS1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MOS1bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MOS1model *model = (MOS1model *)inModel ;
|
MOS1model *model = (MOS1model *)inModel ;
|
||||||
MOS1instance *here ;
|
MOS1instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MOS1 models */
|
/* loop through all the MOS1 models */
|
||||||
for ( ; model != NULL ; model = MOS1nextModel(model))
|
for ( ; model != NULL ; model = MOS1nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MOS2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MOS2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MOS2model *model = (MOS2model *)inModel ;
|
MOS2model *model = (MOS2model *)inModel ;
|
||||||
MOS2instance *here ;
|
MOS2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MOS2 models */
|
/* loop through all the MOS2 models */
|
||||||
for ( ; model != NULL ; model = MOS2nextModel(model))
|
for ( ; model != NULL ; model = MOS2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MOS3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MOS3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MOS3model *model = (MOS3model *)inModel ;
|
MOS3model *model = (MOS3model *)inModel ;
|
||||||
MOS3instance *here ;
|
MOS3instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MOS3 models */
|
/* loop through all the MOS3 models */
|
||||||
for ( ; model != NULL ; model = MOS3nextModel(model))
|
for ( ; model != NULL ; model = MOS3nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2012 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MOS6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MOS6bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MOS6model *model = (MOS6model *)inModel ;
|
MOS6model *model = (MOS6model *)inModel ;
|
||||||
MOS6instance *here ;
|
MOS6instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MOS6 models */
|
/* loop through all the MOS6 models */
|
||||||
for ( ; model != NULL ; model = MOS6nextModel(model))
|
for ( ; model != NULL ; model = MOS6nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
MOS9bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MOS9bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MOS9model *model = (MOS9model *)inModel ;
|
MOS9model *model = (MOS9model *)inModel ;
|
||||||
MOS9instance *here ;
|
MOS9instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MOS9 models */
|
/* loop through all the MOS9 models */
|
||||||
for ( ; model != NULL ; model = MOS9nextModel(model))
|
for ( ; model != NULL ; model = MOS9nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
NBJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
NBJTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
NBJTmodel *model = (NBJTmodel *)inModel ;
|
NBJTmodel *model = (NBJTmodel *)inModel ;
|
||||||
NBJTinstance *here ;
|
NBJTinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the NBJT models */
|
/* loop through all the NBJT models */
|
||||||
for ( ; model != NULL ; model = NBJTnextModel(model))
|
for ( ; model != NULL ; model = NBJTnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
NBJT2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
NBJT2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
NBJT2model *model = (NBJT2model *)inModel ;
|
NBJT2model *model = (NBJT2model *)inModel ;
|
||||||
NBJT2instance *here ;
|
NBJT2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the NBJT2 models */
|
/* loop through all the NBJT2 models */
|
||||||
for ( ; model != NULL ; model = NBJT2nextModel(model))
|
for ( ; model != NULL ; model = NBJT2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
NUMDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
NUMDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
NUMDmodel *model = (NUMDmodel *)inModel ;
|
NUMDmodel *model = (NUMDmodel *)inModel ;
|
||||||
NUMDinstance *here ;
|
NUMDinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the NUMD models */
|
/* loop through all the NUMD models */
|
||||||
for ( ; model != NULL ; model = NUMDnextModel(model))
|
for ( ; model != NULL ; model = NUMDnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
NUMD2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
NUMD2bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
NUMD2model *model = (NUMD2model *)inModel ;
|
NUMD2model *model = (NUMD2model *)inModel ;
|
||||||
NUMD2instance *here ;
|
NUMD2instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the NUMD2 models */
|
/* loop through all the NUMD2 models */
|
||||||
for ( ; model != NULL ; model = NUMD2nextModel(model))
|
for ( ; model != NULL ; model = NUMD2nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
NUMOSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
NUMOSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
NUMOSmodel *model = (NUMOSmodel *)inModel ;
|
NUMOSmodel *model = (NUMOSmodel *)inModel ;
|
||||||
NUMOSinstance *here ;
|
NUMOSinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the NUMOS models */
|
/* loop through all the NUMOS models */
|
||||||
for ( ; model != NULL ; model = NUMOSnextModel(model))
|
for ( ; model != NULL ; model = NUMOSnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
RESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
RESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel ;
|
RESmodel *model = (RESmodel *)inModel ;
|
||||||
RESinstance *here ;
|
RESinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the RES models */
|
/* loop through all the RES models */
|
||||||
for ( ; model != NULL ; model = RESnextModel(model))
|
for ( ; model != NULL ; model = RESnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
SOI3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
SOI3bindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
SOI3model *model = (SOI3model *)inModel ;
|
SOI3model *model = (SOI3model *)inModel ;
|
||||||
SOI3instance *here ;
|
SOI3instance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the SOI3 models */
|
/* loop through all the SOI3 models */
|
||||||
for ( ; model != NULL ; model = SOI3nextModel(model))
|
for ( ; model != NULL ; model = SOI3nextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
SWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
SWbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
SWmodel *model = (SWmodel *)inModel ;
|
SWmodel *model = (SWmodel *)inModel ;
|
||||||
SWinstance *here ;
|
SWinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the SW models */
|
/* loop through all the SW models */
|
||||||
for ( ; model != NULL ; model = SWnextModel(model))
|
for ( ; model != NULL ; model = SWnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
TRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
TRAbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
TRAmodel *model = (TRAmodel *)inModel ;
|
TRAmodel *model = (TRAmodel *)inModel ;
|
||||||
TRAinstance *here ;
|
TRAinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the TRA models */
|
/* loop through all the TRA models */
|
||||||
for ( ; model != NULL ; model = TRAnextModel(model))
|
for ( ; model != NULL ; model = TRAnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
TXLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
TXLbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
TXLmodel *model = (TXLmodel *)inModel ;
|
TXLmodel *model = (TXLmodel *)inModel ;
|
||||||
TXLinstance *here ;
|
TXLinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the TXL models */
|
/* loop through all the TXL models */
|
||||||
for ( ; model != NULL ; model = TXLnextModel(model))
|
for ( ; model != NULL ; model = TXLnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
VBICbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
VBICbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
VBICmodel *model = (VBICmodel *)inModel ;
|
VBICmodel *model = (VBICmodel *)inModel ;
|
||||||
VBICinstance *here ;
|
VBICinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the VBIC models */
|
/* loop through all the VBIC models */
|
||||||
for ( ; model != NULL ; model = VBICnextModel(model))
|
for ( ; model != NULL ; model = VBICnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
VCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
VCCSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
VCCSmodel *model = (VCCSmodel *)inModel ;
|
VCCSmodel *model = (VCCSmodel *)inModel ;
|
||||||
VCCSinstance *here ;
|
VCCSinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the VCCS models */
|
/* loop through all the VCCS models */
|
||||||
for ( ; model != NULL ; model = VCCSnextModel(model))
|
for ( ; model != NULL ; model = VCCSnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
VCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
VCVSbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
VCVSmodel *model = (VCVSmodel *)inModel ;
|
VCVSmodel *model = (VCVSmodel *)inModel ;
|
||||||
VCVSinstance *here ;
|
VCVSinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the VCVS models */
|
/* loop through all the VCVS models */
|
||||||
for ( ; model != NULL ; model = VCVSnextModel(model))
|
for ( ; model != NULL ; model = VCVSnextModel(model))
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,16 @@ Author: 2013 Francesco Lannutti
|
||||||
#include "ngspice/sperror.h"
|
#include "ngspice/sperror.h"
|
||||||
#include "ngspice/klu-binding.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
|
int
|
||||||
VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
VSRCmodel *model = (VSRCmodel *)inModel ;
|
VSRCmodel *model = (VSRCmodel *)inModel ;
|
||||||
VSRCinstance *here ;
|
VSRCinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the VSRC models */
|
/* loop through all the VSRC models */
|
||||||
for ( ; model != NULL ; model = VSRCnextModel(model))
|
for ( ; model != NULL ; model = VSRCnextModel(model))
|
||||||
|
|
@ -47,7 +33,9 @@ VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* Pole-Zero Analysis */
|
/* Pole-Zero Analysis */
|
||||||
if (here->VSRCibrIbrPtr)
|
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) ;
|
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ;
|
||||||
here->VSRCibrIbrBinding = matched ;
|
here->VSRCibrIbrBinding = matched ;
|
||||||
if (matched != NULL)
|
if (matched != NULL)
|
||||||
|
|
|
||||||
|
|
@ -12,26 +12,12 @@
|
||||||
#include "ngspice/mifproto.h"
|
#include "ngspice/mifproto.h"
|
||||||
#include "ngspice/mifdefs.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
|
int
|
||||||
MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MIFmodel *model = (MIFmodel *)inModel ;
|
MIFmodel *model = (MIFmodel *)inModel ;
|
||||||
MIFinstance *here ;
|
MIFinstance *here ;
|
||||||
double *i ;
|
BindElement i, *matched, *BindStruct ;
|
||||||
BindElement *matched, *BindStruct ;
|
|
||||||
int ii, j, k, l, num_conn, num_port, num_port_k ;
|
int ii, j, k, l, num_conn, num_port, num_port_k ;
|
||||||
Mif_Boolean_t is_input, is_output ;
|
Mif_Boolean_t is_input, is_output ;
|
||||||
Mif_Cntl_Src_Type_t cntl_src_type ;
|
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 ;
|
Mif_Smp_Ptr_t *smp_data_cntl, *smp_data_out ;
|
||||||
size_t nz ;
|
size_t nz ;
|
||||||
|
|
||||||
BindStruct = ckt->CKTmatrix->CKTbindStruct ;
|
BindStruct = ckt->CKTmatrix->SMPkluMatrix->KLUmatrixBindStructCOO ;
|
||||||
nz = (size_t)ckt->CKTmatrix->CKTklunz ;
|
nz = (size_t)ckt->CKTmatrix->SMPkluMatrix->KLUmatrixLinkedListNZ ;
|
||||||
|
|
||||||
/* loop through all the MIF models */
|
/* loop through all the MIF models */
|
||||||
for ( ; model != NULL ; model = MIFnextModel(model))
|
for ( ; model != NULL ; model = MIFnextModel(model))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue