From 1b1c8219bf2481cabd0a19df70d5fa62f0922605 Mon Sep 17 00:00:00 2001 From: dwarning Date: Tue, 6 Jun 2023 19:49:12 +0200 Subject: [PATCH] white spaces --- src/include/ngspice/spmatrix.h | 190 ++++++++++++++++----------------- src/maths/sparse/spAllocate.c | 4 +- src/maths/sparse/spBuild.c | 6 +- src/maths/sparse/spConfig.h | 16 +-- src/maths/sparse/spDefs.h | 80 +++++++------- src/maths/sparse/spFactor.c | 74 ++++++------- src/maths/sparse/spOutput.c | 14 +-- src/maths/sparse/spSolve.c | 22 ++-- src/maths/sparse/spUtils.c | 76 ++++++------- 9 files changed, 241 insertions(+), 241 deletions(-) diff --git a/src/include/ngspice/spmatrix.h b/src/include/ngspice/spmatrix.h index 4e4de1297..fe96219eb 100644 --- a/src/include/ngspice/spmatrix.h +++ b/src/include/ngspice/spmatrix.h @@ -57,51 +57,51 @@ */ /* Begin error macros. */ -#define spOKAY 0 /*!< - * Error code that indicates that no error has - * occurred. - */ -#define spSMALL_PIVOT 1 /*!< - * Non-fatal error code that indicates that, when - * reordering the matrix, no element was found that - * satisfies the absolute threshold criteria. The - * largest element in the matrix was chosen as pivot. - */ -#define spZERO_DIAG 2 /*!< - * Fatal error code that indicates that, a zero was - * encountered on the diagonal the matrix. This does - * not necessarily imply that the matrix is singular. - * When this error occurs, the matrix should be - * reconstructed and factored using - * spOrderAndFactor(). - */ -#define spSINGULAR 3 /*!< - * Fatal error code that indicates that, matrix is - * singular, so no unique solution exists. - */ -#define spMANGLED 4 /*!< - * Fatal error code that indicates that, matrix has - * been mangled, results of requested operation are - * garbage. - */ -#define spNO_MEMORY 5 /*!< - * Fatal error code that indicates that not enough - * memory is available. - */ -#define spPANIC 6 /*!< - * Fatal error code that indicates that the routines - * are not prepared to handle the matrix that has - * been requested. This may occur when the matrix - * is specified to be real and the routines are not - * compiled for real matrices, or when the matrix is - * specified to be complex and the routines are not - * compiled to handle complex matrices. - */ -#define spFATAL 2 /*!< - * Error code that is not an error flag, but rather - * the dividing line between fatal errors and - * warnings. - */ +#define spOKAY 0 /*!< + * Error code that indicates that no error has + * occurred. + */ +#define spSMALL_PIVOT 1 /*!< + * Non-fatal error code that indicates that, when + * reordering the matrix, no element was found that + * satisfies the absolute threshold criteria. The + * largest element in the matrix was chosen as pivot. + */ +#define spZERO_DIAG 2 /*!< + * Fatal error code that indicates that, a zero was + * encountered on the diagonal the matrix. This does + * not necessarily imply that the matrix is singular. + * When this error occurs, the matrix should be + * reconstructed and factored using + * spOrderAndFactor(). + */ +#define spSINGULAR 3 /*!< + * Fatal error code that indicates that, matrix is + * singular, so no unique solution exists. + */ +#define spMANGLED 4 /*!< + * Fatal error code that indicates that, matrix has + * been mangled, results of requested operation are + * garbage. + */ +#define spNO_MEMORY 5 /*!< + * Fatal error code that indicates that not enough + * memory is available. + */ +#define spPANIC 6 /*!< + * Fatal error code that indicates that the routines + * are not prepared to handle the matrix that has + * been requested. This may occur when the matrix + * is specified to be real and the routines are not + * compiled for real matrices, or when the matrix is + * specified to be complex and the routines are not + * compiled to handle complex matrices. + */ +#define spFATAL 2 /*!< + * Error code that is not an error flag, but rather + * the dividing line between fatal errors and + * warnings. + */ @@ -113,15 +113,15 @@ */ #define spREAL double /*!< - * Defines the precision of the arithmetic used by - * \a Sparse will use. Double precision is suggested - * as being most appropriate for circuit simulation - * and for C. However, it is possible to change spREAL - * to a float for single precision arithmetic. Note - * that in C, single precision arithmetic is often - * slower than double precision. Sparse - * internally refers to spREALs as RealNumbers. - */ + * Defines the precision of the arithmetic used by + * \a Sparse will use. Double precision is suggested + * as being most appropriate for circuit simulation + * and for C. However, it is possible to change spREAL + * to a float for single precision arithmetic. Note + * that in C, single precision arithmetic is often + * slower than double precision. Sparse + * internally refers to spREALs as RealNumbers. + */ @@ -148,32 +148,32 @@ /* Begin partition keywords. */ -#define spDEFAULT_PARTITION 0 /*!< - * Partition code for spPartition(). - * Indicates that the default partitioning - * mode should be used. - * \see spPartition() - */ -#define spDIRECT_PARTITION 1 /*!< - * Partition code for spPartition(). - * Indicates that all rows should be placed - * in the direct addressing partition. - * \see spPartition() - */ -#define spINDIRECT_PARTITION 2 /*!< - * Partition code for spPartition(). - * Indicates that all rows should be placed - * in the indirect addressing partition. - * \see spPartition() - */ -#define spAUTO_PARTITION 3 /*!< - * Partition code for spPartition(). - * Indicates that \a Sparse should chose - * the best partition for each row based - * on some simple rules. This is generally - * preferred. - * \see spPartition() - */ +#define spDEFAULT_PARTITION 0 /*!< + * Partition code for spPartition(). + * Indicates that the default partitioning + * mode should be used. + * \see spPartition() + */ +#define spDIRECT_PARTITION 1 /*!< + * Partition code for spPartition(). + * Indicates that all rows should be placed + * in the direct addressing partition. + * \see spPartition() + */ +#define spINDIRECT_PARTITION 2 /*!< + * Partition code for spPartition(). + * Indicates that all rows should be placed + * in the indirect addressing partition. + * \see spPartition() + */ +#define spAUTO_PARTITION 3 /*!< + * Partition code for spPartition(). + * Indicates that \a Sparse should chose + * the best partition for each row based + * on some simple rules. This is generally + * preferred. + * \see spPartition() + */ @@ -281,10 +281,10 @@ typedef int spError; /* Begin `spTemplate'. */ struct spTemplate -{ spElement *Element1; - spElement *Element2; - spElement *Element3Negated; - spElement *Element4Negated; +{ spElement *Element1; + spElement *Element2; + spElement *Element3Negated; + spElement *Element4Negated; }; @@ -320,13 +320,13 @@ spcEXTERN int spFileStats( spMatrix, char*, char* ); spcEXTERN int spFillinCount( spMatrix ); spcEXTERN spElement *spFindElement( spMatrix, int, int ); spcEXTERN spError spGetAdmittance( spMatrix, int, int, - struct spTemplate* ); + struct spTemplate* ); spcEXTERN spElement *spGetElement( spMatrix, int, int ); spcEXTERN spGenericPtr spGetInitInfo( spElement* ); spcEXTERN spError spGetOnes( spMatrix, int, int, int, - struct spTemplate* ); + struct spTemplate* ); spcEXTERN spError spGetQuad( spMatrix, int, int, int, int, - struct spTemplate* ); + struct spTemplate* ); spcEXTERN int spGetSize( spMatrix, int ); spcEXTERN int spInitialize( spMatrix, int (*pInit)(spElement *, spGenericPtr, int, int) ); spcEXTERN void spInstallInitInfo( spElement*, spGenericPtr ); @@ -334,7 +334,7 @@ spcEXTERN spREAL spLargestElement( spMatrix ); spcEXTERN void spMNA_Preorder( spMatrix ); spcEXTERN spREAL spNorm( spMatrix ); spcEXTERN spError spOrderAndFactor( spMatrix, spREAL[], spREAL, - spREAL, int ); + spREAL, int ); spcEXTERN void spPartition( spMatrix, int ); spcEXTERN void spPrint( spMatrix, int, int, int ); spcEXTERN spREAL spPseudoCondition( spMatrix ); @@ -355,22 +355,22 @@ spcEXTERN void spDeterminant( spMatrix, int*, spREAL* ); #endif /* NOT spCOMPLEX */ #if spCOMPLEX && spSEPARATED_COMPLEX_VECTORS spcEXTERN int spFileVector( spMatrix, char* , - spREAL[], spREAL[]); + spREAL[], spREAL[]); spcEXTERN void spMultiply( spMatrix, spREAL[], spREAL[], - spREAL[], spREAL[] ); + spREAL[], spREAL[] ); spcEXTERN void spMultTransposed( spMatrix, spREAL[], spREAL[], - spREAL[], spREAL[] ); + spREAL[], spREAL[] ); spcEXTERN void spSolve( spMatrix, spREAL[], spREAL[], spREAL[], - spREAL[] ); + spREAL[] ); spcEXTERN void spSolveTransposed( spMatrix, spREAL[], spREAL[], - spREAL[], spREAL[] ); + spREAL[], spREAL[] ); #else /* NOT (spCOMPLEX && spSEPARATED_COMPLEX_VECTORS) */ spcEXTERN int spFileVector( spMatrix, char* , spREAL[] ); spcEXTERN void spMultiply( spMatrix, spREAL[], spREAL[] ); spcEXTERN void spMultTransposed( spMatrix, - spREAL[], spREAL[] ); + spREAL[], spREAL[] ); spcEXTERN void spSolve( spMatrix, spREAL[], spREAL[] ); spcEXTERN void spSolveTransposed( spMatrix, - spREAL[], spREAL[] ); + spREAL[], spREAL[] ); #endif /* NOT (spCOMPLEX && spSEPARATED_COMPLEX_VECTORS) */ #endif /* spOKAY */ diff --git a/src/maths/sparse/spAllocate.c b/src/maths/sparse/spAllocate.c index d0d631c7e..418a5cb6f 100644 --- a/src/maths/sparse/spAllocate.c +++ b/src/maths/sparse/spAllocate.c @@ -546,7 +546,7 @@ RecordAllocation( /* - * ADD A BLOCK OF SLOTS TO ALLOCATION LIST + * ADD A BLOCK OF SLOTS TO ALLOCATION LIST * * This routine increases the size of the allocation list. * @@ -840,7 +840,7 @@ spFillinCount( spMatrix eMatrix ) * \param eMatrix * Pointer to matrix. */ - + /* FIXME: Seems no different size entries available anymore */ int diff --git a/src/maths/sparse/spBuild.c b/src/maths/sparse/spBuild.c index e2bf9a093..1c7dea59b 100644 --- a/src/maths/sparse/spBuild.c +++ b/src/maths/sparse/spBuild.c @@ -206,7 +206,7 @@ long int Min = LARGEST_LONG_INTEGER; } else if (Row < Min) StartAt = BorderDown; - + /* Search column for element. */ if ((StartAt == BorderDown) OR (StartAt == DiagDown)) { if (StartAt == BorderDown) @@ -438,7 +438,7 @@ spcFindElementInCol(MatrixPtr Matrix, ElementPtr *LastAddr, */ static void -Translate( +Translate( MatrixPtr Matrix, int *Row, int *Col @@ -1260,7 +1260,7 @@ spInstallInitInfo( /*! * This function returns a pointer to a data structure that is used - * to contain initialization information to a matrix element. + * to contain initialization information to a matrix element. * * \return * The pointer to the initialiation information data structure diff --git a/src/maths/sparse/spConfig.h b/src/maths/sparse/spConfig.h index 1b466a22b..79d714bcd 100644 --- a/src/maths/sparse/spConfig.h +++ b/src/maths/sparse/spConfig.h @@ -468,36 +468,36 @@ # define spcCONCAT(prefix,suffix) prefix ## suffix # define spcQUOTE(x) # x # define spcFUNC_NEEDS_FILE(func,file) \ - func ## _requires_ ## file ## _to_be_included_ + func ## _requires_ ## file ## _to_be_included_ #else # define spcCONCAT(prefix,suffix) prefix/**/suffix # define spcQUOTE(x) "x" # define spcFUNC_NEEDS_FILE(func,file) \ - func/**/_requires_/**/file/**/_to_be_included_ + func/**/_requires_/**/file/**/_to_be_included_ #endif #if defined(__cplusplus) || defined(c_plusplus) /* * Definitions for C++ */ -# define spcEXTERN extern "C" +# define spcEXTERN extern "C" # define spcNO_ARGS -# define spcCONST const +# define spcCONST const typedef void *spGenericPtr; #else #ifdef __STDC__ /* * Definitions for ANSI C */ -# define spcEXTERN extern -# define spcNO_ARGS void -# define spcCONST const +# define spcEXTERN extern +# define spcNO_ARGS void +# define spcCONST const typedef void *spGenericPtr; # else /* * Definitions for K&R C -- ignore function prototypes */ -# define spcEXTERN extern +# define spcEXTERN extern # define spcNO_ARGS # define spcCONST typedef char *spGenericPtr; diff --git a/src/maths/sparse/spDefs.h b/src/maths/sparse/spDefs.h index 3fd8cfd36..9bde6bba4 100644 --- a/src/maths/sparse/spDefs.h +++ b/src/maths/sparse/spDefs.h @@ -102,22 +102,22 @@ #endif /* Define macros for validating matrix. */ -#define SPARSE_ID 0xDeadBeef /* Arbitrary. */ -#define IS_SPARSE(matrix) (((matrix) != NULL) AND \ - ((matrix)->ID == SPARSE_ID)) -#define NO_ERRORS(matrix) (((matrix)->Error >= spOKAY) AND \ - ((matrix)->Error < spFATAL)) -#define IS_FACTORED(matrix) ((matrix)->Factored AND \ - NOT (matrix)->NeedsOrdering) +#define SPARSE_ID 0xDeadBeef /* Arbitrary. */ +#define IS_SPARSE(matrix) (((matrix) != NULL) AND \ + ((matrix)->ID == SPARSE_ID)) +#define NO_ERRORS(matrix) (((matrix)->Error >= spOKAY) AND \ + ((matrix)->Error < spFATAL)) +#define IS_FACTORED(matrix) ((matrix)->Factored AND \ + NOT (matrix)->NeedsOrdering) -#define ASSERT_IS_SPARSE(matrix) vASSERT( IS_SPARSE(matrix), \ - spcMatrixIsNotValid ) -#define ASSERT_NO_ERRORS(matrix) vASSERT( NO_ERRORS(matrix), \ - spcErrorsMustBeCleared ) -#define ASSERT_IS_FACTORED(matrix) vASSERT( IS_FACTORED(matrix), \ - spcMatrixMustBeFactored ) -#define ASSERT_IS_NOT_FACTORED(matrix) vASSERT( NOT (matrix)->Factored, \ - spcMatrixMustNotBeFactored ) +#define ASSERT_IS_SPARSE(matrix) vASSERT( IS_SPARSE(matrix), \ + spcMatrixIsNotValid ) +#define ASSERT_NO_ERRORS(matrix) vASSERT( NO_ERRORS(matrix), \ + spcErrorsMustBeCleared ) +#define ASSERT_IS_FACTORED(matrix) vASSERT( IS_FACTORED(matrix), \ + spcMatrixMustBeFactored ) +#define ASSERT_IS_NOT_FACTORED(matrix) vASSERT( NOT (matrix)->Factored, \ + spcMatrixMustNotBeFactored ) /* Macro commands */ /* Macro functions that return the maximum or minimum independent of type. */ @@ -371,7 +371,7 @@ /* * ASSERT and ABORT * - * Macro used to assert that if the code is working correctly, then + * Macro used to assert that if the code is working correctly, then * a condition must be true. If not, then execution is terminated * and an error message is issued stating that there is an internal * error and giving the file and line number. These assertions are @@ -379,45 +379,45 @@ */ #if DEBUG -#define ASSERT(condition) \ -{ if (NOT(condition)) \ - { (void)fflush(stdout); \ - (void)fprintf(stderr, "sparse: internal error detected in file `%s' at line %d.\n assertion `%s' failed.\n",\ - __FILE__, __LINE__, spcQUOTE(condition) ); \ - (void)fflush(stderr); \ - abort(); \ - } \ +#define ASSERT(condition) \ +{ if (NOT(condition)) \ + { (void)fflush(stdout); \ + (void)fprintf(stderr, "sparse: internal error detected in file `%s' at line %d.\n assertion `%s' failed.\n",\ + __FILE__, __LINE__, spcQUOTE(condition) ); \ + (void)fflush(stderr); \ + abort(); \ + } \ } #else #define ASSERT(condition) #endif #if DEBUG -#define vASSERT(condition,message) \ -{ if (NOT(condition)) \ - vABORT(message); \ +#define vASSERT(condition,message) \ +{ if (NOT(condition)) \ + vABORT(message); \ } #else #define vASSERT(condition,message) #endif #if DEBUG -#define vABORT(message) \ -{ (void)fflush(stdout); \ +#define vABORT(message) \ +{ (void)fflush(stdout); \ (void)fprintf(stderr, "sparse: internal error detected in file `%s' at line %d.\n %s.\n", __FILE__, __LINE__, message );\ - (void)fflush(stderr); \ - abort(); \ + (void)fflush(stderr); \ + abort(); \ } -#define ABORT() \ -{ (void)fflush(stdout); \ - (void)fprintf(stderr, "sparse: internal error detected in file `%s' at line %d.\n", __FILE__, __LINE__ ); \ - (void)fflush(stderr); \ - abort(); \ +#define ABORT() \ +{ (void)fflush(stdout); \ + (void)fprintf(stderr, "sparse: internal error detected in file `%s' at line %d.\n", __FILE__, __LINE__ ); \ + (void)fflush(stderr); \ + abort(); \ } #else -#define vABORT(message) abort() -#define ABORT() abort() +#define vABORT(message) abort() +#define ABORT() abort() #endif @@ -799,7 +799,7 @@ struct FillinListNodeStruct * Flag that indicates the sum of row and column interchange counts * is an odd number. Used when determining the sign of the determinant. * Partitioned (BOOLEAN) - * This flag indicates that the columns of the matrix have been + * This flag indicates that the columns of the matrix have been * partitioned into two groups. Those that will be addressed directly * and those that will be addressed indirectly in spFactor(). * PivotsOriginalCol (int) @@ -943,7 +943,7 @@ spcEXTERN ElementPtr spcGetFillin( MatrixPtr ); spcEXTERN ElementPtr spcFindElementInCol( MatrixPtr, ElementPtr*, int, int, int ); spcEXTERN ElementPtr spcFindDiag( MatrixPtr, int ); spcEXTERN ElementPtr spcCreateElement( MatrixPtr, int, int, - ElementPtr*, ElementPtr*, int ); + ElementPtr*, ElementPtr*, int ); spcEXTERN void spcCreateInternalVectors( MatrixPtr ); spcEXTERN void spcLinkRows( MatrixPtr ); spcEXTERN void spcColExchange( MatrixPtr, int, int ); diff --git a/src/maths/sparse/spFactor.c b/src/maths/sparse/spFactor.c index 45be9d52b..3f17d5b90 100644 --- a/src/maths/sparse/spFactor.c +++ b/src/maths/sparse/spFactor.c @@ -30,7 +30,7 @@ * ExchangeColElements ExchangeRowElements * RealRowColElimination ComplexRowColElimination * UpdateMarkowitzNumbers MatrixIsSingular - * ZeroPivot WriteStatus + * ZeroPivot WriteStatus */ @@ -82,9 +82,9 @@ static RealNumber FindLargestInCol( ElementPtr ); static RealNumber FindBiggestInColExclude( MatrixPtr, ElementPtr, int ); static void ExchangeRowsAndCols( MatrixPtr, ElementPtr, int ); static void ExchangeColElements( MatrixPtr, int, ElementPtr, int, - ElementPtr, int ); + ElementPtr, int ); static void ExchangeRowElements( MatrixPtr, int, ElementPtr, int, - ElementPtr, int ); + ElementPtr, int ); static void RealRowColElimination( MatrixPtr, ElementPtr ); static void ComplexRowColElimination( MatrixPtr, ElementPtr ); static void UpdateMarkowitzNumbers( MatrixPtr, ElementPtr ); @@ -106,7 +106,7 @@ static void WriteStatus( MatrixPtr, int ); * diagonal terms of \a U are one. * * \return - * The error code is returned. Possible errors are \a spNO_MEMORY, + * The error code is returned. Possible errors are \a spNO_MEMORY, * \a spSINGULAR and \a spSMALL_PIVOT. * Error is cleared upon entering this function. * @@ -498,7 +498,7 @@ ComplexNumber Mult, Pivot; /* Check for singular matrix. */ Pivot = Dest[Step]; if (CMPLX_1_NORM(Pivot) == 0.0) return ZeroPivot( Matrix, Step ); - CMPLX_RECIPROCAL( *Matrix->Diag[Step], Pivot ); + CMPLX_RECIPROCAL( *Matrix->Diag[Step], Pivot ); } else { /* Update column using direct addressing scatter-gather. */ @@ -529,7 +529,7 @@ ComplexNumber Mult, Pivot; /* Check for singular matrix. */ pElement = Matrix->Diag[Step]; if (ELEMENT_MAG(pElement) == 0.0) return ZeroPivot( Matrix, Step ); - CMPLX_RECIPROCAL( *pElement, *pElement ); + CMPLX_RECIPROCAL( *pElement, *pElement ); } } @@ -922,7 +922,7 @@ int ExtRow; */ static void -MarkowitzProducts( +MarkowitzProducts( MatrixPtr Matrix, int Step ) @@ -1037,7 +1037,7 @@ ElementPtr SearchEntireMatrix(); { /* * Either no singletons exist or they weren't acceptable. Take quick first - * pass at searching diagonal. First search for element on diagonal of + * pass at searching diagonal. First search for element on diagonal of * remaining submatrix with smallest Markowitz product, then check to see * if it okay numerically. If not, QuicklySearchDiagonal fails. */ @@ -1111,7 +1111,7 @@ ElementPtr SearchEntireMatrix(); */ static ElementPtr -SearchForSingleton( +SearchForSingleton( MatrixPtr Matrix, int Step ) @@ -1193,10 +1193,10 @@ RealNumber PivotMag, FindBiggestInColExclude(); { ChosenPivot = Matrix->FirstInCol[I]; while ((ChosenPivot != NULL) AND (ChosenPivot->Row < Step)) ChosenPivot = ChosenPivot->NextInCol; - if (ChosenPivot == NULL) - { /* Reduced column has no elements, matrix is singular. */ - break; - } + if (ChosenPivot == NULL) + { /* Reduced column has no elements, matrix is singular. */ + break; + } PivotMag = ELEMENT_MAG( ChosenPivot ); if ( PivotMag > Matrix->AbsThreshold AND @@ -1209,10 +1209,10 @@ RealNumber PivotMag, FindBiggestInColExclude(); { ChosenPivot = Matrix->FirstInRow[I]; while((ChosenPivot != NULL) AND (ChosenPivot->ColNextInRow; - if (ChosenPivot == NULL) - {/* Reduced row has no elements, matrix is singular. */ - break; - } + if (ChosenPivot == NULL) + {/* Reduced row has no elements, matrix is singular. */ + break; + } PivotMag = ELEMENT_MAG(ChosenPivot); if ( PivotMag > Matrix->AbsThreshold AND @@ -1228,10 +1228,10 @@ RealNumber PivotMag, FindBiggestInColExclude(); { ChosenPivot = Matrix->FirstInRow[I]; while ((ChosenPivot != NULL) AND (ChosenPivot->Col < Step)) ChosenPivot = ChosenPivot->NextInRow; - if (ChosenPivot == NULL) - { /* Reduced row has no elements, matrix is singular. */ - break; - } + if (ChosenPivot == NULL) + { /* Reduced row has no elements, matrix is singular. */ + break; + } PivotMag = ELEMENT_MAG(ChosenPivot); if ( PivotMag > Matrix->AbsThreshold AND @@ -1333,7 +1333,7 @@ RealNumber PivotMag, FindBiggestInColExclude(); */ static ElementPtr -QuicklySearchDiagonal( +QuicklySearchDiagonal( MatrixPtr Matrix, int Step ) @@ -1697,7 +1697,7 @@ RealNumber FindBiggestInColExclude(); */ static ElementPtr -SearchDiagonal( +SearchDiagonal( MatrixPtr Matrix, register int Step ) @@ -1864,7 +1864,7 @@ RealNumber FindLargestInCol(); } /* Calculate element's MarkowitzProduct. */ spcMarkoProd( Product, Matrix->MarkowitzRow[pElement->Row], - Matrix->MarkowitzCol[pElement->Col] ); + Matrix->MarkowitzCol[pElement->Col] ); /* Test to see if element is acceptable as a pivot candidate. */ if ((Product <= MinMarkowitzProduct) AND @@ -2090,7 +2090,7 @@ RealNumber Largest, Magnitude; */ static void -ExchangeRowsAndCols( +ExchangeRowsAndCols( MatrixPtr Matrix, ElementPtr pPivot, register int Step @@ -2129,7 +2129,7 @@ long OldMarkowitzProd_Step, OldMarkowitzProd_Row, OldMarkowitzProd_Col; NOT Matrix->NumberOfInterchangesIsOdd; spcMarkoProd( Matrix->MarkowitzProd[Row], Matrix->MarkowitzRow[Row], - Matrix->MarkowitzCol[Row] ); + Matrix->MarkowitzCol[Row] ); /* Update singleton count. */ if ((Matrix->MarkowitzProd[Row]==0) != (OldMarkowitzProd_Row==0)) @@ -2146,8 +2146,8 @@ long OldMarkowitzProd_Step, OldMarkowitzProd_Row, OldMarkowitzProd_Col; Matrix->NumberOfInterchangesIsOdd = NOT Matrix->NumberOfInterchangesIsOdd; spcMarkoProd( Matrix->MarkowitzProd[Col], - Matrix->MarkowitzCol[Col], - Matrix->MarkowitzRow[Col] ); + Matrix->MarkowitzCol[Col], + Matrix->MarkowitzRow[Col] ); /* Update singleton count. */ if ((Matrix->MarkowitzProd[Col]==0) != (OldMarkowitzProd_Col==0)) @@ -2292,7 +2292,7 @@ ElementPtr Element1, Element2; * * Performs all required operations to exchange two columns. Those operations * include: swap FirstInCol pointers, fixing up the NextInRow pointers, - * swapping column indexes in MatrixElements, and swapping Markowitz + * swapping column indexes in MatrixElements, and swapping Markowitz * column counts. * * >>> Arguments: @@ -2735,20 +2735,20 @@ register ElementPtr pLower, pUpper; pSub = pUpper->NextInCol; pLower = pPivot->NextInCol; - ppAbove = &pUpper->NextInCol; + ppAbove = &pUpper->NextInCol; while (pLower != NULL) { Row = pLower->Row; /* Find element in row that lines up with current lower triangular element. */ while (pSub != NULL AND pSub->Row < Row) - { ppAbove = &pSub->NextInCol; + { ppAbove = &pSub->NextInCol; pSub = pSub->NextInCol; - } + } /* Test to see if desired element was not found, if not, create fill-in. */ if (pSub == NULL OR pSub->Row > Row) { pSub = spcCreateElement( Matrix, Row, pUpper->Col, - &pLower->NextInRow, ppAbove, YES ); + &pLower->NextInRow, ppAbove, YES ); if (pSub == NULL) { Matrix->Error = spNO_MEMORY; return; @@ -2828,20 +2828,20 @@ register ElementPtr pLower, pUpper; pSub = pUpper->NextInCol; pLower = pPivot->NextInCol; - ppAbove = &pUpper->NextInCol; + ppAbove = &pUpper->NextInCol; while (pLower != NULL) { Row = pLower->Row; /* Find element in row that lines up with current lower triangular element. */ while (pSub != NULL AND pSub->Row < Row) - { ppAbove = &pSub->NextInCol; + { ppAbove = &pSub->NextInCol; pSub = pSub->NextInCol; - } + } /* Test to see if desired element was not found, if not, create fill-in. */ if (pSub == NULL OR pSub->Row > Row) { pSub = spcCreateElement( Matrix, Row, pUpper->Col, - &pLower->NextInRow, ppAbove, YES ); + &pLower->NextInRow, ppAbove, YES ); if (pSub == NULL) { Matrix->Error = spNO_MEMORY; return; diff --git a/src/maths/sparse/spOutput.c b/src/maths/sparse/spOutput.c index 88cee16a4..d93daddcb 100644 --- a/src/maths/sparse/spOutput.c +++ b/src/maths/sparse/spOutput.c @@ -6,7 +6,7 @@ * UC Berkeley */ /*! \file - * + * * This file contains the output-to-file and output-to-screen routines for * the matrix package. * @@ -291,7 +291,7 @@ int *PrintOrdToIntRowMap, *PrintOrdToIntColMap; #if spCOMPLEX if (Matrix->Complex AND Data) { if (Header) - printf(" "); + printf(" "); for (J = StartCol; J <= StopCol; J++) { if (pImagElements[J - StartCol] != NULL) { printf(" %8.2gj", @@ -333,8 +333,8 @@ int *PrintOrdToIntRowMap, *PrintOrdToIntColMap; } /* Calculate and print sparsity and number of fill-ins created. */ - printf("\nDensity = %2.2f%%.\n", ((double)ElementCount * 100.0) - / (((double)Size * (double)Size))); + printf("\nDensity = %2.2f%%.\n", ((double)ElementCount * 100.0) + / (((double)Size * (double)Size))); if (NOT Matrix->NeedsOrdering) printf("Number of fill-ins = %1d.\n", Matrix->Fillins); } @@ -426,7 +426,7 @@ FILE *pMatrixFile; ( pMatrixFile, "Warning : The following matrix is factored in to LU form.\n" ); - if (Err < 0) return 0; + if (Err < 0) return 0; } if (fprintf(pMatrixFile, "%s\n", Label) < 0) return 0; Err = fprintf( pMatrixFile, "%d\t%s\n", Size, @@ -643,7 +643,7 @@ FILE *pMatrixFile; /*! * Writes useful information concerning the matrix to a file. Should be * executed after the matrix is factored. - * + * * \return * One is returned if routine was successful, otherwise zero is returned. * The calling function can query \a errno (the system global error variable) @@ -741,7 +741,7 @@ FILE *pStatsFile; fprintf(pStatsFile, " Average number of elements per row = %f\n", (double)NumberOfElements / (double)Size); fprintf(pStatsFile," Density = %f%%\n", - (100.0*(double)NumberOfElements)/((double)Size*(double)Size)); + (100.0*(double)NumberOfElements)/((double)Size*(double)Size)); fprintf(pStatsFile," Relative Threshold = %e\n", Matrix->RelThreshold); fprintf(pStatsFile," Absolute Threshold = %e\n", Matrix->AbsThreshold); fprintf(pStatsFile," Largest Element = %e\n", LargestElement); diff --git a/src/maths/sparse/spSolve.c b/src/maths/sparse/spSolve.c index 44d9f4024..802883ef9 100644 --- a/src/maths/sparse/spSolve.c +++ b/src/maths/sparse/spSolve.c @@ -67,7 +67,7 @@ static void SolveComplexTransposedMatrix( MatrixPtr, #else static void SolveComplexMatrix( MatrixPtr, RealVector, RealVector ); static void SolveComplexTransposedMatrix( MatrixPtr, - RealVector, RealVector ); + RealVector, RealVector ); #endif @@ -141,8 +141,8 @@ spSolve( spREAL RHS[], spREAL Solution[] # if spCOMPLEX AND spSEPARATED_COMPLEX_VECTORS - , spREAL iRHS[] - , spREAL iSolution[] + , spREAL iRHS[] + , spREAL iSolution[] # endif ) { @@ -183,7 +183,7 @@ void SolveComplexMatrix(); /* Forward elimination. Solves Lc = b.*/ for (I = 1; I <= Size; I++) - { + { /* This step of the elimination is skipped if Temp equals zero. */ if ((Temp = Intermediate[I]) != 0.0) { pPivot = Matrix->Diag[I]; @@ -286,8 +286,8 @@ SolveComplexMatrix( RealVector RHS, RealVector Solution # if spSEPARATED_COMPLEX_VECTORS - , RealVector iRHS - , RealVector iSolution + , RealVector iRHS + , RealVector iSolution # endif ) { @@ -455,8 +455,8 @@ spSolveTransposed( spREAL RHS[], spREAL Solution[] # if spCOMPLEX AND spSEPARATED_COMPLEX_VECTORS - , spREAL iRHS[] - , spREAL iSolution[] + , spREAL iRHS[] + , spREAL iSolution[] # endif ) { @@ -497,7 +497,7 @@ void SolveComplexTransposedMatrix(); /* Forward elimination. */ for (I = 1; I <= Size; I++) - { + { /* This step of the elimination is skipped if Temp equals zero. */ if ((Temp = Intermediate[I]) != 0.0) { pElement = Matrix->Diag[I]->NextInRow; @@ -602,8 +602,8 @@ SolveComplexTransposedMatrix( RealVector RHS, RealVector Solution # if spSEPARATED_COMPLEX_VECTORS - , RealVector iRHS - , RealVector iSolution + , RealVector iRHS + , RealVector iSolution # endif ) { diff --git a/src/maths/sparse/spUtils.c b/src/maths/sparse/spUtils.c index 6dd2f978f..4a67ece8d 100644 --- a/src/maths/sparse/spUtils.c +++ b/src/maths/sparse/spUtils.c @@ -79,14 +79,14 @@ static void ScaleComplexMatrix( MatrixPtr, RealVector, RealVector ); #endif #if spSEPARATED_COMPLEX_VECTORS static void ComplexMatrixMultiply( MatrixPtr, - RealVector, RealVector, RealVector, RealVector ); + RealVector, RealVector, RealVector, RealVector ); static void ComplexTransposedMatrixMultiply( MatrixPtr, - RealVector, RealVector, RealVector, RealVector ); + RealVector, RealVector, RealVector, RealVector ); #else static void ComplexMatrixMultiply( MatrixPtr, - RealVector, RealVector ); + RealVector, RealVector ); static void ComplexTransposedMatrixMultiply( MatrixPtr, - RealVector, RealVector ); + RealVector, RealVector ); #endif #if CONDITION #if spCOMPLEX @@ -170,7 +170,7 @@ static RealNumber ComplexCondition( MatrixPtr, RealNumber, int* ); * The algorithm used in this function was developed by Ken Kundert and * Tom Quarles. * - * \param * eMatrix + * \param * eMatrix * Pointer to the matrix to be preordered. */ /* >>> Local variables; @@ -617,9 +617,9 @@ extern void ComplexMatrixMultiply(); ASSERT_IS_SPARSE( Matrix ); ASSERT_IS_NOT_FACTORED( Matrix ); if (NOT Matrix->RowsLinked) - spcLinkRows(Matrix); + spcLinkRows(Matrix); if (NOT Matrix->InternalVectorsAllocated) - spcCreateInternalVectors( Matrix ); + spcCreateInternalVectors( Matrix ); #if spCOMPLEX if (Matrix->Complex) @@ -808,7 +808,7 @@ extern void ComplexTransposedMatrixMultiply(); ASSERT_IS_SPARSE( Matrix ); ASSERT_IS_NOT_FACTORED( Matrix ); if (NOT Matrix->InternalVectorsAllocated) - spcCreateInternalVectors( Matrix ); + spcCreateInternalVectors( Matrix ); #if spCOMPLEX if (Matrix->Complex) @@ -1075,7 +1075,7 @@ ComplexNumber Pivot, cDeterminant; } if (Matrix->NumberOfInterchangesIsOdd) CMPLX_NEGATE( cDeterminant ); - + *pDeterminant = cDeterminant.Real; *piDeterminant = cDeterminant.Imag; } @@ -1265,7 +1265,7 @@ int Size, ExtRow, ExtCol; ASSERT_IS_SPARSE( Matrix ); vASSERT( (Row > 0) AND (Col > 0), "Nonpositive row or column number" ); vASSERT( (Row <= Matrix->ExtSize) AND (Col <= Matrix->ExtSize), - "Row or column number too large" ); + "Row or column number too large" ); Size = Matrix->Size; ExtRow = Row; @@ -1287,7 +1287,7 @@ int Size, ExtRow, ExtCol; SWAP( ElementPtr, Matrix->Diag[Row], Matrix->Diag[Size] ) else { Matrix->Diag[Row] = spcFindDiag( Matrix, Row ); - Matrix->Diag[Col] = spcFindDiag( Matrix, Col ); + Matrix->Diag[Col] = spcFindDiag( Matrix, Col ); } /* @@ -1375,16 +1375,16 @@ spPseudoCondition( spMatrix eMatrix ) ASSERT_NO_ERRORS( Matrix ); ASSERT_IS_FACTORED( Matrix ); if (Matrix->Error == spSINGULAR OR Matrix->Error == spZERO_DIAG) - return 0.0; + return 0.0; Diag = Matrix->Diag; MaxPivot = MinPivot = ELEMENT_MAG( Diag[1] ); for (I = 2; I <= Matrix->Size; I++) { Mag = ELEMENT_MAG( Diag[I] ); - if (Mag > MaxPivot) - MaxPivot = Mag; - else if (Mag < MinPivot) - MinPivot = Mag; + if (Mag > MaxPivot) + MaxPivot = Mag; + else if (Mag < MinPivot) + MinPivot = Mag; } ASSERT( MaxPivot > 0.0 ); return MaxPivot / MinPivot; @@ -1421,14 +1421,14 @@ spPseudoCondition( spMatrix eMatrix ) * A.K. Cline, C.B. Moler, G.W. Stewart, J.H. Wilkinson. An estimate * for the condition number of a matrix. SIAM Journal on Numerical * Analysis. Vol. 16, No. 2, pages 368-375, April 1979. - * + * * J.J. Dongarra, C.B. Moler, J.R. Bunch, G.W. Stewart. LINPACK * User's Guide. SIAM, 1979. - * + * * Roger G. Grimes, John G. Lewis. Condition number estimation for * sparse matrices. SIAM Journal on Scientific and Statistical * Computing. Vol. 2, No. 4, pages 384-388, December 1981. - * + * * Dianne Prost O'Leary. Estimating matrix condition numbers. SIAM * Journal on Scientific and Statistical Computing. Vol. 1, No. 2, * pages 205-209, June 1980. @@ -1448,7 +1448,7 @@ spPseudoCondition( spMatrix eMatrix ) */ spREAL -spCondition( +spCondition( spMatrix eMatrix, spREAL NormOfMatrix, int *pError @@ -1933,7 +1933,7 @@ RealNumber Max = 0.0, AbsRowSum; * * Using only the size of the matrix as an upper bound on \f$ m_{ij} \f$ and * Barlow's bound, the user can estimate the size of the matrix error - * terms \f$ e_{ij} \f$ using the bound of Erisman and Reid. spRoundoff() + * terms \f$ e_{ij} \f$ using the bound of Erisman and Reid. spRoundoff() * computes a tighter bound (with more work) based on work by Gear * [3], \f$ |e_{ij}| < 1.01 u \rho (t c^3 + (1 + t)c^2) \f$ where * \f$ t \f$ is the threshold and \f$ c \f$ is the maximum number of @@ -2083,7 +2083,7 @@ register ElementPtr pElement, pDiag; */ spREAL -spRoundoff( +spRoundoff( spMatrix eMatrix, spREAL Rho ) @@ -2140,12 +2140,12 @@ RealNumber Reid, Gear; * The error state is cleared. * * \param eMatrix - * Matrix for which the error message is to be printed. + * Matrix for which the error message is to be printed. * \param Stream - * Stream to which the error message is to be printed. + * Stream to which the error message is to be printed. * \param Originator - * Name of originator of error message. If NULL, `sparse' is used. - * If zero-length string, no originator is printed. + * Name of originator of error message. If NULL, `sparse' is used. + * If zero-length string, no originator is printed. */ void @@ -2159,10 +2159,10 @@ int Row, Col, Error; /* Begin `spErrorMessage'. */ if (eMatrix == NULL) - Error = spNO_MEMORY; + Error = spNO_MEMORY; else { ASSERT_IS_SPARSE( (MatrixPtr)eMatrix ); - Error = ((MatrixPtr)eMatrix)->Error; + Error = ((MatrixPtr)eMatrix)->Error; } if (Error == spOKAY) return; @@ -2170,32 +2170,32 @@ int Row, Col, Error; if (Stream == NULL) Stream = stderr; if (Originator[0] != '\0') fprintf( Stream, "%s: ", Originator ); if (Error >= spFATAL) - fprintf( Stream, "fatal error: "); + fprintf( Stream, "fatal error: "); else - fprintf( Stream, "warning: "); + fprintf( Stream, "warning: "); /* * Print particular error message. * Do not use switch statement because error codes may not be unique. */ if (Error == spPANIC) - fprintf( Stream, "Sparse called improperly.\n"); + fprintf( Stream, "Sparse called improperly.\n"); else if (Error == spNO_MEMORY) - fprintf( Stream, "insufficient memory available.\n"); + fprintf( Stream, "insufficient memory available.\n"); else if (Error == spMANGLED) - fprintf( Stream, "matrix is mangled.\n"); + fprintf( Stream, "matrix is mangled.\n"); else if (Error == spSINGULAR) { spWhereSingular( eMatrix, &Row, &Col ); - fprintf( Stream, "singular matrix detected at row %d and column %d.\n", - Row, Col); + fprintf( Stream, "singular matrix detected at row %d and column %d.\n", + Row, Col); } else if (Error == spZERO_DIAG) { spWhereSingular( eMatrix, &Row, &Col ); - fprintf( Stream, "zero diagonal detected at row %d and column %d.\n", - Row, Col); + fprintf( Stream, "zero diagonal detected at row %d and column %d.\n", + Row, Col); } else if (Error == spSMALL_PIVOT) { fprintf( Stream, - "unable to find a pivot that is larger than absolute threshold.\n"); + "unable to find a pivot that is larger than absolute threshold.\n"); } else ABORT();