diff --git a/ChangeLog b/ChangeLog index f67652b92..f25d46d72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2010-07-23 Robert Larice + * src/ngmultidec.c , + * src/include/onedev.h , + * src/include/smpdefs.h , + * src/include/spmatrix.h , + * src/include/twodev.h , + * src/maths/sparse/spalloc.c , + * src/maths/sparse/spbuild.c , + * src/maths/sparse/spdefs.h , + * src/maths/sparse/spfactor.c , + * src/maths/sparse/spoutput.c , + * src/maths/sparse/spsmp.c , + * src/maths/sparse/spsolve.c , + * src/maths/sparse/sputils.c , + * src/spicelib/analysis/cktacct.c : + use the types MatrixPtr and SMPmatrix instead of void and char * + both are the same thing, + MatrixPtr is used inside the sparse/* domain, + SMPmatrix is used in the rest of spice + remove casts, which are no longer necessary + 2010-07-23 Robert Larice * src/include/spmatrix.h , * src/maths/sparse/spbuild.c , diff --git a/src/include/onedev.h b/src/include/onedev.h index 49958542d..a6e21787a 100644 --- a/src/include/onedev.h +++ b/src/include/onedev.h @@ -23,7 +23,7 @@ typedef struct sONEdevice double *copiedSolution; /* copy of the solution vector */ double *rhs; /* rhs vector */ double *rhsImag; /* imaginary part of rhs vector */ - char *matrix; /* matrix for device equations */ + SMPmatrix *matrix; /* matrix for device equations */ int solverType; /* type of equations matrix can solve */ int dimEquil; /* dimension in equilibrium */ int numOrigEquil; /* orig number of nz's in equilibrium */ diff --git a/src/include/smpdefs.h b/src/include/smpdefs.h index 70cdafac2..a5cc1661f 100644 --- a/src/include/smpdefs.h +++ b/src/include/smpdefs.h @@ -1,7 +1,7 @@ #ifndef SMP #define SMP -typedef void SMPmatrix; +typedef struct MatrixFrame SMPmatrix; typedef struct MatrixElement *SMPelement; /********** diff --git a/src/include/spmatrix.h b/src/include/spmatrix.h index 3dbbb2a81..45b134fc8 100644 --- a/src/include/spmatrix.h +++ b/src/include/spmatrix.h @@ -241,7 +241,7 @@ struct spTemplate }; - +typedef struct MatrixFrame *MatrixPtr; /* @@ -252,48 +252,48 @@ struct spTemplate /* Begin function declarations. */ -extern void spClear( void * ); -extern spREAL spCondition( void *, spREAL, int* ); -extern void *spCreate( int, int, int* ); -extern void spDeleteRowAndCol( void *, int, int ); -extern void spDestroy(void *); -extern int spElementCount( void * ); -extern int spError( void * ); -extern int spFactor( void * ); -extern int spFileMatrix( void *, char *, char *, int, int, int ); -extern int spFileStats( void *, char *, char * ); -extern int spFillinCount( void * ); -extern int spGetAdmittance( void *, int, int, struct spTemplate* ); -extern spREAL *spFindElement( void *eMatrix, int Row, int Col ); -extern spREAL *spGetElement( void *, int, int ); +extern void spClear( MatrixPtr ); +extern spREAL spCondition( MatrixPtr, spREAL, int* ); +extern MatrixPtr spCreate( int, int, int* ); +extern void spDeleteRowAndCol( MatrixPtr, int, int ); +extern void spDestroy( MatrixPtr); +extern int spElementCount( MatrixPtr ); +extern int spError( MatrixPtr ); +extern int spFactor( MatrixPtr ); +extern int spFileMatrix( MatrixPtr, char *, char *, int, int, int ); +extern int spFileStats( MatrixPtr, char *, char * ); +extern int spFillinCount( MatrixPtr ); +extern int spGetAdmittance( MatrixPtr, int, int, struct spTemplate* ); +extern spREAL *spFindElement(MatrixPtr eMatrix, int Row, int Col ); +extern spREAL *spGetElement(MatrixPtr, int, int ); extern void *spGetInitInfo( spREAL* ); -extern int spGetOnes( void *, int, int, int, struct spTemplate* ); -extern int spGetQuad( void *, int, int, int, int, struct spTemplate* ); -extern int spGetSize( void *, int ); -extern int spInitialize( void *, int (*pInit)(spREAL*, void *InitInfo, int, int Col)); +extern int spGetOnes( MatrixPtr, int, int, int, struct spTemplate* ); +extern int spGetQuad( MatrixPtr, int, int, int, int, struct spTemplate* ); +extern int spGetSize( MatrixPtr, int ); +extern int spInitialize(MatrixPtr, int (*pInit)(spREAL*, void *InitInfo, int, int Col)); extern void spInstallInitInfo( spREAL*, void * ); -extern spREAL spLargestElement( void * ); -extern void spMNA_Preorder( void * ); -extern spREAL spNorm( void * ); -extern int spOrderAndFactor( void *, spREAL*, spREAL, spREAL, int ); -extern int spOriginalCount( void *); -extern void spPartition( void *, int ); -extern void spPrint( void *, int, int, int ); -extern spREAL spPseudoCondition( void * ); -extern spREAL spRoundoff( void *, spREAL ); -extern void spScale( void *, spREAL*, spREAL* ); -extern void spSetComplex( void * ); -extern void spSetReal( void * ); -extern void spStripFills( void * ); -extern void spWhereSingular( void *, int*, int* ); +extern spREAL spLargestElement( MatrixPtr ); +extern void spMNA_Preorder( MatrixPtr ); +extern spREAL spNorm( MatrixPtr ); +extern int spOrderAndFactor(MatrixPtr, spREAL*, spREAL, spREAL, int ); +extern int spOriginalCount( MatrixPtr); +extern void spPartition( MatrixPtr, int ); +extern void spPrint(MatrixPtr, int, int, int ); +extern spREAL spPseudoCondition( MatrixPtr ); +extern spREAL spRoundoff( MatrixPtr, spREAL ); +extern void spScale( MatrixPtr, spREAL*, spREAL* ); +extern void spSetComplex( MatrixPtr ); +extern void spSetReal( MatrixPtr ); +extern void spStripFills( MatrixPtr ); +extern void spWhereSingular(MatrixPtr, int*, int* ); /* Functions with argument lists that are dependent on options. */ -extern void spDeterminant ( void *, int*, spREAL*, spREAL* ); -extern int spFileVector( void *, char * , spREAL*, spREAL*); -extern void spMultiply( void *, spREAL*, spREAL*, spREAL*, spREAL* ); -extern void spMultTransposed(void *,spREAL*,spREAL*,spREAL*,spREAL*); -extern void spSolve( void *, spREAL*, spREAL*, spREAL*, spREAL* ); -extern void spSolveTransposed(void *,spREAL*,spREAL*,spREAL*,spREAL*); +extern void spDeterminant ( MatrixPtr, int*, spREAL*, spREAL* ); +extern int spFileVector( MatrixPtr, char * , spREAL*, spREAL*); +extern void spMultiply( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* ); +extern void spMultTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*); +extern void spSolve( MatrixPtr, spREAL*, spREAL*, spREAL*, spREAL* ); +extern void spSolveTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*); #endif /* spOKAY */ diff --git a/src/include/twodev.h b/src/include/twodev.h index 9ec7a1bb6..a5a5b161b 100644 --- a/src/include/twodev.h +++ b/src/include/twodev.h @@ -23,7 +23,7 @@ typedef struct sTWOdevice double *copiedSolution; /* copy of the solution vector */ double *rhs; /* rhs vector */ double *rhsImag; /* imaginary part of rhs vector */ - char *matrix; /* matrix for device equations */ + SMPmatrix *matrix; /* matrix for device equations */ int solverType; /* what is matrix set up to do */ int dimEquil; /* dimension in equilibrium */ int numOrigEquil; /* orig number of nz's in equilibrium */ diff --git a/src/maths/sparse/spalloc.c b/src/maths/sparse/spalloc.c index 19cd0cd9d..5935eefed 100644 --- a/src/maths/sparse/spalloc.c +++ b/src/maths/sparse/spalloc.c @@ -118,7 +118,7 @@ static void AllocateBlockOfAllocationList( MatrixPtr ); * Error is cleared in this routine. */ -void * +MatrixPtr spCreate(int Size, int Complex, int *pError) { unsigned SizePlusOne; @@ -262,14 +262,14 @@ spCreate(int Size, int Complex, int *pError) if (Matrix->Error == spNO_MEMORY) goto MemoryError; - return (void *)Matrix; + return Matrix; MemoryError: /* Deallocate matrix and return no pointer to matrix if there is not enough memory. */ *pError = spNO_MEMORY; - spDestroy( (void *)Matrix); + spDestroy(Matrix); return NULL; } @@ -650,9 +650,9 @@ AllocateBlockOfAllocationList(MatrixPtr Matrix) */ void -spDestroy(void *eMatrix) +spDestroy(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; AllocationListPtr ListPtr, NextListPtr; @@ -708,13 +708,13 @@ spDestroy(void *eMatrix) * eMatrix (void *) * The matrix for which the error status is desired. */ int -spError(void *eMatrix ) +spError(MatrixPtr eMatrix ) { /* Begin `spError'. */ if (eMatrix != NULL) { - assert(((MatrixPtr)eMatrix)->ID == SPARSE_ID); - return ((MatrixPtr)eMatrix)->Error; + assert(eMatrix->ID == SPARSE_ID); + return eMatrix->Error; } else { /* This error may actually be spPANIC, no way to tell. */ return spNO_MEMORY; @@ -745,9 +745,9 @@ spError(void *eMatrix ) */ void -spWhereSingular(void *eMatrix, int *pRow, int *pCol) +spWhereSingular(MatrixPtr eMatrix, int *pRow, int *pCol) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; /* Begin `spWhereSingular'. */ assert( IS_SPARSE( Matrix ) ); @@ -783,9 +783,9 @@ spWhereSingular(void *eMatrix, int *pRow, int *pCol) */ int -spGetSize(void *eMatrix, int External) +spGetSize(MatrixPtr eMatrix, int External) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; /* Begin `spGetSize'. */ assert( IS_SPARSE( Matrix ) ); @@ -818,23 +818,23 @@ spGetSize(void *eMatrix, int External) */ void -spSetReal(void *eMatrix) +spSetReal(MatrixPtr eMatrix) { /* Begin `spSetReal'. */ - assert( IS_SPARSE( (MatrixPtr)eMatrix )); - ((MatrixPtr)eMatrix)->Complex = NO; + assert( IS_SPARSE( eMatrix )); + eMatrix->Complex = NO; return; } void -spSetComplex(void *eMatrix) +spSetComplex(MatrixPtr eMatrix) { /* Begin `spSetComplex'. */ - assert( IS_SPARSE( (MatrixPtr)eMatrix )); - ((MatrixPtr)eMatrix)->Complex = YES; + assert( IS_SPARSE( eMatrix )); + eMatrix->Complex = YES; return; } @@ -859,29 +859,29 @@ spSetComplex(void *eMatrix) */ int -spFillinCount(void *eMatrix) +spFillinCount(MatrixPtr eMatrix) { /* Begin `spFillinCount'. */ - assert( IS_SPARSE( (MatrixPtr)eMatrix ) ); - return ((MatrixPtr)eMatrix)->Fillins; + assert( IS_SPARSE( eMatrix ) ); + return eMatrix->Fillins; } int -spElementCount(void *eMatrix) +spElementCount(MatrixPtr eMatrix) { /* Begin `spElementCount'. */ - assert( IS_SPARSE( (MatrixPtr)eMatrix ) ); - return ((MatrixPtr)eMatrix)->Elements; + assert( IS_SPARSE( eMatrix ) ); + return eMatrix->Elements; } int -spOriginalCount(void *eMatrix) +spOriginalCount(MatrixPtr eMatrix) { /* Begin `spOriginalCount'. */ - assert( IS_SPARSE( (MatrixPtr)eMatrix ) ); - return ((MatrixPtr)eMatrix)->Originals; + assert( IS_SPARSE( eMatrix ) ); + return eMatrix->Originals; } diff --git a/src/maths/sparse/spbuild.c b/src/maths/sparse/spbuild.c index f7cbb4581..d96dada52 100644 --- a/src/maths/sparse/spbuild.c +++ b/src/maths/sparse/spbuild.c @@ -94,9 +94,9 @@ static void ExpandTranslationArrays( MatrixPtr, int ); */ void -spClear(void *eMatrix ) +spClear(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; int I; @@ -181,9 +181,9 @@ spClear(void *eMatrix ) */ RealNumber * -spFindElement( void *eMatrix, int Row, int Col ) +spFindElement(MatrixPtr eMatrix, int Row, int Col) { -MatrixPtr Matrix = (MatrixPtr)eMatrix; +MatrixPtr Matrix = eMatrix; RealNumber *pElement; /* Begin `spFindElement'. */ @@ -264,9 +264,9 @@ RealNumber *pElement; */ RealNumber * -spGetElement(void *eMatrix, int Row, int Col) +spGetElement(MatrixPtr eMatrix, int Row, int Col) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; RealNumber *pElement; /* Begin `spGetElement'. */ @@ -548,7 +548,7 @@ Translate(MatrixPtr Matrix, int *Row, int *Col) */ int -spGetAdmittance(void *Matrix, int Node1, int Node2, +spGetAdmittance(MatrixPtr Matrix, int Node1, int Node2, struct spTemplate *Template) { /* Begin `spGetAdmittance'. */ @@ -631,7 +631,7 @@ spGetAdmittance(void *Matrix, int Node1, int Node2, */ int -spGetQuad(void *Matrix, int Row1, int Row2, int Col1, int Col2, +spGetQuad(MatrixPtr Matrix, int Row1, int Row2, int Col1, int Col2, struct spTemplate *Template) { /* Begin `spGetQuad'. */ @@ -702,7 +702,7 @@ spGetQuad(void *Matrix, int Row1, int Row2, int Col1, int Col2, */ int -spGetOnes(void *Matrix, int Pos, int Neg, int Eqn, +spGetOnes(MatrixPtr Matrix, int Pos, int Neg, int Eqn, struct spTemplate *Template) { /* Begin `spGetOnes'. */ @@ -1146,9 +1146,9 @@ spGetInitInfo(RealNumber *pElement) int -spInitialize(void *eMatrix, int (*pInit)(RealNumber*, void *InitInfo, int , int Col)) +spInitialize(MatrixPtr eMatrix, int (*pInit)(RealNumber*, void *InitInfo, int , int Col)) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; int J, Error, Col; diff --git a/src/maths/sparse/spdefs.h b/src/maths/sparse/spdefs.h index b9d9e919c..567112066 100644 --- a/src/maths/sparse/spdefs.h +++ b/src/maths/sparse/spdefs.h @@ -786,9 +786,6 @@ struct MatrixFrame struct FillinListNodeStruct *FirstFillinListNode; struct FillinListNodeStruct *LastFillinListNode; }; -typedef struct MatrixFrame *MatrixPtr; - - /* diff --git a/src/maths/sparse/spfactor.c b/src/maths/sparse/spfactor.c index dc0bfa3bc..f04980439 100644 --- a/src/maths/sparse/spfactor.c +++ b/src/maths/sparse/spfactor.c @@ -189,10 +189,10 @@ static int ZeroPivot( MatrixPtr, int ); */ int -spOrderAndFactor(void *eMatrix, RealNumber RHS[], RealNumber RelThreshold, +spOrderAndFactor(MatrixPtr eMatrix, RealNumber RHS[], RealNumber RelThreshold, RealNumber AbsThreshold, int DiagPivoting) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pPivot; int Step, Size, ReorderingRequired; RealNumber LargestInCol; @@ -329,9 +329,9 @@ spOrderAndFactor(void *eMatrix, RealNumber RHS[], RealNumber RelThreshold, * Error is cleared in this function. */ int -spFactor(void *eMatrix) +spFactor(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; ElementPtr pColumn; int Step, Size; @@ -598,9 +598,9 @@ FactorComplexMatrix( MatrixPtr Matrix ) * spINDIRECT_PARTITION, or spAUTO_PARTITION. */ void -spPartition(void *eMatrix, int Mode) +spPartition(MatrixPtr eMatrix, int Mode) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement, pColumn; int Step, Size; int *Nc, *No, *Nm; diff --git a/src/maths/sparse/spoutput.c b/src/maths/sparse/spoutput.c index 098bd5cc7..8d81e4f2b 100644 --- a/src/maths/sparse/spoutput.c +++ b/src/maths/sparse/spoutput.c @@ -132,9 +132,9 @@ int Printer_Width = PRINTER_WIDTH; */ void -spPrint(void *eMatrix, int PrintReordered, int Data, int Header) +spPrint(MatrixPtr eMatrix, int PrintReordered, int Data, int Header) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int J = 0; int I, Row, Col, Size, Top; int StartCol = 1, StopCol, Columns, ElementCount = 0; @@ -435,10 +435,10 @@ spPrint(void *eMatrix, int PrintReordered, int Data, int Header) */ int -spFileMatrix(void *eMatrix, char *File, char *Label, int Reordered, +spFileMatrix(MatrixPtr eMatrix, char *File, char *Label, int Reordered, int Data, int Header) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I, Size; ElementPtr pElement; int Row, Col, Err; @@ -594,9 +594,9 @@ spFileMatrix(void *eMatrix, char *File, char *Label, int Reordered, */ int -spFileVector(void *eMatrix, char *File, RealVector RHS, RealVector iRHS) +spFileVector(MatrixPtr eMatrix, char *File, RealVector RHS, RealVector iRHS) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I, Size, Err; FILE *pMatrixFile; @@ -680,9 +680,9 @@ spFileVector(void *eMatrix, char *File, RealVector RHS, RealVector iRHS) */ int -spFileStats(void *eMatrix, char *File, char *Label) +spFileStats(MatrixPtr eMatrix, char *File, char *Label) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int Size, I; ElementPtr pElement; int NumberOfElements; diff --git a/src/maths/sparse/spsmp.c b/src/maths/sparse/spsmp.c index c6c3cf8cb..6b29da0d5 100644 --- a/src/maths/sparse/spsmp.c +++ b/src/maths/sparse/spsmp.c @@ -117,8 +117,8 @@ static void LoadGmin(SMPmatrix *eMatrix, double Gmin); int SMPaddElt(SMPmatrix *Matrix, int Row, int Col, double Value) { - *spGetElement( (void *)Matrix, Row, Col ) = Value; - return spError( (void *)Matrix ); + *spGetElement( Matrix, Row, Col ) = Value; + return spError( Matrix ); } /* @@ -127,7 +127,7 @@ SMPaddElt(SMPmatrix *Matrix, int Row, int Col, double Value) double * SMPmakeElt(SMPmatrix *Matrix, int Row, int Col) { - return spGetElement( (void *)Matrix, Row, Col ); + return spGetElement( Matrix, Row, Col ); } /* @@ -136,7 +136,7 @@ SMPmakeElt(SMPmatrix *Matrix, int Row, int Col) void SMPcClear(SMPmatrix *Matrix) { - spClear( (void *)Matrix ); + spClear( Matrix ); } /* @@ -145,7 +145,7 @@ SMPcClear(SMPmatrix *Matrix) void SMPclear(SMPmatrix *Matrix) { - spClear( (void *)Matrix ); + spClear( Matrix ); } /* @@ -155,8 +155,8 @@ SMPclear(SMPmatrix *Matrix) int SMPcLUfac(SMPmatrix *Matrix, double PivTol) { - spSetComplex( (void *)Matrix ); - return spFactor( (void *)Matrix ); + spSetComplex( Matrix ); + return spFactor( Matrix ); } /* @@ -166,9 +166,9 @@ SMPcLUfac(SMPmatrix *Matrix, double PivTol) int SMPluFac(SMPmatrix *Matrix, double PivTol, double Gmin) { - spSetReal( (void *)Matrix ); - LoadGmin( (void *)Matrix, Gmin ); - return spFactor( (void *)Matrix ); + spSetReal( Matrix ); + LoadGmin( Matrix, Gmin ); + return spFactor( Matrix ); } /* @@ -179,8 +179,8 @@ SMPcReorder(SMPmatrix *Matrix, double PivTol, double PivRel, int *NumSwaps) { *NumSwaps = 1; - spSetComplex( (void *)Matrix ); - return spOrderAndFactor( (void *)Matrix, (spREAL*)NULL, + spSetComplex( Matrix ); + return spOrderAndFactor( Matrix, (spREAL*)NULL, (spREAL)PivRel, (spREAL)PivTol, YES ); } @@ -190,9 +190,9 @@ SMPcReorder(SMPmatrix *Matrix, double PivTol, double PivRel, int SMPreorder(SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin) { - spSetReal( (void *)Matrix ); - LoadGmin( (void *)Matrix, Gmin ); - return spOrderAndFactor( (void *)Matrix, (spREAL*)NULL, + spSetReal( Matrix ); + LoadGmin( Matrix, Gmin ); + return spOrderAndFactor( Matrix, (spREAL*)NULL, (spREAL)PivRel, (spREAL)PivTol, YES ); } @@ -203,7 +203,7 @@ void SMPcaSolve(SMPmatrix *Matrix, double RHS[], double iRHS[], double Spare[], double iSpare[]) { - spSolveTransposed( (void *)Matrix, RHS, RHS, iRHS, iRHS ); + spSolveTransposed( Matrix, RHS, RHS, iRHS, iRHS ); } /* @@ -213,7 +213,7 @@ void SMPcSolve(SMPmatrix *Matrix, double RHS[], double iRHS[], double Spare[], double iSpare[]) { - spSolve( (void *)Matrix, RHS, RHS, iRHS, iRHS ); + spSolve( Matrix, RHS, RHS, iRHS, iRHS ); } /* @@ -222,7 +222,7 @@ SMPcSolve(SMPmatrix *Matrix, double RHS[], double iRHS[], void SMPsolve(SMPmatrix *Matrix, double RHS[], double Spare[]) { - spSolve( (void *)Matrix, RHS, RHS, (spREAL*)NULL, (spREAL*)NULL ); + spSolve( Matrix, RHS, RHS, (spREAL*)NULL, (spREAL*)NULL ); } /* @@ -231,7 +231,7 @@ SMPsolve(SMPmatrix *Matrix, double RHS[], double Spare[]) int SMPmatSize(SMPmatrix *Matrix) { - return spGetSize( (void *)Matrix, 1 ); + return spGetSize( Matrix, 1 ); } /* @@ -241,7 +241,7 @@ int SMPnewMatrix(SMPmatrix **pMatrix) { int Error; - *pMatrix = (SMPmatrix *)spCreate( 0, 1, &Error ); + *pMatrix = spCreate( 0, 1, &Error ); return Error; } @@ -251,7 +251,7 @@ SMPnewMatrix(SMPmatrix **pMatrix) void SMPdestroy(SMPmatrix *Matrix) { - spDestroy( (void *)Matrix ); + spDestroy( Matrix ); } /* @@ -260,8 +260,8 @@ SMPdestroy(SMPmatrix *Matrix) int SMPpreOrder(SMPmatrix *Matrix) { - spMNA_Preorder( (void *)Matrix ); - return spError( (void *)Matrix ); + spMNA_Preorder( Matrix ); + return spError( Matrix ); } /* @@ -271,7 +271,7 @@ SMPpreOrder(SMPmatrix *Matrix) void SMPprint(SMPmatrix *Matrix, FILE *File) { - spPrint( (void *)Matrix, 0, 1, 1 ); + spPrint( Matrix, 0, 1, 1 ); } /* @@ -280,7 +280,7 @@ SMPprint(SMPmatrix *Matrix, FILE *File) void SMPgetError(SMPmatrix *Matrix, int *Col, int *Row) { - spWhereSingular( (void *)Matrix, Row, Col ); + spWhereSingular( Matrix, Row, Col ); } /* @@ -290,9 +290,9 @@ SMPgetError(SMPmatrix *Matrix, int *Col, int *Row) int SMPcProdDiag(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) { - spDeterminant( (void *)Matrix, pExponent, &(pMantissa->real), + spDeterminant( Matrix, pExponent, &(pMantissa->real), &(pMantissa->imag) ); - return spError( (void *)Matrix ); + return spError( Matrix ); } /* @@ -304,7 +304,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) double re, im, x, y, z; int p; - spDeterminant( (void *)Matrix, &p, &re, &im); + spDeterminant( Matrix, &p, &re, &im); #ifndef M_LN2 #define M_LN2 0.69314718055994530942 @@ -374,7 +374,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) printf("Determinant 10->2: (%20g,%20g)^%d\n", pMantissa->real, pMantissa->imag, *pExponent); #endif - return spError( (void *)Matrix ); + return spError( Matrix ); } @@ -398,7 +398,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) static void LoadGmin(SMPmatrix *eMatrix, double Gmin) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I; ArrayOfElementPtrs Diag; ElementPtr diag; @@ -431,7 +431,7 @@ LoadGmin(SMPmatrix *eMatrix, double Gmin) SMPelement * SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr Element; /* Begin `SMPfindElt'. */ @@ -451,7 +451,7 @@ SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing) int SMPcZeroCol(SMPmatrix *eMatrix, int Col) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr Element; Col = Matrix->ExtToIntColMap[Col]; @@ -464,7 +464,7 @@ SMPcZeroCol(SMPmatrix *eMatrix, int Col) Element->Imag = 0.0; } - return spError( (void *)Matrix ); + return spError( Matrix ); } /* @@ -473,7 +473,7 @@ SMPcZeroCol(SMPmatrix *eMatrix, int Col) int SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr Accum, Addend, *Prev; Accum_Col = Matrix->ExtToIntColMap[Accum_Col]; @@ -496,7 +496,7 @@ SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col) Addend = Addend->NextInCol; } - return spError( (void *)Matrix ); + return spError( Matrix ); } /* @@ -505,7 +505,7 @@ SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col) int SMPzeroRow(SMPmatrix *eMatrix, int Row) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr Element; Row = Matrix->ExtToIntColMap[Row]; @@ -530,7 +530,7 @@ SMPzeroRow(SMPmatrix *eMatrix, int Row) } } - return spError( (void *)Matrix ); + return spError( Matrix ); } #ifdef PARALLEL_ARCH @@ -540,8 +540,8 @@ SMPzeroRow(SMPmatrix *eMatrix, int Row) void SMPcombine(SMPmatrix *Matrix, double RHS[], double Spare[]) { - spSetReal( (void *)Matrix ); - spCombine( (void *)Matrix, RHS, Spare, (spREAL*)NULL, (spREAL*)NULL ); + spSetReal( Matrix ); + spCombine( Matrix, RHS, Spare, (spREAL*)NULL, (spREAL*)NULL ); } /* @@ -551,7 +551,7 @@ void SMPcCombine(SMPmatrix *Matrix, double RHS[], double Spare[], double iRHS[], double iSpare[]) { - spSetComplex( (void *)Matrix ); - spCombine( (void *)Matrix, RHS, Spare, iRHS, iSpare ); + spSetComplex( Matrix ); + spCombine( Matrix, RHS, Spare, iRHS, iSpare ); } #endif /* PARALLEL_ARCH */ diff --git a/src/maths/sparse/spsolve.c b/src/maths/sparse/spsolve.c index 809e1ee00..ba06a1aff 100644 --- a/src/maths/sparse/spsolve.c +++ b/src/maths/sparse/spsolve.c @@ -124,10 +124,10 @@ static void SolveComplexTransposedMatrix( MatrixPtr, /*VARARGS3*/ void -spSolve(void *eMatrix, RealVector RHS, RealVector Solution, +spSolve(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; RealVector Intermediate; RealNumber Temp; @@ -400,10 +400,10 @@ SolveComplexMatrix( MatrixPtr Matrix, RealVector RHS, RealVector Solution , Real /*VARARGS3*/ void -spSolveTransposed(void *eMatrix, RealVector RHS, RealVector Solution, +spSolveTransposed(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; RealVector Intermediate; int I, *pExtOrder, Size; diff --git a/src/maths/sparse/sputils.c b/src/maths/sparse/sputils.c index 111569607..674055a5a 100644 --- a/src/maths/sparse/sputils.c +++ b/src/maths/sparse/sputils.c @@ -174,9 +174,9 @@ static void ComplexTransposedMatrixMultiply( MatrixPtr, RealVector, RealVector, */ void -spMNA_Preorder(void *eMatrix) +spMNA_Preorder(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int J, Size; ElementPtr pTwin1, pTwin2; int Twins, StartAt = 1; @@ -368,9 +368,9 @@ SwapCols( MatrixPtr Matrix, ElementPtr pTwin1, ElementPtr pTwin2 ) */ void -spScale(char *eMatrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors) +spScale(MatrixPtr eMatrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; int I, lSize, *pExtOrder; RealNumber ScaleFactor; @@ -571,14 +571,14 @@ MatrixPtr Matrix; */ void -spMultiply(void *eMatrix, RealVector RHS, RealVector Solution, +spMultiply(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { ElementPtr pElement; RealVector Vector; RealNumber Sum; int I, *pExtOrder; - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; /* Begin `spMultiply'. */ assert( IS_SPARSE( Matrix ) && !Matrix->Factored ); @@ -717,14 +717,14 @@ ComplexMatrixMultiply( MatrixPtr Matrix, RealVector RHS, RealVector Solution , R */ void -spMultTransposed(void *eMatrix, RealVector RHS, RealVector Solution, +spMultTransposed(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { ElementPtr pElement; RealVector Vector; RealNumber Sum; int I, *pExtOrder; - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; /* Begin `spMultTransposed'. */ assert( IS_SPARSE( Matrix ) && !Matrix->Factored ); @@ -878,10 +878,10 @@ ComplexTransposedMatrixMultiply( MatrixPtr Matrix, RealVector RHS, RealVector So */ void -spDeterminant(void *eMatrix, int *pExponent, RealNumber *pDeterminant, +spDeterminant(MatrixPtr eMatrix, int *pExponent, RealNumber *pDeterminant, RealNumber *piDeterminant) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I, Size; RealNumber Norm, nr, ni; ComplexNumber Pivot, cDeterminant; @@ -1037,9 +1037,9 @@ spDeterminant(void *eMatrix, int *pExponent, RealNumber *pDeterminant, */ void -spStripFills(char *eMatrix) +spStripFills(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; struct FillinListNodeStruct *pListNode; /* Begin `spStripFills'. */ @@ -1109,9 +1109,9 @@ spStripFills(char *eMatrix) * frame. This assumes that the matrix will be replaced with one of * the same size. */ void -spStripMatrix(char *eMatrix) +spStripMatrix(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; /* Begin `spStripMatrix'. */ assert( IS_SPARSE( Matrix ) ); @@ -1197,9 +1197,9 @@ spStripMatrix(char *eMatrix) */ void -spDeleteRowAndCol(char *eMatrix, int Row, int Col ) +spDeleteRowAndCol(MatrixPtr eMatrix, int Row, int Col) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement, *ppElement, pLastElement; int Size, ExtRow, ExtCol; ElementPtr spcFindElementInCol(); @@ -1310,9 +1310,9 @@ spDeleteRowAndCol(char *eMatrix, int Row, int Col ) * Pointer to the matrix. */ RealNumber -spPseudoCondition(char *eMatrix) +spPseudoCondition(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I; ArrayOfElementPtrs Diag; RealNumber MaxPivot, MinPivot, Mag; @@ -1401,9 +1401,9 @@ spPseudoCondition(char *eMatrix) * spNO_MEMORY */ RealNumber -spCondition(char *eMatrix, RealNumber NormOfMatrix, int *pError) +spCondition(MatrixPtr eMatrix, RealNumber NormOfMatrix, int *pError) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; RealVector T, Tm; int I, K, Row; @@ -1829,9 +1829,9 @@ int *pError; */ RealNumber -spNorm(char *eMatrix) +spNorm(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; int I; RealNumber Max = 0.0, AbsRowSum; @@ -1947,9 +1947,9 @@ spNorm(char *eMatrix) */ RealNumber -spLargestElement(char *eMatrix) +spLargestElement(MatrixPtr eMatrix) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; int I; RealNumber Mag, AbsColSum, Max = 0.0, MaxRow = 0.0, MaxCol = 0.0; RealNumber Pivot; @@ -2076,9 +2076,9 @@ spLargestElement(char *eMatrix) */ RealNumber -spRoundoff(char *eMatrix, RealNumber Rho) +spRoundoff(MatrixPtr eMatrix, RealNumber Rho) { - MatrixPtr Matrix = (MatrixPtr)eMatrix; + MatrixPtr Matrix = eMatrix; ElementPtr pElement; int Count, I, MaxCount = 0; RealNumber Reid, Gear; @@ -2143,7 +2143,7 @@ spRoundoff(char *eMatrix, RealNumber Rho) */ void -spErrorMessage( char *eMatrix, FILE *Stream, char *Originator ) +spErrorMessage(MatrixPtr eMatrix, FILE *Stream, char *Originator) { int Row, Col, Error; @@ -2152,8 +2152,8 @@ spErrorMessage( char *eMatrix, FILE *Stream, char *Originator ) Error = spNO_MEMORY; else { - assert(((MatrixPtr)eMatrix)->ID == SPARSE_ID); - Error = ((MatrixPtr)eMatrix)->Error; + assert(eMatrix->ID == SPARSE_ID); + Error = eMatrix->Error; } if (Error == spOKAY) return; diff --git a/src/ngmultidec.c b/src/ngmultidec.c index f4e6f1c0e..f33055cdc 100644 --- a/src/ngmultidec.c +++ b/src/ngmultidec.c @@ -19,7 +19,7 @@ Author: 1990 Jaijeet Roychowdury extern void usage(char **argv); extern void comments(double r,double l,double g,double c,double ctot,double cm,double lm,double k,char *name,int num, double len); extern double phi(int i, double arg); -extern void spErrorMessage(char*, FILE*, char*); +extern void spErrorMessage(MatrixPtr, FILE*, char*); int main (int argc, char **argv) @@ -197,7 +197,7 @@ main (int argc, char **argv) /* matrix = M set up */ { - char *othermatrix; + MatrixPtr othermatrix; double *rhs, *solution; double *irhs, *isolution; int errflg, err, singular_row, singular_col; @@ -208,7 +208,7 @@ main (int argc, char **argv) solution = (double *) tmalloc((unsigned) (sizeof(double)*(num+1))); isolution = (double *) tmalloc((unsigned) (sizeof(double)*(num+1))); - othermatrix = (char*) spCreate(num,0,&errflg); + othermatrix = spCreate(num,0,&errflg); for (i=1;i<=num;i++) { for (j=1; j<=num; j++) { diff --git a/src/spicelib/analysis/cktacct.c b/src/spicelib/analysis/cktacct.c index 8a62d7a26..48e5335f4 100644 --- a/src/spicelib/analysis/cktacct.c +++ b/src/spicelib/analysis/cktacct.c @@ -31,21 +31,21 @@ CKTacct(CKTcircuit *ckt, void *anal, int which, IFvalue *val) break; case OPT_ORIGNZ: if ( ckt->CKTmatrix != NULL ) { - val->iValue = spOriginalCount((char *)ckt->CKTmatrix); + val->iValue = spOriginalCount(ckt->CKTmatrix); } else { val->iValue = 0; } break; case OPT_FILLNZ: if ( ckt->CKTmatrix != NULL ) { - val->iValue = spFillinCount((char *)ckt->CKTmatrix); + val->iValue = spFillinCount(ckt->CKTmatrix); } else { val->iValue = 0; } break; case OPT_TOTALNZ: if ( ckt->CKTmatrix != NULL ) { - val->iValue = spElementCount((char *)ckt->CKTmatrix); + val->iValue = spElementCount(ckt->CKTmatrix); } else { val->iValue = 0; }