Browse Source

sparse/*.c, simplify, drop the local copy `Matrix'

pre-master-46
rlar 13 years ago
parent
commit
9c48863912
  1. 12
      src/maths/sparse/spalloc.c
  2. 16
      src/maths/sparse/spbuild.c
  3. 12
      src/maths/sparse/spfactor.c
  4. 16
      src/maths/sparse/spoutput.c
  5. 20
      src/maths/sparse/spsmp.c
  6. 8
      src/maths/sparse/spsolve.c
  7. 52
      src/maths/sparse/sputils.c

12
src/maths/sparse/spalloc.c

@ -646,9 +646,9 @@ AllocateBlockOfAllocationList(MatrixPtr Matrix)
*/ */
void void
spDestroy(MatrixPtr eMatrix)
spDestroy(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
AllocationListPtr ListPtr, NextListPtr; AllocationListPtr ListPtr, NextListPtr;
@ -741,9 +741,9 @@ spError(MatrixPtr eMatrix )
*/ */
void void
spWhereSingular(MatrixPtr eMatrix, int *pRow, int *pCol)
spWhereSingular(MatrixPtr Matrix, int *pRow, int *pCol)
{ {
MatrixPtr Matrix = eMatrix;
/* Begin `spWhereSingular'. */ /* Begin `spWhereSingular'. */
assert( IS_SPARSE( Matrix ) ); assert( IS_SPARSE( Matrix ) );
@ -779,9 +779,9 @@ spWhereSingular(MatrixPtr eMatrix, int *pRow, int *pCol)
*/ */
int int
spGetSize(MatrixPtr eMatrix, int External)
spGetSize(MatrixPtr Matrix, int External)
{ {
MatrixPtr Matrix = eMatrix;
/* Begin `spGetSize'. */ /* Begin `spGetSize'. */
assert( IS_SPARSE( Matrix ) ); assert( IS_SPARSE( Matrix ) );

16
src/maths/sparse/spbuild.c

@ -94,9 +94,9 @@ static void ExpandTranslationArrays( MatrixPtr, int );
*/ */
void void
spClear(MatrixPtr eMatrix)
spClear(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
int I; int I;
@ -181,9 +181,9 @@ spClear(MatrixPtr eMatrix)
*/ */
RealNumber * RealNumber *
spFindElement(MatrixPtr eMatrix, int Row, int Col)
spFindElement(MatrixPtr Matrix, int Row, int Col)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
/* Begin `spFindElement'. */ /* Begin `spFindElement'. */
@ -264,9 +264,9 @@ ElementPtr pElement;
*/ */
RealNumber * RealNumber *
spGetElement(MatrixPtr eMatrix, int Row, int Col)
spGetElement(MatrixPtr Matrix, int Row, int Col)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
/* Begin `spGetElement'. */ /* Begin `spGetElement'. */
@ -1146,9 +1146,9 @@ spGetInitInfo(RealNumber *pElement)
int 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; ElementPtr pElement;
int J, Error, Col; int J, Error, Col;

12
src/maths/sparse/spfactor.c

@ -189,10 +189,10 @@ static int ZeroPivot( MatrixPtr, int );
*/ */
int int
spOrderAndFactor(MatrixPtr eMatrix, RealNumber RHS[], RealNumber RelThreshold,
spOrderAndFactor(MatrixPtr Matrix, RealNumber RHS[], RealNumber RelThreshold,
RealNumber AbsThreshold, int DiagPivoting) RealNumber AbsThreshold, int DiagPivoting)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pPivot; ElementPtr pPivot;
int Step, Size, ReorderingRequired; int Step, Size, ReorderingRequired;
RealNumber LargestInCol; RealNumber LargestInCol;
@ -321,9 +321,9 @@ Done:
* Error is cleared in this function. */ * Error is cleared in this function. */
int int
spFactor(MatrixPtr eMatrix)
spFactor(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
ElementPtr pColumn; ElementPtr pColumn;
int Step, Size; int Step, Size;
@ -569,9 +569,9 @@ FactorComplexMatrix( MatrixPtr Matrix )
* spINDIRECT_PARTITION, or spAUTO_PARTITION. */ * spINDIRECT_PARTITION, or spAUTO_PARTITION. */
void void
spPartition(MatrixPtr eMatrix, int Mode)
spPartition(MatrixPtr Matrix, int Mode)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement, pColumn; ElementPtr pElement, pColumn;
int Step, Size; int Step, Size;
int *Nc, *No, *Nm; int *Nc, *No, *Nm;

16
src/maths/sparse/spoutput.c

@ -135,9 +135,9 @@ int Printer_Width = PRINTER_WIDTH;
*/ */
void 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 J = 0;
int I, Row, Col, Size, Top; int I, Row, Col, Size, Top;
int StartCol = 1, StopCol, Columns, ElementCount = 0; int StartCol = 1, StopCol, Columns, ElementCount = 0;
@ -438,10 +438,10 @@ spPrint(MatrixPtr eMatrix, int PrintReordered, int Data, int Header)
*/ */
int int
spFileMatrix(MatrixPtr eMatrix, char *File, char *Label, int Reordered,
spFileMatrix(MatrixPtr Matrix, char *File, char *Label, int Reordered,
int Data, int Header) int Data, int Header)
{ {
MatrixPtr Matrix = eMatrix;
int I, Size; int I, Size;
ElementPtr pElement; ElementPtr pElement;
int Row, Col, Err; int Row, Col, Err;
@ -597,9 +597,9 @@ spFileMatrix(MatrixPtr eMatrix, char *File, char *Label, int Reordered,
*/ */
int 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; int I, Size, Err;
FILE *pMatrixFile; FILE *pMatrixFile;
@ -688,9 +688,9 @@ spFileVector(MatrixPtr eMatrix, char *File, RealVector RHS, RealVector iRHS)
*/ */
int int
spFileStats(MatrixPtr eMatrix, char *File, char *Label)
spFileStats(MatrixPtr Matrix, char *File, char *Label)
{ {
MatrixPtr Matrix = eMatrix;
int Size, I; int Size, I;
ElementPtr pElement; ElementPtr pElement;
int NumberOfElements; int NumberOfElements;

20
src/maths/sparse/spsmp.c

@ -420,9 +420,9 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
*/ */
static void static void
LoadGmin(SMPmatrix *eMatrix, double Gmin)
LoadGmin(SMPmatrix *Matrix, double Gmin)
{ {
MatrixPtr Matrix = eMatrix;
int I; int I;
ArrayOfElementPtrs Diag; ArrayOfElementPtrs Diag;
ElementPtr diag; ElementPtr diag;
@ -453,9 +453,9 @@ LoadGmin(SMPmatrix *eMatrix, double Gmin)
*/ */
SMPelement * SMPelement *
SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing)
SMPfindElt(SMPmatrix *Matrix, int Row, int Col, int CreateIfMissing)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr Element; ElementPtr Element;
/* Begin `SMPfindElt'. */ /* Begin `SMPfindElt'. */
@ -473,9 +473,9 @@ SMPfindElt(SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing)
* SMPcZeroCol() * SMPcZeroCol()
*/ */
int int
SMPcZeroCol(SMPmatrix *eMatrix, int Col)
SMPcZeroCol(SMPmatrix *Matrix, int Col)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr Element; ElementPtr Element;
Col = Matrix->ExtToIntColMap[Col]; Col = Matrix->ExtToIntColMap[Col];
@ -495,9 +495,9 @@ SMPcZeroCol(SMPmatrix *eMatrix, int Col)
* SMPcAddCol() * SMPcAddCol()
*/ */
int 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; ElementPtr Accum, Addend, *Prev;
Accum_Col = Matrix->ExtToIntColMap[Accum_Col]; Accum_Col = Matrix->ExtToIntColMap[Accum_Col];
@ -527,9 +527,9 @@ SMPcAddCol(SMPmatrix *eMatrix, int Accum_Col, int Addend_Col)
* SMPzeroRow() * SMPzeroRow()
*/ */
int int
SMPzeroRow(SMPmatrix *eMatrix, int Row)
SMPzeroRow(SMPmatrix *Matrix, int Row)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr Element; ElementPtr Element;
Row = Matrix->ExtToIntColMap[Row]; Row = Matrix->ExtToIntColMap[Row];

8
src/maths/sparse/spsolve.c

@ -124,10 +124,10 @@ static void SolveComplexTransposedMatrix( MatrixPtr,
/*VARARGS3*/ /*VARARGS3*/
void void
spSolve(MatrixPtr eMatrix, RealVector RHS, RealVector Solution,
spSolve(MatrixPtr Matrix, RealVector RHS, RealVector Solution,
RealVector iRHS, RealVector iSolution) RealVector iRHS, RealVector iSolution)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
RealVector Intermediate; RealVector Intermediate;
RealNumber Temp; RealNumber Temp;
@ -400,10 +400,10 @@ SolveComplexMatrix( MatrixPtr Matrix, RealVector RHS, RealVector Solution , Real
/*VARARGS3*/ /*VARARGS3*/
void void
spSolveTransposed(MatrixPtr eMatrix, RealVector RHS, RealVector Solution,
spSolveTransposed(MatrixPtr Matrix, RealVector RHS, RealVector Solution,
RealVector iRHS, RealVector iSolution) RealVector iRHS, RealVector iSolution)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
RealVector Intermediate; RealVector Intermediate;
int I, *pExtOrder, Size; int I, *pExtOrder, Size;

52
src/maths/sparse/sputils.c

@ -174,9 +174,9 @@ static void ComplexTransposedMatrixMultiply( MatrixPtr, RealVector, RealVector,
*/ */
void void
spMNA_Preorder(MatrixPtr eMatrix)
spMNA_Preorder(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
int J, Size; int J, Size;
ElementPtr pTwin1, pTwin2; ElementPtr pTwin1, pTwin2;
int Twins, StartAt = 1; int Twins, StartAt = 1;
@ -368,9 +368,9 @@ SwapCols( MatrixPtr Matrix, ElementPtr pTwin1, ElementPtr pTwin2 )
*/ */
void void
spScale(MatrixPtr eMatrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors)
spScale(MatrixPtr Matrix, RealVector RHS_ScaleFactors, RealVector SolutionScaleFactors)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
int I, lSize, *pExtOrder; int I, lSize, *pExtOrder;
RealNumber ScaleFactor; RealNumber ScaleFactor;
@ -571,14 +571,14 @@ MatrixPtr Matrix;
*/ */
void void
spMultiply(MatrixPtr eMatrix, RealVector RHS, RealVector Solution,
spMultiply(MatrixPtr Matrix, RealVector RHS, RealVector Solution,
RealVector iRHS, RealVector iSolution) RealVector iRHS, RealVector iSolution)
{ {
ElementPtr pElement; ElementPtr pElement;
RealVector Vector; RealVector Vector;
RealNumber Sum; RealNumber Sum;
int I, *pExtOrder; int I, *pExtOrder;
MatrixPtr Matrix = eMatrix;
/* Begin `spMultiply'. */ /* Begin `spMultiply'. */
assert( IS_SPARSE( Matrix ) && !Matrix->Factored ); assert( IS_SPARSE( Matrix ) && !Matrix->Factored );
@ -717,14 +717,14 @@ ComplexMatrixMultiply( MatrixPtr Matrix, RealVector RHS, RealVector Solution , R
*/ */
void void
spMultTransposed(MatrixPtr eMatrix, RealVector RHS, RealVector Solution,
spMultTransposed(MatrixPtr Matrix, RealVector RHS, RealVector Solution,
RealVector iRHS, RealVector iSolution) RealVector iRHS, RealVector iSolution)
{ {
ElementPtr pElement; ElementPtr pElement;
RealVector Vector; RealVector Vector;
RealNumber Sum; RealNumber Sum;
int I, *pExtOrder; int I, *pExtOrder;
MatrixPtr Matrix = eMatrix;
/* Begin `spMultTransposed'. */ /* Begin `spMultTransposed'. */
assert( IS_SPARSE( Matrix ) && !Matrix->Factored ); assert( IS_SPARSE( Matrix ) && !Matrix->Factored );
@ -878,10 +878,10 @@ ComplexTransposedMatrixMultiply( MatrixPtr Matrix, RealVector RHS, RealVector So
*/ */
void void
spDeterminant(MatrixPtr eMatrix, int *pExponent, RealNumber *pDeterminant,
spDeterminant(MatrixPtr Matrix, int *pExponent, RealNumber *pDeterminant,
RealNumber *piDeterminant) RealNumber *piDeterminant)
{ {
MatrixPtr Matrix = eMatrix;
int I, Size; int I, Size;
RealNumber Norm, nr, ni; RealNumber Norm, nr, ni;
ComplexNumber Pivot, cDeterminant; ComplexNumber Pivot, cDeterminant;
@ -1037,9 +1037,9 @@ spDeterminant(MatrixPtr eMatrix, int *pExponent, RealNumber *pDeterminant,
*/ */
void void
spStripFills(MatrixPtr eMatrix)
spStripFills(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
struct FillinListNodeStruct *pListNode; struct FillinListNodeStruct *pListNode;
/* Begin `spStripFills'. */ /* Begin `spStripFills'. */
@ -1109,9 +1109,9 @@ spStripFills(MatrixPtr eMatrix)
* frame. This assumes that the matrix will be replaced with one of * frame. This assumes that the matrix will be replaced with one of
* the same size. */ * the same size. */
void void
spStripMatrix(MatrixPtr eMatrix)
spStripMatrix(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
/* Begin `spStripMatrix'. */ /* Begin `spStripMatrix'. */
assert( IS_SPARSE( Matrix ) ); assert( IS_SPARSE( Matrix ) );
@ -1197,9 +1197,9 @@ spStripMatrix(MatrixPtr eMatrix)
*/ */
void void
spDeleteRowAndCol(MatrixPtr eMatrix, int Row, int Col)
spDeleteRowAndCol(MatrixPtr Matrix, int Row, int Col)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement, *ppElement, pLastElement; ElementPtr pElement, *ppElement, pLastElement;
int Size, ExtRow, ExtCol; int Size, ExtRow, ExtCol;
ElementPtr spcFindElementInCol(); ElementPtr spcFindElementInCol();
@ -1310,9 +1310,9 @@ spDeleteRowAndCol(MatrixPtr eMatrix, int Row, int Col)
* Pointer to the matrix. */ * Pointer to the matrix. */
RealNumber RealNumber
spPseudoCondition(MatrixPtr eMatrix)
spPseudoCondition(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
int I; int I;
ArrayOfElementPtrs Diag; ArrayOfElementPtrs Diag;
RealNumber MaxPivot, MinPivot, Mag; RealNumber MaxPivot, MinPivot, Mag;
@ -1401,9 +1401,9 @@ spPseudoCondition(MatrixPtr eMatrix)
* spNO_MEMORY */ * spNO_MEMORY */
RealNumber RealNumber
spCondition(MatrixPtr eMatrix, RealNumber NormOfMatrix, int *pError)
spCondition(MatrixPtr Matrix, RealNumber NormOfMatrix, int *pError)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
RealVector T, Tm; RealVector T, Tm;
int I, K, Row; int I, K, Row;
@ -1829,9 +1829,9 @@ int *pError;
*/ */
RealNumber RealNumber
spNorm(MatrixPtr eMatrix)
spNorm(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
int I; int I;
RealNumber Max = 0.0, AbsRowSum; RealNumber Max = 0.0, AbsRowSum;
@ -1947,9 +1947,9 @@ spNorm(MatrixPtr eMatrix)
*/ */
RealNumber RealNumber
spLargestElement(MatrixPtr eMatrix)
spLargestElement(MatrixPtr Matrix)
{ {
MatrixPtr Matrix = eMatrix;
int I; int I;
RealNumber Mag, AbsColSum, Max = 0.0, MaxRow = 0.0, MaxCol = 0.0; RealNumber Mag, AbsColSum, Max = 0.0, MaxRow = 0.0, MaxCol = 0.0;
RealNumber Pivot; RealNumber Pivot;
@ -2076,9 +2076,9 @@ spLargestElement(MatrixPtr eMatrix)
*/ */
RealNumber RealNumber
spRoundoff(MatrixPtr eMatrix, RealNumber Rho)
spRoundoff(MatrixPtr Matrix, RealNumber Rho)
{ {
MatrixPtr Matrix = eMatrix;
ElementPtr pElement; ElementPtr pElement;
int Count, I, MaxCount = 0; int Count, I, MaxCount = 0;
RealNumber Reid, Gear; RealNumber Reid, Gear;

Loading…
Cancel
Save