import changed ngspice files for project KLU
SMP to solver interface separated KLU-1 Patch for dump_routines and new SMPmatrix structure
This commit is contained in:
parent
63d24981a8
commit
99ba028925
14
configure.ac
14
configure.ac
|
|
@ -1071,9 +1071,23 @@ if test "x$enable_pss" = "xyes"; then
|
|||
AC_MSG_RESULT([WARNING: PSS analysis enabled])
|
||||
fi
|
||||
|
||||
# --enable-klu: Use KLU linear systems solver
|
||||
AC_ARG_ENABLE(klu,
|
||||
AS_HELP_STRING([--enable-klu],[Use KLU linear systems solver]))
|
||||
|
||||
# Add KLU solver to ngspice
|
||||
if test "$enable_klu" = "yes"; then
|
||||
AC_DEFINE(KLU,[],[Define if we want KLU linear systems solver])
|
||||
AC_MSG_RESULT(WARNING: KLU solver enabled)
|
||||
fi
|
||||
AM_CONDITIONAL([KLU_WANTED], [test "$enable_klu" = "yes"])
|
||||
|
||||
# Output Files
|
||||
# ------------
|
||||
|
||||
AM_COND_IF([KLU_WANTED],
|
||||
[AC_CONFIG_FILES([src/maths/KLU/Makefile])])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
man/Makefile
|
||||
man/man1/Makefile
|
||||
|
|
|
|||
|
|
@ -168,7 +168,13 @@ ngspice_LDADD += \
|
|||
maths/misc/libmathmisc.la \
|
||||
maths/fft/libmathfft.la \
|
||||
maths/poly/libpoly.la \
|
||||
maths/ni/libni.la \
|
||||
maths/ni/libni.la
|
||||
|
||||
if KLU_WANTED
|
||||
ngspice_LDADD += maths/KLU/libKLU.la
|
||||
endif
|
||||
|
||||
ngspice_LDADD += \
|
||||
maths/sparse/libsparse.la \
|
||||
misc/libmisc.la
|
||||
|
||||
|
|
@ -270,6 +276,9 @@ ngmultidec_LDADD = \
|
|||
maths/sparse/libsparse.la \
|
||||
misc/libmisc.la
|
||||
|
||||
if KLU_WANTED
|
||||
ngmultidec_LDADD += maths/KLU/libKLU.la
|
||||
endif
|
||||
|
||||
## ngmakeidx:
|
||||
|
||||
|
|
@ -402,6 +411,10 @@ libspice_la_LIBADD += \
|
|||
ciderlib/support/libcidersuprt.la
|
||||
endif
|
||||
|
||||
if KLU_WANTED
|
||||
libspice_la_LIBADD += maths/KLU/libKLU.la
|
||||
endif
|
||||
|
||||
libspice_la_LIBADD += \
|
||||
maths/deriv/libderiv.la \
|
||||
maths/cmaths/libcmaths.la \
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ include_HEADERS = \
|
|||
ipcproto.h \
|
||||
ipctiein.h \
|
||||
jobdefs.h \
|
||||
amd.h \
|
||||
btf.h \
|
||||
colamd.h \
|
||||
klu.h \
|
||||
UFconfig.h \
|
||||
lsort.h \
|
||||
macros.h \
|
||||
material.h \
|
||||
|
|
|
|||
|
|
@ -101,6 +101,11 @@ typedef struct SPICEdev {
|
|||
int *DEVinstSize; /* size of an instance */
|
||||
int *DEVmodSize; /* size of a model */
|
||||
|
||||
#ifdef KLU
|
||||
int (*DEVbindklu)(GENmodel*, CKTcircuit*);
|
||||
int (*DEVbindkluComplex)(GENmodel*, CKTcircuit*);
|
||||
#endif
|
||||
|
||||
} SPICEdev; /* instance of structure for each possible type of device */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
#ifndef ngspice_SMPDEFS_H
|
||||
#define ngspice_SMPDEFS_H
|
||||
|
||||
/* Typedef removed by Francesco Lannutti (2012-02) to create the new SMPmatrix structure */
|
||||
/*
|
||||
typedef struct MatrixFrame SMPmatrix;
|
||||
*/
|
||||
typedef struct MatrixFrame MatrixFrame;
|
||||
typedef struct MatrixElement *SMPelement;
|
||||
|
||||
/**********
|
||||
|
|
@ -14,6 +18,43 @@ Modified: 2000 AlansFixes
|
|||
#include <math.h>
|
||||
#include "ngspice/complex.h"
|
||||
|
||||
#ifdef KLU
|
||||
#include "ngspice/klu.h"
|
||||
#endif
|
||||
|
||||
struct SMPmatrix {
|
||||
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
|
||||
|
||||
#ifdef KLU
|
||||
klu_common *CKTkluCommon ; /* KLU common object */
|
||||
klu_symbolic *CKTkluSymbolic ; /* KLU symbolic object */
|
||||
klu_numeric *CKTkluNumeric ; /* KLU numeric object */
|
||||
int *CKTkluAp ; /* KLU column pointer */
|
||||
int *CKTkluAi ; /* KLU row pointer */
|
||||
double *CKTkluAx ; /* KLU element */
|
||||
double *CKTkluIntermediate ; /* KLU RHS Intermediate for Solve Real Step */
|
||||
double *CKTkluIntermediate_Complex ; /* KLU iRHS Intermediate for Solve Complex Step */
|
||||
double **CKTkluBind_Sparse ; /* KLU - Sparse original element position */
|
||||
double **CKTkluBind_KLU ; /* KLU - KLU new element position */
|
||||
double **CKTkluBind_KLU_Complex ; /* KLU - KLU new element position in Complex analysis */
|
||||
double **CKTkluDiag ; /* KLU pointer to diagonal element to perform Gmin */
|
||||
int CKTkluN ; /* KLU N, copied */
|
||||
int CKTklunz ; /* KLU nz, copied for AC Analysis */
|
||||
int CKTkluMODE ; /* KLU MODE parameter to enable KLU or not from the heuristic */
|
||||
#define CKTkluON 1 /* KLU MODE ON definition */
|
||||
#define CKTkluOFF 0 /* KLU MODE OFF definition */
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/* SMPmatrix structure alias - Francesco Lannutti (2012-02) */
|
||||
typedef struct SMPmatrix SMPmatrix ;
|
||||
|
||||
|
||||
#ifdef KLU
|
||||
void SMPmatrix_CSC ( SMPmatrix * ) ;
|
||||
void SMPnnz ( SMPmatrix * ) ;
|
||||
#endif
|
||||
int SMPaddElt( SMPmatrix *, int , int , double );
|
||||
double * SMPmakeElt( SMPmatrix * , int , int );
|
||||
void SMPcClear( SMPmatrix *);
|
||||
|
|
@ -27,7 +68,7 @@ void SMPcaSolve(SMPmatrix *Matrix, double RHS[], double iRHS[],
|
|||
void SMPcSolve( SMPmatrix *, double [], double [], double [], double []);
|
||||
void SMPsolve( SMPmatrix *, double [], double []);
|
||||
int SMPmatSize( SMPmatrix *);
|
||||
int SMPnewMatrix( SMPmatrix ** );
|
||||
int SMPnewMatrix( SMPmatrix * );
|
||||
void SMPdestroy( SMPmatrix *);
|
||||
int SMPpreOrder( SMPmatrix *);
|
||||
void SMPprint( SMPmatrix * , char *);
|
||||
|
|
|
|||
|
|
@ -294,4 +294,10 @@ extern void spMultTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
|
|||
extern void spSolve( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* );
|
||||
extern void spSolveTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
|
||||
|
||||
extern int WriteCol_original(MatrixPtr, int, spREAL *, int *, spREAL **, spREAL **, spREAL **);
|
||||
extern int WriteCol_original_dump(MatrixPtr, int, spREAL *, int *);
|
||||
extern void spMatrix_CSC(MatrixPtr, int *, int *, double *, int, double **, double **, double **);
|
||||
extern void spMatrix_CSC_dump(MatrixPtr, char *);
|
||||
extern void spRHS_CSC_dump(spREAL *, char *, MatrixPtr);
|
||||
|
||||
#endif /* spOKAY */
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ libKLU_complex_la_SOURCES = \
|
|||
libKLU_complex_la_CPPFLAGS = -I$(top_srcdir)/src/include -DCOMPLEX
|
||||
|
||||
|
||||
libKLU_la_SOURCES =
|
||||
libKLU_la_SOURCES = \
|
||||
klusmp.c
|
||||
|
||||
libKLU_la_LIBADD = \
|
||||
libKLU_real.la \
|
||||
libKLU_complex.la
|
||||
|
|
|
|||
|
|
@ -3,4 +3,13 @@
|
|||
SUBDIRS = cmaths ni sparse poly deriv misc fft
|
||||
DIST_SUBDIRS = cmaths ni sparse poly deriv misc fft
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
if KLU_WANTED
|
||||
SUBDIRS += KLU
|
||||
DIST_SUBDIRS += KLU
|
||||
endif
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in KLU/Makefile.in
|
||||
|
||||
if KLU_WANTED
|
||||
MAINTAINERCLEANFILES -= KLU/Makefile.in
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Author: 1985 Thomas L. Quarles
|
|||
void
|
||||
NIdestroy(CKTcircuit *ckt)
|
||||
{
|
||||
if (ckt->CKTmatrix)
|
||||
if (ckt->CKTmatrix->SPmatrix)
|
||||
SMPdestroy(ckt->CKTmatrix);
|
||||
ckt->CKTmatrix = NULL;
|
||||
if(ckt->CKTrhs) FREE(ckt->CKTrhs);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "ngspice/sperror.h"
|
||||
#include "ngspice/smpdefs.h"
|
||||
|
||||
#ifdef KLU
|
||||
#include "ngspice/klu.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
NIinit(CKTcircuit *ckt)
|
||||
|
|
@ -24,6 +27,30 @@ NIinit(CKTcircuit *ckt)
|
|||
/* a concession to Ken Kundert's sparse matrix package - SMP doesn't need this*/
|
||||
int Error;
|
||||
#endif /* SPARSE */
|
||||
|
||||
/* Allocation of the new SMPmatrix structure - Francesco Lannuti (2012-02) */
|
||||
ckt->CKTmatrix = TMALLOC (SMPmatrix, 1) ;
|
||||
|
||||
#ifdef KLU
|
||||
ckt->CKTmatrix->CKTkluCommon = TMALLOC (klu_common, 1) ;
|
||||
ckt->CKTmatrix->CKTkluSymbolic = NULL ;
|
||||
ckt->CKTmatrix->CKTkluNumeric = NULL ;
|
||||
ckt->CKTmatrix->CKTkluAp = NULL ;
|
||||
ckt->CKTmatrix->CKTkluAi = NULL ;
|
||||
ckt->CKTmatrix->CKTkluAx = NULL ;
|
||||
ckt->CKTmatrix->CKTkluIntermediate = NULL ;
|
||||
ckt->CKTmatrix->CKTkluIntermediate_Complex = NULL ;
|
||||
ckt->CKTmatrix->CKTkluBind_Sparse = NULL ;
|
||||
ckt->CKTmatrix->CKTkluBind_KLU = NULL ;
|
||||
ckt->CKTmatrix->CKTkluBind_KLU_Complex = NULL ;
|
||||
ckt->CKTmatrix->CKTkluDiag = NULL ;
|
||||
ckt->CKTmatrix->CKTkluN = 0 ;
|
||||
ckt->CKTmatrix->CKTklunz = 0 ;
|
||||
ckt->CKTmatrix->CKTkluMODE = CKTkluON ; /* TO BE SUBSTITUTED WITH THE HEURISTICS */
|
||||
|
||||
klu_defaults (ckt->CKTmatrix->CKTkluCommon) ;
|
||||
#endif
|
||||
|
||||
ckt->CKTniState = NIUNINITIALIZED;
|
||||
return(SMPnewMatrix( &(ckt->CKTmatrix) ) );
|
||||
return (SMPnewMatrix (ckt->CKTmatrix));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,15 @@ libsparse_la_SOURCES = \
|
|||
spextra.c \
|
||||
spfactor.c \
|
||||
spoutput.c \
|
||||
spsmp.c \
|
||||
spsolve.c \
|
||||
sputils.c
|
||||
|
||||
|
||||
if KLU_WANTED
|
||||
libsparse_la_SOURCES += spCSC.c
|
||||
else
|
||||
libsparse_la_SOURCES += spsmp.c
|
||||
endif
|
||||
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
|
|
@ -77,6 +77,25 @@ static void ExpandTranslationArrays( MatrixPtr, int );
|
|||
|
||||
|
||||
|
||||
int WriteCol_original(MatrixPtr Matrix, int Col, spREAL *CSC_Element, int *CSC_Row, spREAL **bind_Sparse, spREAL **bind_KLU, spREAL **diag) {
|
||||
|
||||
int i=0;
|
||||
ElementPtr current=Matrix->FirstInCol[Col];
|
||||
while (current!=NULL) {
|
||||
// spREAL element=current->Real;
|
||||
bind_Sparse [i] = (double *)current ;
|
||||
// CSC_Element[i]=element;
|
||||
bind_KLU [i] = &(CSC_Element [i]) ;
|
||||
CSC_Row[i]=(current->Row) - 1;
|
||||
if (CSC_Row [i] == Col - 1) diag [0] = &(CSC_Element [i]) ;
|
||||
i++;
|
||||
current=current->NextInCol;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -60,6 +60,210 @@ int Printer_Width = PRINTER_WIDTH;
|
|||
#include "ngspice/wstdio.h"
|
||||
#endif
|
||||
|
||||
void spMatrix_CSC(MatrixPtr Matrix, int *Ap, int *Ai, double *Ax, int n, double **bind_Sparse, double **bind_KLU, double **diag) {
|
||||
|
||||
int offset, i ;
|
||||
// int j, *temp_vector_Ap, *temp_vector_Ai, *Q, *Q_new, col;
|
||||
// int pstart, pend, dim, k, max_index, max_Ai, temp_Ai;
|
||||
// int *bind_KLU_P, *bind_KLU_Pinv, kbar ;
|
||||
// spREAL temp_elem, *temp_vector_A ;
|
||||
// Q=(int*)SP_MALLOC(int, n);
|
||||
// temp_vector_Ap=(int*)SP_MALLOC(int, n+1);
|
||||
// temp_vector_Ai=(int*)SP_MALLOC(int, nz);
|
||||
// temp_vector_A=(spREAL*)SP_MALLOC(spREAL, nz);
|
||||
// bind_KLU_P = (int *) SP_MALLOC (int, nz) ;
|
||||
// bind_KLU_Pinv = (int *) SP_MALLOC (int, nz) ;
|
||||
|
||||
offset=0;
|
||||
// temp_vector_Ap[0]=offset;
|
||||
Ap[0]=offset;
|
||||
for (i=1;i<=n;i++) {
|
||||
// offset+=WriteCol_original(Matrix, i, (spREAL*)((long)temp_vector_A+offset*sizeof(spREAL)),
|
||||
// (int*)((long)temp_vector_Ai+offset*sizeof(int)), &col,
|
||||
// (spREAL **)((long)bind_Sparse + offset * sizeof(spREAL *)),
|
||||
// (spREAL **)((long)bind_KLU + offset * sizeof(spREAL *)));
|
||||
// temp_vector_Ap[i]=offset;
|
||||
offset+=WriteCol_original(Matrix, i, (spREAL*)((long)Ax+offset*sizeof(spREAL)),
|
||||
(int*)((long)Ai+offset*sizeof(int)),
|
||||
(spREAL **)((long)bind_Sparse + offset * sizeof(spREAL *)),
|
||||
(spREAL **)((long)bind_KLU + offset * sizeof(spREAL *)),
|
||||
(spREAL **)((long)diag + (i - 1) * sizeof(spREAL *)));
|
||||
|
||||
Ap[i]=offset;
|
||||
// Q[i-1]=col;
|
||||
}
|
||||
|
||||
/* for (i = 0 ; i < nz ; i++) {
|
||||
bind_KLU_P [i] = i ;
|
||||
bind_KLU_Pinv [i] = i ;
|
||||
}
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
pstart=temp_vector_Ap[i];
|
||||
pend=temp_vector_Ap[i+1];
|
||||
dim=pend-pstart;
|
||||
for (j=0;j<dim;j++) {
|
||||
max_index=pstart;
|
||||
max_Ai=temp_vector_Ai[pstart];
|
||||
for (k=1;k<dim-j;k++) {
|
||||
if (max_Ai<temp_vector_Ai[pstart+k]) {
|
||||
max_index=pstart+k;
|
||||
max_Ai=temp_vector_Ai[pstart+k];
|
||||
}
|
||||
}
|
||||
if (max_index != pstart + dim - j - 1) {
|
||||
temp_Ai=temp_vector_Ai[pstart+dim-j-1];
|
||||
temp_vector_Ai[pstart+dim-j-1]=temp_vector_Ai[max_index];
|
||||
temp_vector_Ai[max_index]=temp_Ai;
|
||||
temp_elem=temp_vector_A[pstart+dim-j-1];
|
||||
temp_vector_A[pstart+dim-j-1]=temp_vector_A[max_index];
|
||||
temp_vector_A[max_index]=temp_elem;
|
||||
kbar = bind_KLU_Pinv [max_index] ;
|
||||
bind_KLU_P [kbar] = pstart + dim - j - 1 ;
|
||||
bind_KLU_Pinv [pstart + dim - j - 1] = kbar ;
|
||||
bind_KLU_P [pstart + dim - j - 1] = max_index ;
|
||||
bind_KLU_Pinv [max_index] = pstart + dim - j - 1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Q_new=(int*)SP_MALLOC(int, n);
|
||||
for (i=0;i<n;i++) Q_new[Q[i]]=i;
|
||||
//for (i = 0 ; i < n ; i++) printf("Q_new [i] : %d\tQ [i]: %d\n", Q_new [i], Q [i]);
|
||||
offset=0;
|
||||
for (i=0;i<n;i++) {
|
||||
Ap[i]=offset;
|
||||
pstart=temp_vector_Ap[Q_new[i]];
|
||||
// pstart=temp_vector_Ap[i];
|
||||
pend=temp_vector_Ap[Q_new[i]+1];
|
||||
// pend=temp_vector_Ap[i+1];
|
||||
for (j=pstart;j<pend;j++) {
|
||||
Ai[offset]=temp_vector_Ai[j];
|
||||
Ax[offset]=temp_vector_A[j];
|
||||
bind_KLU [bind_KLU_Pinv [j]] = &(Ax [offset]) ;
|
||||
//printf("bind_KLU [20] da spOutput: %u\n", bind_KLU [20]) ;
|
||||
// bind_KLU [j] = &(Ax [offset]) ;
|
||||
if (Ai [offset] == i) diag [i] = &(Ax [offset]) ;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
Ap[n]=offset;
|
||||
|
||||
free(Q);
|
||||
free(Q_new);
|
||||
free(temp_vector_Ap);
|
||||
free(temp_vector_Ai);
|
||||
free(temp_vector_A);
|
||||
free (bind_KLU_P) ;
|
||||
free (bind_KLU_Pinv) ;
|
||||
*/
|
||||
}
|
||||
|
||||
void spMatrix_CSC_dump(MatrixPtr Matrix, char *CSC_output) {
|
||||
|
||||
int offset, i, j, *CSC_Ai, *CSC_Ap, *temp_vector_Ap, *temp_vector_Ai, *Q, *Q_new, n, nz, col;
|
||||
int pstart, pend, dim, k, max_index, max_Ai, temp_Ai;
|
||||
double **bind ; //FITTIZIO
|
||||
spREAL temp_elem, *CSC_A, *temp_vector_A;
|
||||
n=spGetSize(Matrix, 1);
|
||||
nz = Matrix->Elements ;
|
||||
Q=(int*)SP_MALLOC(int, n);
|
||||
temp_vector_Ap=(int*)SP_MALLOC(int, n+1);
|
||||
temp_vector_Ai=(int*)SP_MALLOC(int, nz);
|
||||
temp_vector_A=(spREAL*)SP_MALLOC(spREAL, nz);
|
||||
CSC_Ap=(int*)SP_MALLOC(int, n+1);
|
||||
CSC_Ai=(int*)SP_MALLOC(int, nz);
|
||||
CSC_A=(spREAL*)SP_MALLOC(spREAL, nz);
|
||||
|
||||
offset=0;
|
||||
temp_vector_Ap[0]=offset;
|
||||
for (i=1;i<=n;i++) {
|
||||
offset+=WriteCol_original(Matrix, i, (spREAL*)((long)temp_vector_A+offset*sizeof(spREAL)), (int*)((long)temp_vector_Ai+offset*sizeof(int)), (spREAL **)bind, (spREAL **)bind, (spREAL **)bind); //NON FUNZIONA PER ORA
|
||||
temp_vector_Ap[i]=offset;
|
||||
Q[i-1]=col;
|
||||
}
|
||||
|
||||
for (i=0;i<n;i++) {
|
||||
pstart=temp_vector_Ap[i];
|
||||
pend=temp_vector_Ap[i+1];
|
||||
dim=pend-pstart;
|
||||
for (j=0;j<dim;j++) {
|
||||
max_index=pstart;
|
||||
max_Ai=temp_vector_Ai[pstart];
|
||||
for (k=1;k<dim-j;k++) {
|
||||
if (max_Ai<temp_vector_Ai[pstart+k]) {
|
||||
max_index=pstart+k;
|
||||
max_Ai=temp_vector_Ai[pstart+k];
|
||||
}
|
||||
}
|
||||
temp_Ai=0;
|
||||
temp_Ai=temp_vector_Ai[pstart+dim-j-1];
|
||||
temp_vector_Ai[pstart+dim-j-1]=temp_vector_Ai[max_index];
|
||||
temp_vector_Ai[max_index]=temp_Ai;
|
||||
temp_Ai=0;
|
||||
temp_elem=0;
|
||||
temp_elem=temp_vector_A[pstart+dim-j-1];
|
||||
temp_vector_A[pstart+dim-j-1]=temp_vector_A[max_index];
|
||||
temp_vector_A[max_index]=temp_elem;
|
||||
temp_elem=0;
|
||||
}
|
||||
}
|
||||
|
||||
Q_new=(int*)SP_MALLOC(int, n);
|
||||
for (i=0;i<n;i++) Q_new[Q[i]]=i;
|
||||
offset=0;
|
||||
for (i=0;i<n;i++) {
|
||||
CSC_Ap[i]=offset;
|
||||
pstart=temp_vector_Ap[Q_new[i]];
|
||||
pend=temp_vector_Ap[Q_new[i]+1];
|
||||
for (j=pstart;j<pend;j++) {
|
||||
CSC_Ai[offset]=temp_vector_Ai[j];
|
||||
CSC_A[offset]=temp_vector_A[j];
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
CSC_Ap[n]=offset;
|
||||
|
||||
FILE *output;
|
||||
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=CSC_Ap[i];j<CSC_Ap[i+1];j++) fprintf(output, "%d %d %-.9g\n", CSC_Ai[j]+1, i+1, CSC_A[j]);
|
||||
}
|
||||
fclose(output);
|
||||
|
||||
free(Q);
|
||||
free(Q_new);
|
||||
free(temp_vector_Ap);
|
||||
free(temp_vector_Ai);
|
||||
free(temp_vector_A);
|
||||
free(CSC_Ap);
|
||||
free(CSC_Ai);
|
||||
free(CSC_A);
|
||||
|
||||
}
|
||||
|
||||
void spRHS_CSC_dump(RealNumber *RHS, char *CSC_output_b, MatrixPtr Matrix) {
|
||||
|
||||
int n, i;
|
||||
n=spGetSize(Matrix, 1);
|
||||
FILE *output;
|
||||
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", RHS[i]);
|
||||
fclose(output);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if DOCUMENTATION
|
||||
|
|
|
|||
|
|
@ -108,15 +108,14 @@ extern double logb(double);
|
|||
|
||||
static void LoadGmin(SMPmatrix *eMatrix, double Gmin);
|
||||
|
||||
|
||||
/*
|
||||
* SMPaddElt()
|
||||
*/
|
||||
int
|
||||
SMPaddElt(SMPmatrix *Matrix, int Row, int Col, double Value)
|
||||
{
|
||||
*spGetElement( Matrix, Row, Col ) = Value;
|
||||
return spError( Matrix );
|
||||
*spGetElement( Matrix->SPmatrix, Row, Col ) = Value;
|
||||
return spError( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -125,7 +124,7 @@ SMPaddElt(SMPmatrix *Matrix, int Row, int Col, double Value)
|
|||
double *
|
||||
SMPmakeElt(SMPmatrix *Matrix, int Row, int Col)
|
||||
{
|
||||
return spGetElement( Matrix, Row, Col );
|
||||
return spGetElement( Matrix->SPmatrix, Row, Col );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -134,7 +133,7 @@ SMPmakeElt(SMPmatrix *Matrix, int Row, int Col)
|
|||
void
|
||||
SMPcClear(SMPmatrix *Matrix)
|
||||
{
|
||||
spClear( Matrix );
|
||||
spClear( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -143,7 +142,7 @@ SMPcClear(SMPmatrix *Matrix)
|
|||
void
|
||||
SMPclear(SMPmatrix *Matrix)
|
||||
{
|
||||
spClear( Matrix );
|
||||
spClear( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
#define NG_IGNORE(x) (void)x
|
||||
|
|
@ -157,8 +156,8 @@ SMPcLUfac(SMPmatrix *Matrix, double PivTol)
|
|||
{
|
||||
NG_IGNORE(PivTol);
|
||||
|
||||
spSetComplex( Matrix );
|
||||
return spFactor( Matrix );
|
||||
spSetComplex( Matrix->SPmatrix );
|
||||
return spFactor( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -169,9 +168,9 @@ int
|
|||
SMPluFac(SMPmatrix *Matrix, double PivTol, double Gmin)
|
||||
{
|
||||
NG_IGNORE(PivTol);
|
||||
spSetReal( Matrix );
|
||||
spSetReal( Matrix->SPmatrix );
|
||||
LoadGmin( Matrix, Gmin );
|
||||
return spFactor( Matrix );
|
||||
return spFactor( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -182,8 +181,8 @@ SMPcReorder(SMPmatrix *Matrix, double PivTol, double PivRel,
|
|||
int *NumSwaps)
|
||||
{
|
||||
*NumSwaps = 1;
|
||||
spSetComplex( Matrix );
|
||||
return spOrderAndFactor( Matrix, NULL,
|
||||
spSetComplex( Matrix->SPmatrix );
|
||||
return spOrderAndFactor( Matrix->SPmatrix, NULL,
|
||||
(spREAL)PivRel, (spREAL)PivTol, YES );
|
||||
}
|
||||
|
||||
|
|
@ -193,9 +192,9 @@ SMPcReorder(SMPmatrix *Matrix, double PivTol, double PivRel,
|
|||
int
|
||||
SMPreorder(SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin)
|
||||
{
|
||||
spSetReal( Matrix );
|
||||
spSetReal( Matrix->SPmatrix );
|
||||
LoadGmin( Matrix, Gmin );
|
||||
return spOrderAndFactor( Matrix, NULL,
|
||||
return spOrderAndFactor( Matrix->SPmatrix, NULL,
|
||||
(spREAL)PivRel, (spREAL)PivTol, YES );
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +208,7 @@ SMPcaSolve(SMPmatrix *Matrix, double RHS[], double iRHS[],
|
|||
NG_IGNORE(iSpare);
|
||||
NG_IGNORE(Spare);
|
||||
|
||||
spSolveTransposed( Matrix, RHS, RHS, iRHS, iRHS );
|
||||
spSolveTransposed( Matrix->SPmatrix, RHS, RHS, iRHS, iRHS );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -222,7 +221,7 @@ SMPcSolve(SMPmatrix *Matrix, double RHS[], double iRHS[],
|
|||
NG_IGNORE(iSpare);
|
||||
NG_IGNORE(Spare);
|
||||
|
||||
spSolve( Matrix, RHS, RHS, iRHS, iRHS );
|
||||
spSolve( Matrix->SPmatrix, RHS, RHS, iRHS, iRHS );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -233,7 +232,7 @@ SMPsolve(SMPmatrix *Matrix, double RHS[], double Spare[])
|
|||
{
|
||||
NG_IGNORE(Spare);
|
||||
|
||||
spSolve( Matrix, RHS, RHS, NULL, NULL );
|
||||
spSolve( Matrix->SPmatrix, RHS, RHS, NULL, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -242,17 +241,17 @@ SMPsolve(SMPmatrix *Matrix, double RHS[], double Spare[])
|
|||
int
|
||||
SMPmatSize(SMPmatrix *Matrix)
|
||||
{
|
||||
return spGetSize( Matrix, 1 );
|
||||
return spGetSize( Matrix->SPmatrix, 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* SMPnewMatrix()
|
||||
*/
|
||||
int
|
||||
SMPnewMatrix(SMPmatrix **pMatrix)
|
||||
SMPnewMatrix(SMPmatrix *Matrix)
|
||||
{
|
||||
int Error;
|
||||
*pMatrix = spCreate( 0, 1, &Error );
|
||||
Matrix->SPmatrix = spCreate( 0, 1, &Error );
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +261,7 @@ SMPnewMatrix(SMPmatrix **pMatrix)
|
|||
void
|
||||
SMPdestroy(SMPmatrix *Matrix)
|
||||
{
|
||||
spDestroy( Matrix );
|
||||
spDestroy( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -271,8 +270,8 @@ SMPdestroy(SMPmatrix *Matrix)
|
|||
int
|
||||
SMPpreOrder(SMPmatrix *Matrix)
|
||||
{
|
||||
spMNA_Preorder( Matrix );
|
||||
return spError( Matrix );
|
||||
spMNA_Preorder( Matrix->SPmatrix );
|
||||
return spError( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -282,7 +281,7 @@ SMPpreOrder(SMPmatrix *Matrix)
|
|||
void
|
||||
SMPprintRHS(SMPmatrix *Matrix, char *Filename, RealVector RHS, RealVector iRHS)
|
||||
{
|
||||
spFileVector( Matrix, Filename, RHS, iRHS );
|
||||
spFileVector( Matrix->SPmatrix, Filename, RHS, iRHS );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -293,9 +292,9 @@ void
|
|||
SMPprint(SMPmatrix *Matrix, char *Filename)
|
||||
{
|
||||
if (Filename)
|
||||
spFileMatrix(Matrix, Filename, "Circuit Matrix", 0, 1, 1 );
|
||||
spFileMatrix(Matrix->SPmatrix, Filename, "Circuit Matrix", 0, 1, 1 );
|
||||
else
|
||||
spPrint( Matrix, 0, 1, 1 );
|
||||
spPrint( Matrix->SPmatrix, 0, 1, 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -304,7 +303,7 @@ SMPprint(SMPmatrix *Matrix, char *Filename)
|
|||
void
|
||||
SMPgetError(SMPmatrix *Matrix, int *Col, int *Row)
|
||||
{
|
||||
spWhereSingular( Matrix, Row, Col );
|
||||
spWhereSingular( Matrix->SPmatrix, Row, Col );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -314,9 +313,9 @@ SMPgetError(SMPmatrix *Matrix, int *Col, int *Row)
|
|||
int
|
||||
SMPcProdDiag(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
|
||||
{
|
||||
spDeterminant( Matrix, pExponent, &(pMantissa->real),
|
||||
spDeterminant ( Matrix->SPmatrix, pExponent, &(pMantissa->real),
|
||||
&(pMantissa->imag) );
|
||||
return spError( Matrix );
|
||||
return spError( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -328,7 +327,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
|
|||
double re, im, x, y, z;
|
||||
int p;
|
||||
|
||||
spDeterminant( Matrix, &p, &re, &im);
|
||||
spDeterminant( Matrix->SPmatrix, &p, &re, &im);
|
||||
|
||||
#ifndef M_LN2
|
||||
#define M_LN2 0.69314718055994530942
|
||||
|
|
@ -398,7 +397,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
|
|||
printf("Determinant 10->2: (%20g,%20g)^%d\n", pMantissa->real,
|
||||
pMantissa->imag, *pExponent);
|
||||
#endif
|
||||
return spError( Matrix );
|
||||
return spError( Matrix->SPmatrix );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -422,7 +421,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
|
|||
static void
|
||||
LoadGmin(SMPmatrix *eMatrix, double Gmin)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix;
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix;
|
||||
int I;
|
||||
ArrayOfElementPtrs Diag;
|
||||
ElementPtr diag;
|
||||
|
|
@ -455,7 +454,7 @@ LoadGmin(SMPmatrix *eMatrix, double Gmin)
|
|||
SMPelement *
|
||||
SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix;
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix;
|
||||
ElementPtr Element;
|
||||
|
||||
/* Begin `SMPfindElt'. */
|
||||
|
|
@ -475,7 +474,7 @@ SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing)
|
|||
int
|
||||
SMPcZeroCol(SMPmatrix *eMatrix, int Col)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix;
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix;
|
||||
ElementPtr Element;
|
||||
|
||||
Col = Matrix->ExtToIntColMap[Col];
|
||||
|
|
@ -497,7 +496,7 @@ SMPcZeroCol(SMPmatrix *eMatrix, int Col)
|
|||
int
|
||||
SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix;
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix;
|
||||
ElementPtr Accum, Addend, *Prev;
|
||||
|
||||
Accum_Col = Matrix->ExtToIntColMap[Accum_Col];
|
||||
|
|
@ -529,7 +528,7 @@ SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col)
|
|||
int
|
||||
SMPzeroRow(SMPmatrix *eMatrix, int Row)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix;
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix;
|
||||
ElementPtr Element;
|
||||
|
||||
Row = Matrix->ExtToIntColMap[Row];
|
||||
|
|
|
|||
|
|
@ -242,6 +242,29 @@ ACan(CKTcircuit *ckt, int restart)
|
|||
|
||||
ckt->CKTcurrentAnalysis = DOING_AC;
|
||||
|
||||
#ifdef KLU
|
||||
if (ckt->CKTmatrix->CKTkluMODE) {
|
||||
int i, m;
|
||||
double *temp;
|
||||
temp = TMALLOC (double, 2 * ckt->CKTmatrix->CKTklunz) ;
|
||||
ckt->CKTmatrix->CKTkluBind_KLU_Complex = TMALLOC (double *, ckt->CKTmatrix->CKTklunz) ;
|
||||
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * ckt->CKTmatrix->CKTkluN) ;
|
||||
m = 0;
|
||||
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++) {
|
||||
ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] = &(temp [m]) ;
|
||||
m += 2;
|
||||
}
|
||||
|
||||
DEVices[13]->DEVbindkluComplex (ckt->CKThead[13], ckt) ;
|
||||
DEVices[17]->DEVbindkluComplex (ckt->CKThead[17], ckt) ;
|
||||
DEVices[40]->DEVbindkluComplex (ckt->CKThead[40], ckt) ;
|
||||
DEVices[48]->DEVbindkluComplex (ckt->CKThead[48], ckt) ;
|
||||
|
||||
free (ckt->CKTmatrix->CKTkluAx) ;
|
||||
ckt->CKTmatrix->CKTkluAx = temp ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* main loop through all scheduled frequencies */
|
||||
while (freq <= job->ACstopFreq + freqTol) {
|
||||
if(SPfrontEnd->IFpauseTest()) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "ngspice/cktdefs.h"
|
||||
#include "ngspice/spmatrix.h"
|
||||
|
||||
#ifdef KLU
|
||||
#include "ngspice/klu.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
|
|
@ -32,22 +35,36 @@ CKTacct(CKTcircuit *ckt, JOB *anal, int which, IFvalue *val)
|
|||
val->iValue = ckt->CKTmaxEqNum;
|
||||
break;
|
||||
case OPT_ORIGNZ:
|
||||
if ( ckt->CKTmatrix != NULL ) {
|
||||
val->iValue = spOriginalCount(ckt->CKTmatrix);
|
||||
if ( ckt->CKTmatrix->SPmatrix != NULL ) {
|
||||
val->iValue = spOriginalCount(ckt->CKTmatrix->SPmatrix);
|
||||
} else {
|
||||
val->iValue = 0;
|
||||
}
|
||||
break;
|
||||
case OPT_FILLNZ:
|
||||
if ( ckt->CKTmatrix != NULL ) {
|
||||
val->iValue = spFillinCount(ckt->CKTmatrix);
|
||||
if ( ckt->CKTmatrix->SPmatrix != NULL ) {
|
||||
#ifdef KLU
|
||||
if (ckt->CKTmatrix->CKTkluMODE)
|
||||
val->iValue = ckt->CKTmatrix->CKTkluNumeric->lnz + ckt->CKTmatrix->CKTkluNumeric->unz - ckt->CKTmatrix->CKTklunz;
|
||||
else
|
||||
val->iValue = spFillinCount(ckt->CKTmatrix->SPmatrix);
|
||||
#else
|
||||
val->iValue = spFillinCount(ckt->CKTmatrix->SPmatrix);
|
||||
#endif
|
||||
} else {
|
||||
val->iValue = 0;
|
||||
}
|
||||
break;
|
||||
case OPT_TOTALNZ:
|
||||
if ( ckt->CKTmatrix != NULL ) {
|
||||
val->iValue = spElementCount(ckt->CKTmatrix);
|
||||
if ( ckt->CKTmatrix->SPmatrix != NULL ) {
|
||||
#ifdef KLU
|
||||
if (ckt->CKTmatrix->CKTkluMODE)
|
||||
val->iValue = ckt->CKTmatrix->CKTkluNumeric->lnz + ckt->CKTmatrix->CKTkluNumeric->unz;
|
||||
else
|
||||
val->iValue = spElementCount(ckt->CKTmatrix->SPmatrix);
|
||||
#else
|
||||
val->iValue = spElementCount(ckt->CKTmatrix->SPmatrix);
|
||||
#endif
|
||||
} else {
|
||||
val->iValue = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ CKTdestroy(CKTcircuit *ckt)
|
|||
for(i=0;i<=ckt->CKTmaxOrder+1;i++){
|
||||
FREE(ckt->CKTstates[i]);
|
||||
}
|
||||
if(ckt->CKTmatrix) {
|
||||
if(ckt->CKTmatrix->SPmatrix) {
|
||||
SMPdestroy(ckt->CKTmatrix);
|
||||
ckt->CKTmatrix = NULL;
|
||||
ckt->CKTmatrix->SPmatrix = NULL;
|
||||
}
|
||||
FREE(ckt->CKTbreaks);
|
||||
for(node = ckt->CKTnodes; node; ) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,31 @@ CKTop (CKTcircuit * ckt, long int firstmode, long int continuemode,
|
|||
#endif
|
||||
ckt->CKTmode = firstmode;
|
||||
|
||||
#ifdef KLU
|
||||
if (ckt->CKTmatrix->CKTkluMODE) {
|
||||
|
||||
int n = ckt->CKTmatrix->CKTkluN ;
|
||||
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->CKTkluBind_Sparse = TMALLOC (double *, nz) ;
|
||||
ckt->CKTmatrix->CKTkluBind_KLU = TMALLOC (double *, nz) ;
|
||||
|
||||
ckt->CKTmatrix->CKTkluDiag = TMALLOC (double *, n) ;
|
||||
|
||||
SMPmatrix_CSC (ckt->CKTmatrix) ;
|
||||
|
||||
DEVices[13]->DEVbindklu (ckt->CKThead[13], ckt);
|
||||
DEVices[17]->DEVbindklu (ckt->CKThead[17], ckt);
|
||||
DEVices[40]->DEVbindklu (ckt->CKThead[40], ckt);
|
||||
DEVices[48]->DEVbindklu (ckt->CKThead[48], ckt);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ckt->CKTnoOpIter){
|
||||
#ifdef XSPICE
|
||||
/* gtri - begin - wbk - add convergence problem reporting flags */
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static double inc_freq(double freq, int type, double step_size);
|
|||
* For each element/parameter in the test list:
|
||||
* construct the perturbation matrix
|
||||
* Solve for the sensitivities:
|
||||
* delta_E = Y^-1 (delta_Y E - delta_I)
|
||||
* delta_E = Y^-1 (delta_Y->SPmatrix E - delta_I)
|
||||
* save results
|
||||
*/
|
||||
|
||||
|
|
@ -71,7 +71,8 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
static double freq;
|
||||
static int nfreqs;
|
||||
static int i;
|
||||
static SMPmatrix *delta_Y = NULL, *Y;
|
||||
static SMPmatrix *delta_Y = NULL;
|
||||
static MatrixFrame *Y;
|
||||
static double step_size;
|
||||
double *E, *iE;
|
||||
IFvalue value, nvalue;
|
||||
|
|
@ -89,7 +90,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
int type;
|
||||
double *saved_rhs = 0,
|
||||
*saved_irhs = 0;
|
||||
SMPmatrix *saved_matrix = 0;
|
||||
MatrixFrame *saved_matrix = 0;
|
||||
|
||||
#ifndef notdef
|
||||
#ifdef notdef
|
||||
|
|
@ -139,10 +140,10 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
size = spGetSize(ckt->CKTmatrix, 1);
|
||||
size = spGetSize (ckt->CKTmatrix->SPmatrix, 1) ;
|
||||
|
||||
/* Create the perturbation matrix */
|
||||
delta_Y = spCreate(size, 1, &error);
|
||||
delta_Y->SPmatrix = spCreate(size, 1, &error);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -236,12 +237,12 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
bypass = ckt->CKTbypass;
|
||||
ckt->CKTbypass = 0;
|
||||
|
||||
/* CKTop solves into CKTrhs and CKTmatrix,
|
||||
/* CKTop solves into CKTrhs and CKTmatrix->SPmatrix,
|
||||
* CKTirhs is hopefully zero (fresh allocated ?) */
|
||||
|
||||
E = ckt->CKTrhs;
|
||||
iE = ckt->CKTirhs;
|
||||
Y = ckt->CKTmatrix;
|
||||
Y = ckt->CKTmatrix->SPmatrix;
|
||||
|
||||
#ifdef ASDEBUG
|
||||
DEBUG(1) {
|
||||
|
|
@ -284,7 +285,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
/* XXX ckt->CKTmatrix = Y; */
|
||||
/* XXX ckt->CKTmatrix->SPmatrix = Y; */
|
||||
|
||||
error = CKTsetup(ckt);
|
||||
if (error)
|
||||
|
|
@ -313,17 +314,17 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* NIacIter solves into CKTrhsOld, CKTirhsOld and CKTmatrix */
|
||||
/* NIacIter solves into CKTrhsOld, CKTirhsOld and CKTmatrix->SPmatrix */
|
||||
E = ckt->CKTrhsOld;
|
||||
iE = ckt->CKTirhsOld;
|
||||
Y = ckt->CKTmatrix;
|
||||
Y = ckt->CKTmatrix->SPmatrix;
|
||||
}
|
||||
|
||||
/* Use a different vector & matrix */
|
||||
|
||||
save_context(ckt->CKTrhs, saved_rhs);
|
||||
save_context(ckt->CKTirhs, saved_irhs);
|
||||
save_context(ckt->CKTmatrix, saved_matrix);
|
||||
save_context(ckt->CKTmatrix->SPmatrix, saved_matrix);
|
||||
|
||||
ckt->CKTrhs = delta_I;
|
||||
ckt->CKTirhs = delta_iI;
|
||||
|
|
@ -356,7 +357,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
}
|
||||
#endif
|
||||
|
||||
spClear(delta_Y);
|
||||
spClear(delta_Y->SPmatrix);
|
||||
|
||||
for (j = 0; j < size; j++) {
|
||||
delta_I[j] = 0.0;
|
||||
|
|
@ -399,7 +400,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
#ifdef ASDEBUG
|
||||
DEBUG(2) {
|
||||
printf("Effect of device:\n");
|
||||
spPrint(delta_Y, 0, 1, 1);
|
||||
spPrint(delta_Y->SPmatrix, 0, 1, 1);
|
||||
printf("LHS:\n");
|
||||
for (j = 0; j < size; j++)
|
||||
printf("%d: %g, %g\n", j,
|
||||
|
|
@ -423,7 +424,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
if (error && error != E_BADPARM)
|
||||
return error;
|
||||
|
||||
spConstMult(delta_Y, -1.0);
|
||||
spConstMult(delta_Y->SPmatrix, -1.0);
|
||||
for (j = 0; j < size; j++) {
|
||||
delta_I[j] *= -1.0;
|
||||
delta_iI[j] *= -1.0;
|
||||
|
|
@ -432,7 +433,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
#ifdef ASDEBUG
|
||||
DEBUG(2) {
|
||||
printf("Effect of negating matrix:\n");
|
||||
spPrint(delta_Y, 0, 1, 1);
|
||||
spPrint(delta_Y->SPmatrix, 0, 1, 1);
|
||||
for (j = 0; j < size; j++)
|
||||
printf("%d: %g, %g\n", j,
|
||||
delta_I[j], delta_iI[j]);
|
||||
|
|
@ -458,7 +459,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
#ifdef ASDEBUG
|
||||
DEBUG(2) {
|
||||
printf("Effect of changing the parameter:\n");
|
||||
spPrint(delta_Y, 0, 1, 1);
|
||||
spPrint(delta_Y->SPmatrix, 0, 1, 1);
|
||||
for (j = 0; j < size; j++)
|
||||
printf("%d: %g, %g\n", j,
|
||||
delta_I[j], delta_iI[j]);
|
||||
|
|
@ -482,17 +483,17 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
#endif
|
||||
|
||||
/* delta_Y E */
|
||||
spMultiply(delta_Y, delta_I_delta_Y, E,
|
||||
spMultiply(delta_Y->SPmatrix, delta_I_delta_Y, E,
|
||||
delta_iI_delta_Y, iE);
|
||||
|
||||
#ifdef ASDEBUG
|
||||
DEBUG(2)
|
||||
for (j = 0; j < size; j++)
|
||||
printf("delta_Y * E [%d] = %20.15g\n",
|
||||
printf("delta_Y->SPmatrix * E [%d] = %20.15g\n",
|
||||
j, delta_I_delta_Y[j]);
|
||||
#endif
|
||||
|
||||
/* delta_I - delta_Y E */
|
||||
/* delta_I - delta_Y->SPmatrix E */
|
||||
for (j = 0; j < size; j++) {
|
||||
delta_I[j] -= delta_I_delta_Y[j];
|
||||
delta_iI[j] -= delta_iI_delta_Y[j];
|
||||
|
|
@ -577,7 +578,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
|
||||
release_context(ckt->CKTrhs, saved_rhs);
|
||||
release_context(ckt->CKTirhs, saved_irhs);
|
||||
release_context(ckt->CKTmatrix, saved_matrix);
|
||||
release_context(ckt->CKTmatrix->SPmatrix, saved_matrix);
|
||||
|
||||
if (is_dc)
|
||||
nvalue.v.vec.rVec = output_values;
|
||||
|
|
@ -602,9 +603,9 @@ int sens_sens(CKTcircuit *ckt, int restart)
|
|||
|
||||
release_context(ckt->CKTrhs, saved_rhs);
|
||||
release_context(ckt->CKTirhs, saved_irhs);
|
||||
release_context(ckt->CKTmatrix, saved_matrix);
|
||||
release_context(ckt->CKTmatrix->SPmatrix, saved_matrix);
|
||||
|
||||
spDestroy(delta_Y);
|
||||
spDestroy(delta_Y->SPmatrix);
|
||||
FREE(delta_I);
|
||||
FREE(delta_iI);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ CKTsetup(CKTcircuit *ckt)
|
|||
if(error) return(error);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KLU
|
||||
if (ckt->CKTmatrix->CKTkluMODE)
|
||||
SMPnnz (ckt->CKTmatrix) ;
|
||||
#endif
|
||||
|
||||
for(i=0;i<=MAX(2,ckt->CKTmaxOrder)+1;i++) { /* dctran needs 3 states as minimum */
|
||||
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double);
|
||||
}
|
||||
|
|
@ -161,7 +167,7 @@ CKTunsetup(CKTcircuit *ckt)
|
|||
|
||||
NIdestroy(ckt);
|
||||
/*
|
||||
if (ckt->CKTmatrix)
|
||||
if (ckt->CKTmatrix->SPmatrix)
|
||||
SMPdestroy(ckt->CKTmatrix);
|
||||
ckt->CKTmatrix = NULL;
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ libbsim4v6_la_SOURCES = \
|
|||
bsim4v6init.h \
|
||||
bsim4v6itf.h
|
||||
|
||||
if KLU_WANTED
|
||||
libbsim4v6_la_SOURCES += b4v6bindklu.c
|
||||
endif
|
||||
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -28,3 +28,8 @@ extern int BSIM4v6temp(GENmodel*,CKTcircuit*);
|
|||
extern int BSIM4v6trunc(GENmodel*,CKTcircuit*,double*);
|
||||
extern int BSIM4v6noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
|
||||
extern int BSIM4v6unsetup(GENmodel*,CKTcircuit*);
|
||||
|
||||
#ifdef KLU
|
||||
extern int BSIM4v6bindklu(GENmodel*,CKTcircuit*);
|
||||
extern int BSIM4v6bindkluComplex(GENmodel*,CKTcircuit*);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -72,7 +72,12 @@ SPICEdev BSIM4v6info = {
|
|||
NULL, /* DEVacct */
|
||||
#endif
|
||||
&BSIM4v6iSize, /* DEVinstSize */
|
||||
&BSIM4v6mSize /* DEVmodSize */
|
||||
&BSIM4v6mSize, /* DEVmodSize */
|
||||
#ifdef KLU
|
||||
BSIM4v6bindklu, /* DEVbindklu */
|
||||
BSIM4v6bindkluComplex, /* DEVbindkluComplex */
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ libcap_la_SOURCES = \
|
|||
captemp.c \
|
||||
captrunc.c
|
||||
|
||||
if KLU_WANTED
|
||||
libcap_la_SOURCES += capbindklu.c
|
||||
endif
|
||||
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
|
|
@ -23,26 +23,26 @@ CAPbindklu(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->CAPposNode != 0) && (here->CAPposNode != 0)) {
|
||||
while (here->CAPposPosptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPposPosptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->CAPposPosptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPposPosptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPnegNode != 0) && (here->CAPnegNode != 0)) {
|
||||
while (here->CAPnegNegptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPnegNegptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->CAPnegNegptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPnegNegptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPposNode != 0) && (here->CAPnegNode != 0)) {
|
||||
while (here->CAPposNegptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPposNegptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->CAPposNegptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPposNegptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPnegNode != 0) && (here->CAPposNode != 0)) {
|
||||
while (here->CAPnegPosptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPnegPosptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->CAPnegPosptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->CAPnegPosptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,26 +65,26 @@ CAPbindkluComplex(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->CAPposNode != 0) && (here->CAPposNode != 0)) {
|
||||
while (here->CAPposPosptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPposPosptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->CAPposPosptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPposPosptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPnegNode != 0) && (here->CAPnegNode != 0)) {
|
||||
while (here->CAPnegNegptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPnegNegptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->CAPnegNegptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPnegNegptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPposNode != 0) && (here->CAPnegNode != 0)) {
|
||||
while (here->CAPposNegptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPposNegptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->CAPposNegptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPposNegptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->CAPnegNode != 0) && (here->CAPposNode != 0)) {
|
||||
while (here->CAPnegPosptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPnegPosptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->CAPnegPosptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->CAPnegPosptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,3 +23,7 @@ extern int CAPsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
|
|||
extern int CAPtemp(GENmodel*,CKTcircuit*);
|
||||
extern int CAPtrunc(GENmodel*,CKTcircuit*,double*);
|
||||
|
||||
#ifdef KLU
|
||||
extern int CAPbindklu(GENmodel*,CKTcircuit*);
|
||||
extern int CAPbindkluComplex(GENmodel*,CKTcircuit*);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -71,7 +71,12 @@ SPICEdev CAPinfo = {
|
|||
/* DEVacct */ NULL,
|
||||
#endif
|
||||
/* DEVinstSize */ &CAPiSize,
|
||||
/* DEVmodSize */ &CAPmSize
|
||||
/* DEVmodSize */ &CAPmSize,
|
||||
#ifdef KLU
|
||||
/* DEVbindklu */ CAPbindklu,
|
||||
/* DEVbindkluComplex */ CAPbindkluComplex,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ libres_la_SOURCES = \
|
|||
ressset.c \
|
||||
restemp.c
|
||||
|
||||
if KLU_WANTED
|
||||
libres_la_SOURCES += resbindklu.c
|
||||
endif
|
||||
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
|
|
@ -23,26 +23,26 @@ RESbindklu(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->RESposNode != 0) && (here->RESposNode != 0)) {
|
||||
while (here->RESposPosptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESposPosptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->RESposPosptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESposPosptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESnegNode != 0) && (here->RESnegNode != 0)) {
|
||||
while (here->RESnegNegptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESnegNegptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->RESnegNegptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESnegNegptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESposNode != 0) && (here->RESnegNode != 0)) {
|
||||
while (here->RESposNegptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESposNegptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->RESposNegptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESposNegptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESnegNode != 0) && (here->RESposNode != 0)) {
|
||||
while (here->RESnegPosptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESnegPosptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->RESnegPosptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->RESnegPosptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,26 +65,26 @@ RESbindkluComplex(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->RESposNode != 0) && (here->RESposNode != 0)) {
|
||||
while (here->RESposPosptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESposPosptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->RESposPosptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESposPosptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESnegNode != 0) && (here->RESnegNode != 0)) {
|
||||
while (here->RESnegNegptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESnegNegptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->RESnegNegptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESnegNegptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESposNode != 0) && (here->RESnegNode != 0)) {
|
||||
while (here->RESposNegptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESposNegptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->RESposNegptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESposNegptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->RESnegNode != 0) && (here->RESposNode != 0)) {
|
||||
while (here->RESnegPosptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESnegPosptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->RESnegPosptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->RESnegPosptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,3 +20,8 @@ extern void RESsPrint(GENmodel*,CKTcircuit*);
|
|||
extern int RESsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
|
||||
extern int REStemp(GENmodel*,CKTcircuit*);
|
||||
extern int RESnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
|
||||
|
||||
#ifdef KLU
|
||||
extern int RESbindklu(GENmodel*,CKTcircuit*);
|
||||
extern int RESbindkluComplex(GENmodel*,CKTcircuit*);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ SPICEdev RESinfo = {
|
|||
/* DEVacct */ NULL,
|
||||
#endif
|
||||
/* DEVinstSize */ &RESiSize,
|
||||
/* DEVmodSize */ &RESmSize
|
||||
/* DEVmodSize */ &RESmSize,
|
||||
#ifdef KLU
|
||||
/* DEVbindklu */ RESbindklu,
|
||||
/* DEVbindkluComplex */ RESbindkluComplex,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ libvsrc_la_SOURCES = \
|
|||
vsrcset.c \
|
||||
vsrctemp.c
|
||||
|
||||
if KLU_WANTED
|
||||
libvsrc_la_SOURCES += vsrcbindklu.c
|
||||
endif
|
||||
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include
|
||||
|
|
|
|||
|
|
@ -23,26 +23,26 @@ VSRCbindklu(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->VSRCposNode != 0) && (here->VSRCbranch != 0)) {
|
||||
while (here->VSRCposIbrptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCposIbrptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->VSRCposIbrptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCposIbrptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCnegNode != 0) && (here->VSRCbranch != 0)) {
|
||||
while (here->VSRCnegIbrptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCnegIbrptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->VSRCnegIbrptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCnegIbrptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCbranch != 0) && (here->VSRCnegNode != 0)) {
|
||||
while (here->VSRCibrNegptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCibrNegptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->VSRCibrNegptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCibrNegptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCbranch != 0) && (here->VSRCposNode != 0)) {
|
||||
while (here->VSRCibrPosptr != ckt->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCibrPosptr = ckt->CKTkluBind_KLU [i] ;
|
||||
while (here->VSRCibrPosptr != ckt->CKTmatrix->CKTkluBind_Sparse [i]) i ++ ;
|
||||
here->VSRCibrPosptr = ckt->CKTmatrix->CKTkluBind_KLU [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,26 +65,26 @@ VSRCbindkluComplex(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
i = 0 ;
|
||||
if ((here->VSRCposNode != 0) && (here->VSRCbranch != 0)) {
|
||||
while (here->VSRCposIbrptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCposIbrptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->VSRCposIbrptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCposIbrptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCnegNode != 0) && (here->VSRCbranch != 0)) {
|
||||
while (here->VSRCnegIbrptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCnegIbrptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->VSRCnegIbrptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCnegIbrptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCbranch != 0) && (here->VSRCnegNode != 0)) {
|
||||
while (here->VSRCibrNegptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCibrNegptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->VSRCibrNegptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCibrNegptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
|
||||
i = 0 ;
|
||||
if ((here->VSRCbranch != 0) && (here->VSRCposNode != 0)) {
|
||||
while (here->VSRCibrPosptr != ckt->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCibrPosptr = ckt->CKTkluBind_KLU_Complex [i] ;
|
||||
while (here->VSRCibrPosptr != ckt->CKTmatrix->CKTkluBind_KLU [i]) i ++ ;
|
||||
here->VSRCibrPosptr = ckt->CKTmatrix->CKTkluBind_KLU_Complex [i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,3 +18,8 @@ extern int VSRCsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
|
|||
extern int VSRCunsetup(GENmodel*,CKTcircuit*);
|
||||
extern int VSRCpzSetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
|
||||
extern int VSRCtemp(GENmodel*,CKTcircuit*);
|
||||
|
||||
#ifdef KLU
|
||||
extern int VSRCbindklu(GENmodel*,CKTcircuit*);
|
||||
extern int VSRCbindkluComplex(GENmodel*,CKTcircuit*);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -72,7 +72,12 @@ SPICEdev VSRCinfo = {
|
|||
/* DEVacct */ NULL,
|
||||
#endif
|
||||
/* DEVinstSize */ &VSRCiSize,
|
||||
/* DEVmodSize */ &VSRCmSize
|
||||
/* DEVmodSize */ &VSRCmSize,
|
||||
#ifdef KLU
|
||||
/* DEVbindklu */ VSRCbindklu,
|
||||
/* DEVbindkluComplex */ VSRCbindkluComplex,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue