From 19fef8bff4fd272fba00ce604f227f1d515215c9 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 28 Apr 2013 20:00:32 +0200 Subject: [PATCH] sparse/*.c, simplify, drop the local copy `Matrix' --- src/maths/sparse/spalloc.c | 12 ++++----- src/maths/sparse/spbuild.c | 16 ++++++------ src/maths/sparse/spfactor.c | 12 ++++----- src/maths/sparse/spoutput.c | 16 ++++++------ src/maths/sparse/spsmp.c | 20 +++++++------- src/maths/sparse/spsolve.c | 8 +++--- src/maths/sparse/sputils.c | 52 ++++++++++++++++++------------------- 7 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/maths/sparse/spalloc.c b/src/maths/sparse/spalloc.c index 1e7713ce8..56b8a31d7 100644 --- a/src/maths/sparse/spalloc.c +++ b/src/maths/sparse/spalloc.c @@ -646,9 +646,9 @@ AllocateBlockOfAllocationList(MatrixPtr Matrix) */ void -spDestroy(MatrixPtr eMatrix) +spDestroy(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + AllocationListPtr ListPtr, NextListPtr; @@ -741,9 +741,9 @@ spError(MatrixPtr eMatrix ) */ void -spWhereSingular(MatrixPtr eMatrix, int *pRow, int *pCol) +spWhereSingular(MatrixPtr Matrix, int *pRow, int *pCol) { - MatrixPtr Matrix = eMatrix; + /* Begin `spWhereSingular'. */ assert( IS_SPARSE( Matrix ) ); @@ -779,9 +779,9 @@ spWhereSingular(MatrixPtr eMatrix, int *pRow, int *pCol) */ int -spGetSize(MatrixPtr eMatrix, int External) +spGetSize(MatrixPtr Matrix, int External) { - MatrixPtr Matrix = eMatrix; + /* Begin `spGetSize'. */ assert( IS_SPARSE( Matrix ) ); diff --git a/src/maths/sparse/spbuild.c b/src/maths/sparse/spbuild.c index c7265153d..26cae49d5 100644 --- a/src/maths/sparse/spbuild.c +++ b/src/maths/sparse/spbuild.c @@ -94,9 +94,9 @@ static void ExpandTranslationArrays( MatrixPtr, int ); */ void -spClear(MatrixPtr eMatrix) +spClear(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; int I; @@ -181,9 +181,9 @@ spClear(MatrixPtr eMatrix) */ RealNumber * -spFindElement(MatrixPtr eMatrix, int Row, int Col) +spFindElement(MatrixPtr Matrix, int Row, int Col) { -MatrixPtr Matrix = eMatrix; + ElementPtr pElement; /* Begin `spFindElement'. */ @@ -264,9 +264,9 @@ ElementPtr pElement; */ RealNumber * -spGetElement(MatrixPtr eMatrix, int Row, int Col) +spGetElement(MatrixPtr Matrix, int Row, int Col) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; /* Begin `spGetElement'. */ @@ -1146,9 +1146,9 @@ spGetInitInfo(RealNumber *pElement) int -spInitialize(MatrixPtr eMatrix, int (*pInit)(RealNumber*, void *InitInfo, int , int Col)) +spInitialize(MatrixPtr Matrix, int (*pInit)(RealNumber*, void *InitInfo, int , int Col)) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; int J, Error, Col; diff --git a/src/maths/sparse/spfactor.c b/src/maths/sparse/spfactor.c index 103392a73..6c13b141d 100644 --- a/src/maths/sparse/spfactor.c +++ b/src/maths/sparse/spfactor.c @@ -189,10 +189,10 @@ static int ZeroPivot( MatrixPtr, int ); */ int -spOrderAndFactor(MatrixPtr eMatrix, RealNumber RHS[], RealNumber RelThreshold, +spOrderAndFactor(MatrixPtr Matrix, RealNumber RHS[], RealNumber RelThreshold, RealNumber AbsThreshold, int DiagPivoting) { - MatrixPtr Matrix = eMatrix; + ElementPtr pPivot; int Step, Size, ReorderingRequired; RealNumber LargestInCol; @@ -321,9 +321,9 @@ Done: * Error is cleared in this function. */ int -spFactor(MatrixPtr eMatrix) +spFactor(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; ElementPtr pColumn; int Step, Size; @@ -569,9 +569,9 @@ FactorComplexMatrix( MatrixPtr Matrix ) * spINDIRECT_PARTITION, or spAUTO_PARTITION. */ void -spPartition(MatrixPtr eMatrix, int Mode) +spPartition(MatrixPtr Matrix, int Mode) { - 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 cc5af829a..1d229aad0 100644 --- a/src/maths/sparse/spoutput.c +++ b/src/maths/sparse/spoutput.c @@ -135,9 +135,9 @@ int Printer_Width = PRINTER_WIDTH; */ void -spPrint(MatrixPtr eMatrix, int PrintReordered, int Data, int Header) +spPrint(MatrixPtr Matrix, int PrintReordered, int Data, int Header) { - MatrixPtr Matrix = eMatrix; + int J = 0; int I, Row, Col, Size, Top; int StartCol = 1, StopCol, Columns, ElementCount = 0; @@ -438,10 +438,10 @@ spPrint(MatrixPtr eMatrix, int PrintReordered, int Data, int Header) */ int -spFileMatrix(MatrixPtr eMatrix, char *File, char *Label, int Reordered, +spFileMatrix(MatrixPtr Matrix, char *File, char *Label, int Reordered, int Data, int Header) { - MatrixPtr Matrix = eMatrix; + int I, Size; ElementPtr pElement; int Row, Col, Err; @@ -597,9 +597,9 @@ spFileMatrix(MatrixPtr eMatrix, char *File, char *Label, int Reordered, */ int -spFileVector(MatrixPtr eMatrix, char *File, RealVector RHS, RealVector iRHS) +spFileVector(MatrixPtr Matrix, char *File, RealVector RHS, RealVector iRHS) { - MatrixPtr Matrix = eMatrix; + int I, Size, Err; FILE *pMatrixFile; @@ -688,9 +688,9 @@ spFileVector(MatrixPtr eMatrix, char *File, RealVector RHS, RealVector iRHS) */ int -spFileStats(MatrixPtr eMatrix, char *File, char *Label) +spFileStats(MatrixPtr Matrix, char *File, char *Label) { - 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 85607b185..1c8879d7e 100644 --- a/src/maths/sparse/spsmp.c +++ b/src/maths/sparse/spsmp.c @@ -420,9 +420,9 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) */ static void -LoadGmin(SMPmatrix *eMatrix, double Gmin) +LoadGmin(SMPmatrix *Matrix, double Gmin) { - MatrixPtr Matrix = eMatrix; + int I; ArrayOfElementPtrs Diag; ElementPtr diag; @@ -453,9 +453,9 @@ LoadGmin(SMPmatrix *eMatrix, double Gmin) */ SMPelement * -SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing) +SMPfindElt(SMPmatrix *Matrix, int Row, int Col, int CreateIfMissing) { - MatrixPtr Matrix = eMatrix; + ElementPtr Element; /* Begin `SMPfindElt'. */ @@ -473,9 +473,9 @@ SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing) * SMPcZeroCol() */ int -SMPcZeroCol(SMPmatrix *eMatrix, int Col) +SMPcZeroCol(SMPmatrix *Matrix, int Col) { - MatrixPtr Matrix = eMatrix; + ElementPtr Element; Col = Matrix->ExtToIntColMap[Col]; @@ -495,9 +495,9 @@ SMPcZeroCol(SMPmatrix *eMatrix, int Col) * SMPcAddCol() */ int -SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col) +SMPcAddCol(SMPmatrix *Matrix, int Accum_Col, int Addend_Col) { - MatrixPtr Matrix = eMatrix; + ElementPtr Accum, Addend, *Prev; Accum_Col = Matrix->ExtToIntColMap[Accum_Col]; @@ -527,9 +527,9 @@ SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col) * SMPzeroRow() */ int -SMPzeroRow(SMPmatrix *eMatrix, int Row) +SMPzeroRow(SMPmatrix *Matrix, int Row) { - MatrixPtr Matrix = eMatrix; + ElementPtr Element; Row = Matrix->ExtToIntColMap[Row]; diff --git a/src/maths/sparse/spsolve.c b/src/maths/sparse/spsolve.c index ca78f7133..01d37d1d7 100644 --- a/src/maths/sparse/spsolve.c +++ b/src/maths/sparse/spsolve.c @@ -124,10 +124,10 @@ static void SolveComplexTransposedMatrix( MatrixPtr, /*VARARGS3*/ void -spSolve(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, +spSolve(MatrixPtr Matrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; RealVector Intermediate; RealNumber Temp; @@ -400,10 +400,10 @@ SolveComplexMatrix( MatrixPtr Matrix, RealVector RHS, RealVector Solution , Real /*VARARGS3*/ void -spSolveTransposed(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, +spSolveTransposed(MatrixPtr Matrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { - 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 5e173e376..fda322218 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(MatrixPtr eMatrix) +spMNA_Preorder(MatrixPtr Matrix) { - 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(MatrixPtr eMatrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors) +spScale(MatrixPtr Matrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; int I, lSize, *pExtOrder; RealNumber ScaleFactor; @@ -571,14 +571,14 @@ MatrixPtr Matrix; */ void -spMultiply(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, +spMultiply(MatrixPtr Matrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { ElementPtr pElement; RealVector Vector; RealNumber Sum; int I, *pExtOrder; - 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(MatrixPtr eMatrix, RealVector RHS, RealVector Solution, +spMultTransposed(MatrixPtr Matrix, RealVector RHS, RealVector Solution, RealVector iRHS, RealVector iSolution) { ElementPtr pElement; RealVector Vector; RealNumber Sum; int I, *pExtOrder; - MatrixPtr Matrix = eMatrix; + /* Begin `spMultTransposed'. */ assert( IS_SPARSE( Matrix ) && !Matrix->Factored ); @@ -878,10 +878,10 @@ ComplexTransposedMatrixMultiply( MatrixPtr Matrix, RealVector RHS, RealVector So */ void -spDeterminant(MatrixPtr eMatrix, int *pExponent, RealNumber *pDeterminant, +spDeterminant(MatrixPtr Matrix, int *pExponent, RealNumber *pDeterminant, RealNumber *piDeterminant) { - MatrixPtr Matrix = eMatrix; + int I, Size; RealNumber Norm, nr, ni; ComplexNumber Pivot, cDeterminant; @@ -1037,9 +1037,9 @@ spDeterminant(MatrixPtr eMatrix, int *pExponent, RealNumber *pDeterminant, */ void -spStripFills(MatrixPtr eMatrix) +spStripFills(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + struct FillinListNodeStruct *pListNode; /* Begin `spStripFills'. */ @@ -1109,9 +1109,9 @@ spStripFills(MatrixPtr eMatrix) * frame. This assumes that the matrix will be replaced with one of * the same size. */ void -spStripMatrix(MatrixPtr eMatrix) +spStripMatrix(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + /* Begin `spStripMatrix'. */ assert( IS_SPARSE( Matrix ) ); @@ -1197,9 +1197,9 @@ spStripMatrix(MatrixPtr eMatrix) */ void -spDeleteRowAndCol(MatrixPtr eMatrix, int Row, int Col) +spDeleteRowAndCol(MatrixPtr Matrix, int Row, int Col) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement, *ppElement, pLastElement; int Size, ExtRow, ExtCol; ElementPtr spcFindElementInCol(); @@ -1310,9 +1310,9 @@ spDeleteRowAndCol(MatrixPtr eMatrix, int Row, int Col) * Pointer to the matrix. */ RealNumber -spPseudoCondition(MatrixPtr eMatrix) +spPseudoCondition(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + int I; ArrayOfElementPtrs Diag; RealNumber MaxPivot, MinPivot, Mag; @@ -1401,9 +1401,9 @@ spPseudoCondition(MatrixPtr eMatrix) * spNO_MEMORY */ RealNumber -spCondition(MatrixPtr eMatrix, RealNumber NormOfMatrix, int *pError) +spCondition(MatrixPtr Matrix, RealNumber NormOfMatrix, int *pError) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; RealVector T, Tm; int I, K, Row; @@ -1829,9 +1829,9 @@ int *pError; */ RealNumber -spNorm(MatrixPtr eMatrix) +spNorm(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; int I; RealNumber Max = 0.0, AbsRowSum; @@ -1947,9 +1947,9 @@ spNorm(MatrixPtr eMatrix) */ RealNumber -spLargestElement(MatrixPtr eMatrix) +spLargestElement(MatrixPtr Matrix) { - MatrixPtr Matrix = eMatrix; + int I; RealNumber Mag, AbsColSum, Max = 0.0, MaxRow = 0.0, MaxCol = 0.0; RealNumber Pivot; @@ -2076,9 +2076,9 @@ spLargestElement(MatrixPtr eMatrix) */ RealNumber -spRoundoff(MatrixPtr eMatrix, RealNumber Rho) +spRoundoff(MatrixPtr Matrix, RealNumber Rho) { - MatrixPtr Matrix = eMatrix; + ElementPtr pElement; int Count, I, MaxCount = 0; RealNumber Reid, Gear;