diff --git a/src/sparse13/spalloc.cpp b/src/sparse13/spalloc.cpp
index ab85ebefd9..233093c61f 100644
--- a/src/sparse13/spalloc.cpp
+++ b/src/sparse13/spalloc.cpp
@@ -15,7 +15,6 @@
* spWhereSingular
* spGetSize
* spSetReal
- * spSetComplex
* spFillinCount
* spElementCount
*
@@ -45,11 +44,6 @@
* or implied warranty.
*/
-#ifndef lint
-static char copyright[] = "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
-static char RCSid[] = "@(#)$Header$";
-#endif
-
/*
* IMPORTS
*
@@ -126,12 +120,10 @@ char* spCreate(int Size, BOOLEAN Complex, int* pError)
}
/* Test for valid type. */
-#if NOT spCOMPLEX
if (Complex) {
*pError = spPANIC;
return NULL;
}
-#endif
#if NOT REAL
if (NOT Complex) {
*pError = spPANIC;
@@ -193,9 +185,6 @@ char* spCreate(int Size, BOOLEAN Complex, int* pError)
/* Take out the trash. */
Matrix->TrashCan.Real = 0.0;
-#if spCOMPLEX
- Matrix->TrashCan.Imag = 0.0;
-#endif
Matrix->TrashCan.Row = 0;
Matrix->TrashCan.Col = 0;
Matrix->TrashCan.NextInRow = NULL;
@@ -233,24 +222,6 @@ char* spCreate(int Size, BOOLEAN Complex, int* pError)
Matrix->IntToExtColMap[I] = I;
}
-#if TRANSLATE
- /* Allocate space in memory for ExtToIntColMap vector. */
- if ((Matrix->ExtToIntColMap = ALLOC(int, SizePlusOne)) == NULL)
- goto MemoryError;
-
- /* Allocate space in memory for ExtToIntRowMap vector. */
- if ((Matrix->ExtToIntRowMap = ALLOC(int, SizePlusOne)) == NULL)
- goto MemoryError;
-
- /* Initialize MapExtToInt vectors. */
- for (I = 1; I <= AllocatedSize; I++) {
- Matrix->ExtToIntColMap[I] = -1;
- Matrix->ExtToIntRowMap[I] = -1;
- }
- Matrix->ExtToIntColMap[0] = 0;
- Matrix->ExtToIntRowMap[0] = 0;
-#endif
-
/* Allocate space for fill-ins and initial set of elements. */
InitializeElementBlocks(Matrix, SPACE_FOR_ELEMENTS * AllocatedSize,
SPACE_FOR_FILL_INS * AllocatedSize);
@@ -671,14 +642,7 @@ int spGetSize(char* eMatrix, BOOLEAN External)
/* Begin `spGetSize'. */
ASSERT(IS_SPARSE(Matrix));
-#if TRANSLATE
- if (External)
- return Matrix->ExtSize;
- else
- return Matrix->Size;
-#else
return Matrix->Size;
-#endif
}
/*
@@ -700,15 +664,6 @@ void spSetReal(char* eMatrix)
return;
}
-void spSetComplex(char* eMatrix)
-{
- /* Begin `spSetComplex'. */
-
- ASSERT(IS_SPARSE((MatrixPtr)eMatrix) AND spCOMPLEX);
- ((MatrixPtr)eMatrix)->Complex = YES;
- return;
-}
-
/*
* ELEMENT OR FILL-IN COUNT
*
diff --git a/src/sparse13/spbuild.cpp b/src/sparse13/spbuild.cpp
index 3b7e9a1da2..f0a5867609 100644
--- a/src/sparse13/spbuild.cpp
+++ b/src/sparse13/spbuild.cpp
@@ -20,11 +20,9 @@
*
* >>> Other functions contained in this file:
* spcFindElementInCol
- * Translate
* spcCreateElement
* spcLinkRows
* EnlargeMatrix
- * ExpandTranslationArrays
*/
/*
@@ -43,11 +41,6 @@
* or implied warranty.
*/
-#ifndef lint
-static char copyright[] = "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
-static char RCSid[] = "@(#)$Header$";
-#endif
-
/*
* IMPORTS
*
@@ -70,9 +63,7 @@ static char RCSid[] = "@(#)$Header$";
extern ElementPtr spcGetFillin(MatrixPtr Matrix);
extern ElementPtr spcGetElement(MatrixPtr Matrix);
-static void Translate(MatrixPtr Matrix, int* Row, int* Col);
static void EnlargeMatrix(MatrixPtr Matrix, int NewSize);
-static void ExpandTranslationArrays(MatrixPtr Matrix, int NewSize);
/*
* CLEAR MATRIX
@@ -98,18 +89,6 @@ void spClear(char* eMatrix)
ASSERT(IS_SPARSE(Matrix));
/* Clear matrix. */
-#if spCOMPLEX
- if (Matrix->PreviousMatrixWasComplex OR Matrix->Complex) {
- for (I = Matrix->Size; I > 0; I--) {
- pElement = Matrix->FirstInCol[I];
- while (pElement != NULL) {
- pElement->Real = 0.0;
- pElement->Imag = 0.0;
- pElement = pElement->NextInCol;
- }
- }
- } else
-#endif
{
for (I = Matrix->Size; I > 0; I--) {
pElement = Matrix->FirstInCol[I];
@@ -122,9 +101,6 @@ void spClear(char* eMatrix)
/* Empty the trash. */
Matrix->TrashCan.Real = 0.0;
-#if spCOMPLEX
- Matrix->TrashCan.Imag = 0.0;
-#endif
Matrix->Error = spOKAY;
Matrix->Factored = NO;
@@ -183,17 +159,8 @@ RealNumber* spGetElement(char* eMatrix, int Row, int Col)
if ((Row == 0) OR(Col == 0))
return &Matrix->TrashCan.Real;
-#if NOT TRANSLATE
ASSERT(Matrix->NeedsOrdering);
-#endif
-
-#if TRANSLATE
- Translate(Matrix, &Row, &Col);
- if (Matrix->Error == spNO_MEMORY)
- return NULL;
-#endif
-#if NOT TRANSLATE
#if NOT EXPANDABLE
ASSERT(Row <= Matrix->Size AND Col <= Matrix->Size);
#endif
@@ -204,7 +171,6 @@ RealNumber* spGetElement(char* eMatrix, int Row, int Col)
EnlargeMatrix(Matrix, MAX(Row, Col));
if (Matrix->Error == spNO_MEMORY)
return NULL;
-#endif
#endif
/*
@@ -290,109 +256,6 @@ ElementPtr spcFindElementInCol(MatrixPtr Matrix, ElementPtr* LastAddr, int Row,
return NULL;
}
-#if TRANSLATE
-
-/*
- * TRANSLATE EXTERNAL INDICES TO INTERNAL
- *
- * Convert internal row and column numbers to internal row and column numbers.
- * Also updates Ext/Int maps.
- *
- *
- * >>> Arguments:
- * Matrix (MatrixPtr)
- * Pointer to the matrix.
- * Row (int *)
- * Upon entry Row is either a external row number of an external node
- * number. Upon entry, the internal equivalent is supplied.
- * Col (int *)
- * Upon entry Column is either a external column number of an external node
- * number. Upon entry, the internal equivalent is supplied.
- *
- * >>> Local variables:
- * ExtCol (int)
- * Temporary variable used to hold the external column or node number
- * during the external to internal column number translation.
- * ExtRow (int)
- * Temporary variable used to hold the external row or node number during
- * the external to internal row number translation.
- * IntCol (int)
- * Temporary variable used to hold the internal column or node number
- * during the external to internal column number translation.
- * IntRow (int)
- * Temporary variable used to hold the internal row or node number during
- * the external to internal row number translation.
- */
-
-static void Translate(MatrixPtr Matrix, int* Row, int* Col)
-{
- int IntRow, IntCol, ExtRow, ExtCol;
-
- /* Begin `Translate'. */
- ExtRow = *Row;
- ExtCol = *Col;
-
- /* Expand translation arrays if necessary. */
- if ((ExtRow > Matrix->AllocatedExtSize) OR(ExtCol > Matrix->AllocatedExtSize)) {
- ExpandTranslationArrays(Matrix, MAX(ExtRow, ExtCol));
- if (Matrix->Error == spNO_MEMORY)
- return;
- }
-
- /* Set ExtSize if necessary. */
- if ((ExtRow > Matrix->ExtSize) OR(ExtCol > Matrix->ExtSize))
- Matrix->ExtSize = MAX(ExtRow, ExtCol);
-
- /* Translate external row or node number to internal row or node number. */
- if ((IntRow = Matrix->ExtToIntRowMap[ExtRow]) == -1) {
- Matrix->ExtToIntRowMap[ExtRow] = ++Matrix->CurrentSize;
- Matrix->ExtToIntColMap[ExtRow] = Matrix->CurrentSize;
- IntRow = Matrix->CurrentSize;
-
-#if NOT EXPANDABLE
- ASSERT(IntRow <= Matrix->Size);
-#endif
-
-#if EXPANDABLE
- /* Re-size Matrix if necessary. */
- if (IntRow > Matrix->Size)
- EnlargeMatrix(Matrix, IntRow);
- if (Matrix->Error == spNO_MEMORY)
- return;
-#endif
-
- Matrix->IntToExtRowMap[IntRow] = ExtRow;
- Matrix->IntToExtColMap[IntRow] = ExtRow;
- }
-
- /* Translate external column or node number to internal column or node number.*/
- if ((IntCol = Matrix->ExtToIntColMap[ExtCol]) == -1) {
- Matrix->ExtToIntRowMap[ExtCol] = ++Matrix->CurrentSize;
- Matrix->ExtToIntColMap[ExtCol] = Matrix->CurrentSize;
- IntCol = Matrix->CurrentSize;
-
-#if NOT EXPANDABLE
- ASSERT(IntCol <= Matrix->Size);
-#endif
-
-#if EXPANDABLE
- /* Re-size Matrix if necessary. */
- if (IntCol > Matrix->Size)
- EnlargeMatrix(Matrix, IntCol);
- if (Matrix->Error == spNO_MEMORY)
- return;
-#endif
-
- Matrix->IntToExtRowMap[IntCol] = ExtCol;
- Matrix->IntToExtColMap[IntCol] = ExtCol;
- }
-
- *Row = IntRow;
- *Col = IntCol;
- return;
-}
-#endif
-
#if QUAD_ELEMENT
/*
* ADDITION OF ADMITTANCE TO MATRIX BY INDEX
@@ -649,9 +512,6 @@ ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr* Last
pElement->Row = Row;
pElement->Col = Col;
pElement->Real = 0.0;
-#if spCOMPLEX
- pElement->Imag = 0.0;
-#endif
#if INITIALIZE
pElement->pInitInfo = NULL;
#endif
@@ -708,9 +568,6 @@ ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr* Last
pElement->Col = Col;
#endif
pElement->Real = 0.0;
-#if spCOMPLEX
- pElement->Imag = 0.0;
-#endif
#if INITIALIZE
pElement->pInitInfo = NULL;
#endif
@@ -847,58 +704,6 @@ static void EnlargeMatrix(MatrixPtr Matrix, int NewSize)
return;
}
-#if TRANSLATE
-
-/*
- * EXPAND TRANSLATION ARRAYS
- *
- * Increases the size arrays that are used to translate external to internal
- * row and column numbers.
- *
- * >>> Arguments:
- * Matrix (MatrixPtr)
- * Pointer to the matrix.
- * NewSize (int)
- * The new size of the translation arrays.
- *
- * >>> Local variables:
- * OldAllocatedSize (int)
- * The allocated size of the translation arrays before being expanded.
- */
-
-static void ExpandTranslationArrays(MatrixPtr Matrix, int NewSize)
-{
- int I, OldAllocatedSize = Matrix->AllocatedExtSize;
-
- /* Begin `ExpandTranslationArrays'. */
- Matrix->ExtSize = NewSize;
-
- if (NewSize <= OldAllocatedSize)
- return;
-
- /* Expand the translation arrays ExtToIntRowMap and ExtToIntColMap. */
- NewSize = MAX(NewSize, EXPANSION_FACTOR * OldAllocatedSize);
- Matrix->AllocatedExtSize = NewSize;
-
- if ((REALLOC(Matrix->ExtToIntRowMap, int, NewSize + 1)) == NULL) {
- Matrix->Error = spNO_MEMORY;
- return;
- }
- if ((REALLOC(Matrix->ExtToIntColMap, int, NewSize + 1)) == NULL) {
- Matrix->Error = spNO_MEMORY;
- return;
- }
-
- /* Initialize the new portion of the vectors. */
- for (I = OldAllocatedSize + 1; I <= NewSize; I++) {
- Matrix->ExtToIntRowMap[I] = -1;
- Matrix->ExtToIntColMap[I] = -1;
- }
-
- return;
-}
-#endif
-
#if INITIALIZE
/*
* INITIALIZE MATRIX
@@ -960,18 +765,6 @@ int (*pInit)();
/* Begin `spInitialize'. */
ASSERT(IS_SPARSE(Matrix));
-#if spCOMPLEX
- /* Clear imaginary part of matrix if matrix is real but was complex. */
- if (Matrix->PreviousMatrixWasComplex AND NOT Matrix->Complex) {
- for (J = Matrix->Size; J > 0; J--) {
- pElement = Matrix->FirstInCol[J];
- while (pElement != NULL) {
- pElement->Imag = 0.0;
- pElement = pElement->NextInCol;
- }
- }
- }
-#endif /* spCOMPLEX */
/* Initialize the matrix. */
for (J = Matrix->Size; J > 0; J--) {
@@ -980,9 +773,6 @@ int (*pInit)();
while (pElement != NULL) {
if (pElement->pInitInfo == NULL) {
pElement->Real = 0.0;
-#if spCOMPLEX
- pElement->Imag = 0.0;
-#endif
} else {
Error = (*pInit)((RealNumber*)pElement, pElement->pInitInfo,
Matrix->IntToExtRowMap[pElement->Row], Col);
@@ -997,9 +787,6 @@ int (*pInit)();
/* Empty the trash. */
Matrix->TrashCan.Real = 0.0;
-#if spCOMPLEX
- Matrix->TrashCan.Imag = 0.0;
-#endif
Matrix->Error = spOKAY;
Matrix->Factored = NO;
diff --git a/src/sparse13/spconfig.h b/src/sparse13/spconfig.h
index ae52e16216..22cd3f9dcf 100644
--- a/src/sparse13/spconfig.h
+++ b/src/sparse13/spconfig.h
@@ -67,9 +67,6 @@
* both real and complex systems at the same time, but there is a
* slight speed and memory advantage if the routines are complied
* to handle only real systems of equations.
- * spCOMPLEX
- * This specifies that the routines will be complied to handle
- * complex systems of equations.
* EXPANDABLE
* Setting this compiler flag true (1) makes the matrix
* expandable before it has been factored. If the matrix is
@@ -140,16 +137,6 @@
* must have an allocated length of one plus the size of the
* matrix. ARRAY_OFFSET must be either 0 or 1, no other offsets
* are valid.
- * spSEPARATED_COMPLEX_VECTORS
- * This specifies the format for complex vectors. If this is set
- * false then a complex vector is made up of one double sized
- * array of RealNumber's in which the real and imaginary numbers
- * are placed in the alternately array in the array. In other
- * words, the first entry would be Complex[1].Real, then comes
- * Complex[1].Imag, then Complex[1].Real, etc. If
- * spSEPARATED_COMPLEX_VECTORS is set true, then each complex
- * vector is represented by two arrays of RealNumbers, one with
- * the real terms, the other with the imaginary. [NO]
* MODIFIED_MARKOWITZ
* This specifies that the modified Markowitz method of pivot
* selection is to be used. The modified Markowitz method differs
@@ -243,12 +230,6 @@
/* Begin options. */
#define REAL YES
#define EXPANDABLE YES
-#if defined(cmplx_spPrefix)
-/* NEURON's nonlinz.cpp uses cmplx_spGetElement after previous use of matrix */
-#define TRANSLATE YES
-#else
-#define TRANSLATE NO /* instead of YES */
-#endif
#define INITIALIZE NO /* instead of YES */
#define DIAGONAL_PIVOTING YES
#define ARRAY_OFFSET NOT FORTRAN
@@ -275,13 +256,6 @@
* with user code, so use 0 for NO and 1 for YES.
*/
#endif /* spINSIDE_SPARSE */
-#if defined(cmplx_spPrefix)
-#define spCOMPLEX 1
-#define spSEPARATED_COMPLEX_VECTORS 1
-#else
-#define spCOMPLEX 0 /* instead of 1 */
-#define spSEPARATED_COMPLEX_VECTORS 0
-#endif
#ifdef spINSIDE_SPARSE
/*
diff --git a/src/sparse13/spdefs.h b/src/sparse13/spdefs.h
index f7977c77ad..78ae57ea8b 100644
--- a/src/sparse13/spdefs.h
+++ b/src/sparse13/spdefs.h
@@ -41,7 +41,6 @@
#ifdef lint
#undef REAL
-#undef spCOMPLEX
#undef EXPANDABLE
#undef TRANSLATE
#undef INITIALIZE
@@ -60,7 +59,6 @@
#undef DEBUG
#define REAL YES
-#define spCOMPLEX YES
#define EXPANDABLE YES
#define TRANSLATE YES
#define INITIALIZE YES
@@ -133,225 +131,7 @@
}
/* Macro function that returns the approx absolute value of a complex number. */
-#if spCOMPLEX
-#define ELEMENT_MAG(ptr) (ABS((ptr)->Real) + ABS((ptr)->Imag))
-#else
#define ELEMENT_MAG(ptr) ((ptr)->Real < 0.0 ? -(ptr)->Real : (ptr)->Real)
-#endif
-
-/* Complex assignment statements. */
-#define CMPLX_ASSIGN(to, from) \
- { \
- (to).Real = (from).Real; \
- (to).Imag = (from).Imag; \
- }
-#define CMPLX_CONJ_ASSIGN(to, from) \
- { \
- (to).Real = (from).Real; \
- (to).Imag = -(from).Imag; \
- }
-#define CMPLX_NEGATE_ASSIGN(to, from) \
- { \
- (to).Real = -(from).Real; \
- (to).Imag = -(from).Imag; \
- }
-#define CMPLX_CONJ_NEGATE_ASSIGN(to, from) \
- { \
- (to).Real = -(from).Real; \
- (to).Imag = (from).Imag; \
- }
-#define CMPLX_CONJ(a) (a).Imag = -(a).Imag
-#define CMPLX_NEGATE(a) \
- { \
- (a).Real = -(a).Real; \
- (a).Imag = -(a).Imag; \
- }
-
-/* Macro that returns the approx magnitude (L-1 norm) of a complex number. */
-#define CMPLX_1_NORM(a) (ABS((a).Real) + ABS((a).Imag))
-
-/* Macro that returns the approx magnitude (L-infinity norm) of a complex. */
-#define CMPLX_INF_NORM(a) (MAX(ABS((a).Real), ABS((a).Imag)))
-
-/* Macro function that returns the magnitude (L-2 norm) of a complex number. */
-#define CMPLX_2_NORM(a) (sqrt((a).Real * (a).Real + (a).Imag * (a).Imag))
-
-/* Macro function that performs complex addition. */
-#define CMPLX_ADD(to, from_a, from_b) \
- { \
- (to).Real = (from_a).Real + (from_b).Real; \
- (to).Imag = (from_a).Imag + (from_b).Imag; \
- }
-
-/* Macro function that performs complex subtraction. */
-#define CMPLX_SUBT(to, from_a, from_b) \
- { \
- (to).Real = (from_a).Real - (from_b).Real; \
- (to).Imag = (from_a).Imag - (from_b).Imag; \
- }
-
-/* Macro function that is equivalent to += operator for complex numbers. */
-#define CMPLX_ADD_ASSIGN(to, from) \
- { \
- (to).Real += (from).Real; \
- (to).Imag += (from).Imag; \
- }
-
-/* Macro function that is equivalent to -= operator for complex numbers. */
-#define CMPLX_SUBT_ASSIGN(to, from) \
- { \
- (to).Real -= (from).Real; \
- (to).Imag -= (from).Imag; \
- }
-
-/* Macro function that multiplies a complex number by a scalar. */
-#define SCLR_MULT(to, sclr, cmplx) \
- { \
- (to).Real = (sclr) * (cmplx).Real; \
- (to).Imag = (sclr) * (cmplx).Imag; \
- }
-
-/* Macro function that multiply-assigns a complex number by a scalar. */
-#define SCLR_MULT_ASSIGN(to, sclr) \
- { \
- (to).Real *= (sclr); \
- (to).Imag *= (sclr); \
- }
-
-/* Macro function that multiplies two complex numbers. */
-#define CMPLX_MULT(to, from_a, from_b) \
- { \
- (to).Real = (from_a).Real * (from_b).Real - (from_a).Imag * (from_b).Imag; \
- (to).Imag = (from_a).Real * (from_b).Imag + (from_a).Imag * (from_b).Real; \
- }
-
-/* Macro function that implements to *= from for complex numbers. */
-#define CMPLX_MULT_ASSIGN(to, from) \
- { \
- RealNumber to_real_ = (to).Real; \
- (to).Real = to_real_ * (from).Real - (to).Imag * (from).Imag; \
- (to).Imag = to_real_ * (from).Imag + (to).Imag * (from).Real; \
- }
-
-/* Macro function that multiplies two complex numbers, the first of which is
- * conjugated. */
-#define CMPLX_CONJ_MULT(to, from_a, from_b) \
- { \
- (to).Real = (from_a).Real * (from_b).Real + (from_a).Imag * (from_b).Imag; \
- (to).Imag = (from_a).Real * (from_b).Imag - (from_a).Imag * (from_b).Real; \
- }
-
-/* Macro function that multiplies two complex numbers and then adds them
- * to another. to = add + mult_a * mult_b */
-#define CMPLX_MULT_ADD(to, mult_a, mult_b, add) \
- { \
- (to).Real = (mult_a).Real * (mult_b).Real - (mult_a).Imag * (mult_b).Imag + (add).Real; \
- (to).Imag = (mult_a).Real * (mult_b).Imag + (mult_a).Imag * (mult_b).Real + (add).Imag; \
- }
-
-/* Macro function that subtracts the product of two complex numbers from
- * another. to = subt - mult_a * mult_b */
-#define CMPLX_MULT_SUBT(to, mult_a, mult_b, subt) \
- { \
- (to).Real = (subt).Real - (mult_a).Real * (mult_b).Real + (mult_a).Imag * (mult_b).Imag; \
- (to).Imag = (subt).Imag - (mult_a).Real * (mult_b).Imag - (mult_a).Imag * (mult_b).Real; \
- }
-
-/* Macro function that multiplies two complex numbers and then adds them
- * to another. to = add + mult_a* * mult_b where mult_a* represents mult_a
- * conjugate. */
-#define CMPLX_CONJ_MULT_ADD(to, mult_a, mult_b, add) \
- { \
- (to).Real = (mult_a).Real * (mult_b).Real + (mult_a).Imag * (mult_b).Imag + (add).Real; \
- (to).Imag = (mult_a).Real * (mult_b).Imag - (mult_a).Imag * (mult_b).Real + (add).Imag; \
- }
-
-/* Macro function that multiplies two complex numbers and then adds them
- * to another. to += mult_a * mult_b */
-#define CMPLX_MULT_ADD_ASSIGN(to, from_a, from_b) \
- { \
- (to).Real += (from_a).Real * (from_b).Real - (from_a).Imag * (from_b).Imag; \
- (to).Imag += (from_a).Real * (from_b).Imag + (from_a).Imag * (from_b).Real; \
- }
-
-/* Macro function that multiplies two complex numbers and then subtracts them
- * from another. */
-#define CMPLX_MULT_SUBT_ASSIGN(to, from_a, from_b) \
- { \
- (to).Real -= (from_a).Real * (from_b).Real - (from_a).Imag * (from_b).Imag; \
- (to).Imag -= (from_a).Real * (from_b).Imag + (from_a).Imag * (from_b).Real; \
- }
-
-/* Macro function that multiplies two complex numbers and then adds them
- * to the destination. to += from_a* * from_b where from_a* represents from_a
- * conjugate. */
-#define CMPLX_CONJ_MULT_ADD_ASSIGN(to, from_a, from_b) \
- { \
- (to).Real += (from_a).Real * (from_b).Real + (from_a).Imag * (from_b).Imag; \
- (to).Imag += (from_a).Real * (from_b).Imag - (from_a).Imag * (from_b).Real; \
- }
-
-/* Macro function that multiplies two complex numbers and then subtracts them
- * from the destination. to -= from_a* * from_b where from_a* represents from_a
- * conjugate. */
-#define CMPLX_CONJ_MULT_SUBT_ASSIGN(to, from_a, from_b) \
- { \
- (to).Real -= (from_a).Real * (from_b).Real + (from_a).Imag * (from_b).Imag; \
- (to).Imag -= (from_a).Real * (from_b).Imag - (from_a).Imag * (from_b).Real; \
- }
-
-/*
- * Macro functions that provide complex division.
- */
-
-/* Complex division: to = num / den */
-#define CMPLX_DIV(to, num, den) \
- { \
- RealNumber r_, s_; \
- if (((den).Real >= (den).Imag AND(den).Real > -(den).Imag) OR((den).Real < (den).Imag AND(den).Real <= -(den).Imag)) { \
- r_ = (den).Imag / (den).Real; \
- s_ = (den).Real + r_ * (den).Imag; \
- (to).Real = ((num).Real + r_ * (num).Imag) / s_; \
- (to).Imag = ((num).Imag - r_ * (num).Real) / s_; \
- } else { \
- r_ = (den).Real / (den).Imag; \
- s_ = (den).Imag + r_ * (den).Real; \
- (to).Real = (r_ * (num).Real + (num).Imag) / s_; \
- (to).Imag = (r_ * (num).Imag - (num).Real) / s_; \
- } \
- }
-
-/* Complex division and assignment: num /= den */
-#define CMPLX_DIV_ASSIGN(num, den) \
- { \
- RealNumber r_, s_, t_; \
- if (((den).Real >= (den).Imag AND(den).Real > -(den).Imag) OR((den).Real < (den).Imag AND(den).Real <= -(den).Imag)) { \
- r_ = (den).Imag / (den).Real; \
- s_ = (den).Real + r_ * (den).Imag; \
- t_ = ((num).Real + r_ * (num).Imag) / s_; \
- (num).Imag = ((num).Imag - r_ * (num).Real) / s_; \
- (num).Real = t_; \
- } else { \
- r_ = (den).Real / (den).Imag; \
- s_ = (den).Imag + r_ * (den).Real; \
- t_ = (r_ * (num).Real + (num).Imag) / s_; \
- (num).Imag = (r_ * (num).Imag - (num).Real) / s_; \
- (num).Real = t_; \
- } \
- }
-
-/* Complex reciprocation: to = 1.0 / den */
-#define CMPLX_RECIPROCAL(to, den) \
- { \
- RealNumber r_; \
- if (((den).Real >= (den).Imag AND(den).Real > -(den).Imag) OR((den).Real < (den).Imag AND(den).Real <= -(den).Imag)) { \
- r_ = (den).Imag / (den).Real; \
- (to).Imag = -r_ * ((to).Real = 1.0 / ((den).Real + r_ * (den).Imag)); \
- } else { \
- r_ = (den).Real / (den).Imag; \
- (to).Real = -r_ * ((to).Imag = -1.0 / ((den).Imag + r_ * (den).Real)); \
- } \
- }
/*
* ASSERT and ABORT
@@ -421,26 +201,6 @@
typedef spREAL RealNumber, *RealVector;
-/*
- * COMPLEX NUMBER DATA STRUCTURE
- *
- * >>> Structure fields:
- * Real (RealNumber)
- * The real portion of the number. Real must be the first
- * field in this structure.
- * Imag (RealNumber)
- * The imaginary portion of the number. This field must follow
- * immediately after Real.
- */
-
-/* Begin `ComplexNumber'. */
-
-typedef struct
-{
- RealNumber Real;
- RealNumber Imag;
-} ComplexNumber, *ComplexVector;
-
/*
* MATRIX ELEMENT DATA STRUCTURE
*
@@ -455,11 +215,6 @@ typedef struct
* Real (RealNumber)
* The real portion of the value of the element. Real must be the first
* field in this structure.
- * Imag (RealNumber)
- * The imaginary portion of the value of the element. If the matrix
- * routines are not compiled to handle complex matrices, then this
- * field does not exist. If it exists, it must follow immediately after
- * Real.
* Row (int)
* The row number of the element.
* Col (int)
@@ -488,9 +243,6 @@ typedef struct
struct MatrixElement {
RealNumber Real;
-#if spCOMPLEX
- RealNumber Imag;
-#endif
int Row;
int Col;
struct MatrixElement* NextInRow;
diff --git a/src/sparse13/spfactor.cpp b/src/sparse13/spfactor.cpp
index c3f960f6f4..f01c612deb 100644
--- a/src/sparse13/spfactor.cpp
+++ b/src/sparse13/spfactor.cpp
@@ -13,7 +13,6 @@
* spPartition
*
* >>> Other functions contained in this file:
- * FactorComplexMatrix CreateInternalVectors
* CountMarkowitz MarkowitzProducts
* SearchForPivot SearchForSingleton
* QuicklySearchDiagonal SearchDiagonal
@@ -21,7 +20,7 @@
* FindBiggestInColExclude ExchangeRowsAndCols
* spcRowExchange spcColExchange
* ExchangeColElements ExchangeRowElements
- * RealRowColElimination ComplexRowColElimination
+ * RealRowColElimination
* UpdateMarkowitzNumbers CreateFillin
* MatrixIsSingular ZeroPivot
* WriteStatus
@@ -43,11 +42,6 @@
* or implied warranty.
*/
-#ifndef lint
-static char copyright[] = "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
-static char RCSid[] = "@(#)$Header$";
-#endif
-
/*
* IMPORTS
*
@@ -67,7 +61,6 @@ static char RCSid[] = "@(#)$Header$";
#include
/* avoid "declared implicitly `extern' and later `static' " warnings. */
-static int FactorComplexMatrix(MatrixPtr Matrix);
static void CreateInternalVectors(MatrixPtr Matrix);
static void CountMarkowitz(MatrixPtr Matrix, RealVector RHS, int Step);
static void MarkowitzProducts(MatrixPtr Matrix, int Step);
@@ -82,7 +75,6 @@ static void ExchangeRowsAndCols(MatrixPtr Matrix, ElementPtr pPivot, int Step);
static void ExchangeColElements(MatrixPtr Matrix, int Row1, ElementPtr Element1, int Row2, ElementPtr Element2, int Column);
static void ExchangeRowElements(MatrixPtr Matrix, int Col1, ElementPtr Element1, int Col2, ElementPtr Element2, int Row);
static void RealRowColElimination(MatrixPtr Matrix, ElementPtr pPivot);
-static void ComplexRowColElimination(MatrixPtr Matrix, ElementPtr pPivot);
static void UpdateMarkowitzNumbers(MatrixPtr Matrix, ElementPtr pPivot);
static ElementPtr CreateFillin(MatrixPtr Matrix, int Row, int Col);
static int MatrixIsSingular(MatrixPtr Matrix, int Step);
@@ -215,10 +207,7 @@ int spOrderAndFactor(char* eMatrix, RealNumber* RHS, RealNumber RelThreshold, Re
pPivot = Matrix->Diag[Step];
LargestInCol = FindLargestInCol(pPivot->NextInCol);
if ((LargestInCol * RelThreshold < ELEMENT_MAG(pPivot))) {
- if (Matrix->Complex)
- ComplexRowColElimination(Matrix, pPivot);
- else
- RealRowColElimination(Matrix, pPivot);
+ RealRowColElimination(Matrix, pPivot);
} else {
ReorderingRequired = YES;
break; /* for loop */
@@ -265,10 +254,7 @@ int spOrderAndFactor(char* eMatrix, RealNumber* RHS, RealNumber RelThreshold, Re
return MatrixIsSingular(Matrix, Step);
ExchangeRowsAndCols(Matrix, pPivot, Step);
- if (Matrix->Complex)
- ComplexRowColElimination(Matrix, pPivot);
- else
- RealRowColElimination(Matrix, pPivot);
+ RealRowColElimination(Matrix, pPivot);
if (Matrix->Error >= spFATAL)
return Matrix->Error;
@@ -335,10 +321,6 @@ int spFactor(char* eMatrix)
}
if (NOT Matrix->Partitioned)
spPartition(eMatrix, spDEFAULT_PARTITION);
-#if spCOMPLEX
- if (Matrix->Complex)
- return FactorComplexMatrix(Matrix);
-#endif
#if REAL
Size = Matrix->Size;
@@ -412,117 +394,6 @@ int spFactor(char* eMatrix)
#endif /* REAL */
}
-#if spCOMPLEX
-/*
- * FACTOR COMPLEX MATRIX
- *
- * This routine is the companion routine to spFactor(), it
- * handles complex matrices. It is otherwise identical.
- *
- * >>> Returned:
- * The error code is returned. Possible errors are listed below.
- *
- * >>> Arguments:
- * Matrix (char *)
- * Pointer to matrix.
- *
- * >>> Possible errors:
- * spSINGULAR
- * Error is cleared in this function.
- */
-
-static int FactorComplexMatrix(MatrixPtr Matrix)
-{
- ElementPtr pElement;
- ElementPtr pColumn;
- int Step, Size;
- ComplexNumber Mult, Pivot;
-
- /* Begin `FactorComplexMatrix'. */
- ASSERT(Matrix->Complex);
-
- Size = Matrix->Size;
- pElement = Matrix->Diag[1];
- if (ELEMENT_MAG(pElement) == 0.0)
- return ZeroPivot(Matrix, 1);
- /* Cmplx expr: *pPivot = 1.0 / *pPivot. */
- CMPLX_RECIPROCAL(*pElement, *pElement);
-
- /* Start factorization. */
- for (Step = 2; Step <= Size; Step++) {
- if (Matrix->DoCmplxDirect[Step]) { /* Update column using direct addressing scatter-gather. */
- ComplexNumber* Dest;
- Dest = (ComplexNumber*)Matrix->Intermediate;
-
- /* Scatter. */
- pElement = Matrix->FirstInCol[Step];
- while (pElement != NULL) {
- Dest[pElement->Row] = *(ComplexNumber*)pElement;
- pElement = pElement->NextInCol;
- }
-
- /* Update column. */
- pColumn = Matrix->FirstInCol[Step];
- while (pColumn->Row < Step) {
- pElement = Matrix->Diag[pColumn->Row];
- /* Cmplx expr: Mult = Dest[pColumn->Row] * (1.0 / *pPivot). */
- CMPLX_MULT(Mult, Dest[pColumn->Row], *pElement);
- CMPLX_ASSIGN(*pColumn, Mult);
- while ((pElement = pElement->NextInCol) != NULL) { /* Cmplx expr: Dest[pElement->Row] -= Mult * pElement */
- CMPLX_MULT_SUBT_ASSIGN(Dest[pElement->Row], Mult, *pElement);
- }
- pColumn = pColumn->NextInCol;
- }
-
- /* Gather. */
- pElement = Matrix->Diag[Step]->NextInCol;
- while (pElement != NULL) {
- *(ComplexNumber*)pElement = Dest[pElement->Row];
- pElement = pElement->NextInCol;
- }
-
- /* Check for singular matrix. */
- Pivot = Dest[Step];
- if (CMPLX_1_NORM(Pivot) == 0.0)
- return ZeroPivot(Matrix, Step);
- CMPLX_RECIPROCAL(*Matrix->Diag[Step], Pivot);
- } else { /* Update column using direct addressing scatter-gather. */
- ComplexNumber** pDest;
- pDest = (ComplexNumber**)Matrix->Intermediate;
-
- /* Scatter. */
- pElement = Matrix->FirstInCol[Step];
- while (pElement != NULL) {
- pDest[pElement->Row] = (ComplexNumber*)pElement;
- pElement = pElement->NextInCol;
- }
-
- /* Update column. */
- pColumn = Matrix->FirstInCol[Step];
- while (pColumn->Row < Step) {
- pElement = Matrix->Diag[pColumn->Row];
- /* Cmplx expr: Mult = *pDest[pColumn->Row] * (1.0 / *pPivot). */
- CMPLX_MULT(Mult, *pDest[pColumn->Row], *pElement);
- CMPLX_ASSIGN(*pDest[pColumn->Row], Mult);
- while ((pElement = pElement->NextInCol) != NULL) { /* Cmplx expr: *pDest[pElement->Row] -= Mult * pElement */
- CMPLX_MULT_SUBT_ASSIGN(*pDest[pElement->Row], Mult, *pElement);
- }
- pColumn = pColumn->NextInCol;
- }
-
- /* Check for singular matrix. */
- pElement = Matrix->Diag[Step];
- if (ELEMENT_MAG(pElement) == 0.0)
- return ZeroPivot(Matrix, Step);
- CMPLX_RECIPROCAL(*pElement, *pElement);
- }
- }
-
- Matrix->Factored = YES;
- return (Matrix->Error = spOKAY);
-}
-#endif /* spCOMPLEX */
-
/*
* PARTITION MATRIX
*
@@ -566,7 +437,7 @@ void spPartition(char* eMatrix, int Mode)
ElementPtr pElement, pColumn;
int Step, Size;
int *Nc, *No, *Nm;
- BOOLEAN *DoRealDirect, *DoCmplxDirect;
+ BOOLEAN *DoRealDirect;
/* Begin `spPartition'. */
ASSERT(IS_SPARSE(Matrix));
@@ -574,7 +445,6 @@ void spPartition(char* eMatrix, int Mode)
return;
Size = Matrix->Size;
DoRealDirect = Matrix->DoRealDirect;
- DoCmplxDirect = Matrix->DoCmplxDirect;
Matrix->Partitioned = YES;
/* If partition is specified by the user, this is easy. */
@@ -584,18 +454,12 @@ void spPartition(char* eMatrix, int Mode)
for (Step = 1; Step <= Size; Step++)
#if REAL
DoRealDirect[Step] = YES;
-#endif
-#if spCOMPLEX
- DoCmplxDirect[Step] = YES;
#endif
return;
} else if (Mode == spINDIRECT_PARTITION) {
for (Step = 1; Step <= Size; Step++)
#if REAL
DoRealDirect[Step] = NO;
-#endif
-#if spCOMPLEX
- DoCmplxDirect[Step] = NO;
#endif
return;
} else
@@ -641,9 +505,6 @@ void spPartition(char* eMatrix, int Mode)
#if REAL
DoRealDirect[Step] = (Nm[Step] + No[Step] > 3 * Nc[Step] - 2 * Nm[Step]);
-#endif
-#if spCOMPLEX
- DoCmplxDirect[Step] = (Nm[Step] + No[Step] > 7 * Nc[Step] - 4 * Nm[Step]);
#endif
}
@@ -703,25 +564,12 @@ static void CreateInternalVectors(MatrixPtr Matrix)
Matrix->Error = spNO_MEMORY;
}
#endif
-#if spCOMPLEX
- if (Matrix->DoCmplxDirect == NULL) {
- if ((Matrix->DoCmplxDirect = ALLOC(BOOLEAN, Size + 1)) == NULL)
- Matrix->Error = spNO_MEMORY;
- }
-#endif
/* Create Intermediate vectors for use in MatrixSolve. */
-#if spCOMPLEX
- if (Matrix->Intermediate == NULL) {
- if ((Matrix->Intermediate = ALLOC(RealNumber, 2 * (Size + 1))) == NULL)
- Matrix->Error = spNO_MEMORY;
- }
-#else
if (Matrix->Intermediate == NULL) {
if ((Matrix->Intermediate = ALLOC(RealNumber, Size + 1)) == NULL)
Matrix->Error = spNO_MEMORY;
}
-#endif
if (Matrix->Error != spNO_MEMORY)
Matrix->InternalVectorsAllocated = YES;
@@ -765,17 +613,8 @@ static void CountMarkowitz(MatrixPtr Matrix, RealVector RHS, int Step)
/* Correct array pointer for ARRAY_OFFSET. */
#if NOT ARRAY_OFFSET
-#if spSEPARATED_COMPLEX_VECTORS OR NOT spCOMPLEX
if (RHS != NULL)
--RHS;
-#else
- if (RHS != NULL) {
- if (Matrix->Complex)
- RHS -= 2;
- else
- --RHS;
- }
-#endif
#endif
/* Generate MarkowitzRow Count for each row. */
@@ -793,19 +632,9 @@ static void CountMarkowitz(MatrixPtr Matrix, RealVector RHS, int Step)
/* Include nonzero elements in the RHS vector. */
ExtRow = Matrix->IntToExtRowMap[I];
-#if spSEPARATED_COMPLEX_VECTORS OR NOT spCOMPLEX
if (RHS != NULL)
if (RHS[ExtRow] != 0.0)
Count++;
-#else
- if (RHS != NULL) {
- if (Matrix->Complex) {
- if ((RHS[2 * ExtRow] != 0.0) OR(RHS[2 * ExtRow + 1] != 0.0))
- Count++;
- } else if (RHS[I] != 0.0)
- Count++;
- }
-#endif
Matrix->MarkowitzRow[I] = Count;
}
@@ -2015,10 +1844,6 @@ void spcRowExchange(MatrixPtr Matrix, int Row1, int Row2)
SWAP(int, Matrix->MarkowitzRow[Row1], Matrix->MarkowitzRow[Row2]);
SWAP(ElementPtr, Matrix->FirstInRow[Row1], Matrix->FirstInRow[Row2]);
SWAP(int, Matrix->IntToExtRowMap[Row1], Matrix->IntToExtRowMap[Row2]);
-#if TRANSLATE
- Matrix->ExtToIntRowMap[Matrix->IntToExtRowMap[Row1]] = Row1;
- Matrix->ExtToIntRowMap[Matrix->IntToExtRowMap[Row2]] = Row2;
-#endif
return;
}
@@ -2102,10 +1927,6 @@ void spcColExchange(MatrixPtr Matrix, int Col1, int Col2)
SWAP(int, Matrix->MarkowitzCol[Col1], Matrix->MarkowitzCol[Col2]);
SWAP(ElementPtr, Matrix->FirstInCol[Col1], Matrix->FirstInCol[Col2]);
SWAP(int, Matrix->IntToExtColMap[Col1], Matrix->IntToExtColMap[Col2]);
-#if TRANSLATE
- Matrix->ExtToIntColMap[Matrix->IntToExtColMap[Col1]] = Col1;
- Matrix->ExtToIntColMap[Matrix->IntToExtColMap[Col2]] = Col2;
-#endif
return;
}
@@ -2454,57 +2275,6 @@ static void RealRowColElimination(MatrixPtr Matrix, ElementPtr pPivot)
* spNO_MEMORY
*/
-static void ComplexRowColElimination(MatrixPtr Matrix, ElementPtr pPivot)
-{
-#if spCOMPLEX
- ElementPtr pSub;
- int Row;
- ElementPtr pLower, pUpper;
-
- /* Begin `ComplexRowColElimination'. */
-
- /* Test for zero pivot. */
- if (ELEMENT_MAG(pPivot) == 0.0) {
- (void)MatrixIsSingular(Matrix, pPivot->Row);
- return;
- }
- CMPLX_RECIPROCAL(*pPivot, *pPivot);
-
- pUpper = pPivot->NextInRow;
- while (pUpper != NULL) {
- /* Calculate upper triangular element. */
- /* Cmplx expr: *pUpper = *pUpper * (1.0 / *pPivot). */
- CMPLX_MULT_ASSIGN(*pUpper, *pPivot);
-
- pSub = pUpper->NextInCol;
- pLower = pPivot->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)
- 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 = CreateFillin(Matrix, Row, pUpper->Col);
- if (pSub == NULL) {
- Matrix->Error = spNO_MEMORY;
- return;
- }
- }
-
- /* Cmplx expr: pElement -= *pUpper * pLower. */
- CMPLX_MULT_SUBT_ASSIGN(*pSub, *pUpper, *pLower);
- pSub = pSub->NextInCol;
- pLower = pLower->NextInCol;
- }
- pUpper = pUpper->NextInRow;
- }
- return;
-#endif /* spCOMPLEX */
-}
-
/*
* UPDATE MARKOWITZ NUMBERS
*
diff --git a/src/sparse13/spmatrix.h b/src/sparse13/spmatrix.h
index a923809ef8..ce5878c324 100644
--- a/src/sparse13/spmatrix.h
+++ b/src/sparse13/spmatrix.h
@@ -227,11 +227,6 @@ struct spTemplate {
*/
/* Begin function declarations. */
-
-#if defined(__STDC__) || defined(__cplusplus)
-
-/* For compilers that understand function prototypes. */
-
extern void spClear(char*);
extern spREAL spCondition(char*, spREAL, int*);
extern char* spCreate(int, int, int*);
@@ -260,7 +255,6 @@ extern void spPrint(char*, int, int, int);
extern spREAL spPseudoCondition(char*);
extern spREAL spRoundoff(char*, spREAL);
extern void spScale(char*, spREAL[], spREAL[]);
-extern void spSetComplex(char*);
extern void spSetReal(char*);
extern void spStripFills(char*);
extern void spWhereSingular(char*, int*, int*);
@@ -273,48 +267,4 @@ extern void spMultTransposed(char* eMatrix, spREAL* RHS, spREAL* Solution, std::
extern void spSolve(char* eMatrix, spREAL* RHS, spREAL* Solution, std::optional iRHS = std::nullopt, std::optional iSolution = std::nullopt);
extern void spSolveTransposed(char*, spREAL*, spREAL*, std::optional = std::nullopt, std::optional = std::nullopt);
-#else /* NOT defined(__STDC__) */
-
-/* For compilers that do not understand function prototypes. */
-
-extern void spClear();
-extern spREAL spCondition();
-extern char* spCreate();
-extern void spDeleteRowAndCol();
-extern void spDestroy();
-extern void spDeterminant();
-extern int spElementCount();
-extern int spError();
-extern int spFactor();
-extern int spFileMatrix();
-extern int spFileStats();
-extern int spFileVector();
-extern int spFillinCount();
-extern int spGetAdmittance();
-extern spREAL* spGetElement(char*, int, int);
-extern char* spGetInitInfo();
-extern int spGetOnes();
-extern int spGetQuad();
-extern int spGetSize();
-extern int spInitialize();
-extern void spInstallInitInfo();
-extern spREAL spLargestElement();
-extern void spMNA_Preorder();
-extern void spMultiply();
-extern void spMultTransposed();
-extern spREAL spNorm();
-extern int spOrderAndFactor();
-extern void spPartition();
-extern void spPrint();
-extern spREAL spPseudoCondition();
-extern spREAL spRoundoff();
-extern void spScale();
-extern void spSetComplex();
-extern void spSetReal();
-extern void spSolve();
-extern void spSolveTransposed();
-extern void spStripFills();
-extern void spWhereSingular();
-#endif /* defined(__STDC__) */
-
#endif /* spOKAY */
diff --git a/src/sparse13/spoutput.cpp b/src/sparse13/spoutput.cpp
index 534025bcd2..5c33082f3e 100644
--- a/src/sparse13/spoutput.cpp
+++ b/src/sparse13/spoutput.cpp
@@ -33,11 +33,6 @@
* or implied warranty.
*/
-#ifndef lint
-static char copyright[] = "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
-static char RCSid[] = "$Header$";
-#endif
-
/*
* IMPORTS
*
@@ -143,11 +138,7 @@ void spPrint(char* eMatrix, int PrintReordered, int Data, int Header)
Size = Matrix->Size;
/* Create a packed external to internal row and column translation array. */
-#if TRANSLATE
- Top = Matrix->AllocatedExtSize;
-#else
Top = Matrix->AllocatedSize;
-#endif
CALLOC(PrintOrdToIntRowMap, int, Top + 1);
CALLOC(PrintOrdToIntColMap, int, Top + 1);
if (PrintOrdToIntRowMap == NULL OR PrintOrdToIntColMap == NULL) {
@@ -286,19 +277,6 @@ void spPrint(char* eMatrix, int PrintReordered, int Data, int Header)
}
printf("\n");
-#if spCOMPLEX
- if (Matrix->Complex AND Data) {
- printf(" ");
- for (J = StartCol; J <= StopCol; J++) {
- if (pImagElements[J - StartCol] != NULL) {
- printf(" %8.2lgj",
- (double)pImagElements[J - StartCol]->Imag);
- } else
- printf(" ");
- }
- printf("\n");
- }
-#endif /* spCOMPLEX */
}
/* Calculate index of first column in next group. */
@@ -440,31 +418,6 @@ int spFileMatrix(char* eMatrix, char* File, char* Label, int Reordered, int Data
return 0;
}
-#if spCOMPLEX
- if (Data AND Matrix->Complex) {
- for (I = 1; I <= Size; I++) {
- pElement = Matrix->FirstInCol[I];
- while (pElement != NULL) {
- if (Reordered) {
- Row = pElement->Row;
- Col = I;
- } else {
- Row = Matrix->IntToExtRowMap[pElement->Row];
- Col = Matrix->IntToExtColMap[I];
- }
- Err = fprintf(pMatrixFile, "%d\t%d\t%-.15lg\t%-.15lg\n",
- Row, Col, (double)pElement->Real, (double)pElement->Imag);
- if (Err < 0)
- return 0;
- pElement = pElement->NextInCol;
- }
- }
- /* Output terminator, a line of zeros. */
- if (Header)
- if (fprintf(pMatrixFile, "0\t0\t0.0\t0.0\n") < 0)
- return 0;
- }
-#endif /* spCOMPLEX */
#if REAL
if (Data AND NOT Matrix->Complex) {
@@ -511,11 +464,9 @@ int spFileMatrix(char* eMatrix, char* File, char* Label, int Reordered, int Data
* File (char *)
* Name of file into which matrix is to be written.
* RHS (RealNumber [])
- * Right-hand side vector. This is only the real portion if
- * spSEPARATED_COMPLEX_VECTORS is true.
+ * Right-hand side vector.
* iRHS (RealNumber [])
- * Right-hand side vector, imaginary portion. Not necessary if matrix
- * is real or if spSEPARATED_COMPLEX_VECTORS is set false.
+ * Right-hand side vector, imaginary portion.
*
* >>> Local variables:
* pMatrixFile (FILE *)
@@ -523,17 +474,12 @@ int spFileMatrix(char* eMatrix, char* File, char* Label, int Reordered, int Data
* Size (int)
* The size of the matrix.
*
- * >>> Obscure Macros
- * IMAG_RHS
- * Replaces itself with `, iRHS' if the options spCOMPLEX and
- * spSEPARATED_COMPLEX_VECTORS are set, otherwise it disappears
- * without a trace.
*/
int spFileVector(char* eMatrix, char* File, RealVector RHS, RealVector iRHS)
{
MatrixPtr Matrix = (MatrixPtr)eMatrix;
- int I, Size, Err;
+ int I, Size;
FILE* pMatrixFile;
/* Begin `spFileVector'. */
@@ -545,44 +491,11 @@ int spFileVector(char* eMatrix, char* File, RealVector RHS, RealVector iRHS)
/* Correct array pointers for ARRAY_OFFSET. */
#if NOT ARRAY_OFFSET
-#if spCOMPLEX
- if (Matrix->Complex) {
-#if spSEPARATED_COMPLEX_VECTORS
- ASSERT(iRHS != NULL)
- --RHS;
- --iRHS;
-#else
- RHS -= 2;
-#endif
- } else
-#endif /* spCOMPLEX */
--RHS;
#endif /* NOT ARRAY_OFFSET */
/* Output vector. */
Size = Matrix->Size;
-#if spCOMPLEX
- if (Matrix->Complex) {
-#if spSEPARATED_COMPLEX_VECTORS
- for (I = 1; I <= Size; I++) {
- Err = fprintf(pMatrixFile, "%-.15lg\t%-.15lg\n",
- (double)RHS[I], (double)iRHS[I]);
- if (Err < 0)
- return 0;
- }
-#else
- for (I = 1; I <= Size; I++) {
- Err = fprintf(pMatrixFile, "%-.15lg\t%-.15lg\n",
- (double)RHS[2 * I], (double)RHS[2 * I + 1]);
- if (Err < 0)
- return 0;
- }
-#endif
- }
-#endif /* spCOMPLEX */
-#if REAL AND spCOMPLEX
- else
-#endif
#if REAL
{
for (I = 1; I <= Size; I++) {
@@ -656,10 +569,7 @@ int spFileStats(char* eMatrix, char* File, char* Label)
fprintf(pStatsFile, "Matrix has not been factored.\n");
fprintf(pStatsFile, "||| Starting new matrix |||\n");
fprintf(pStatsFile, "%s\n", Label);
- if (Matrix->Complex)
- fprintf(pStatsFile, "Matrix is complex.\n");
- else
- fprintf(pStatsFile, "Matrix is real.\n");
+ fprintf(pStatsFile, "Matrix is real.\n");
fprintf(pStatsFile, " Size = %d\n", Size);
/* Search matrix. */
diff --git a/src/sparse13/spsolve.cpp b/src/sparse13/spsolve.cpp
index ee70d3b769..95bc4d436c 100644
--- a/src/sparse13/spsolve.cpp
+++ b/src/sparse13/spsolve.cpp
@@ -11,10 +11,6 @@
* >>> User accessible functions contained in this file:
* spSolve
* spSolveTransposed
- *
- * >>> Other functions contained in this file:
- * SolveComplexMatrix
- * SolveComplexTransposedMatrix
*/
/*
@@ -33,11 +29,6 @@
* or implied warranty.
*/
-#ifndef lint
-static char copyright[] = "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
-static char RCSid[] = "@(#)$Header$";
-#endif
-
/*
* IMPORTS
*
@@ -55,10 +46,6 @@ static char RCSid[] = "@(#)$Header$";
#include "spdefs.h"
#include "spmatrix.h"
-/* avoid "declared implicitly `extern' and later `static' " warnings. */
-static void SolveComplexMatrix(MatrixPtr Matrix, RealVector RHS, RealVector Solution, std::optional iRHS = std::nullopt, std::optional iSolution = std::nullopt);
-static void SolveComplexTransposedMatrix(MatrixPtr Matrix, RealVector RHS, RealVector Solution, std::optional iRHS = std::nullopt, std::optional iSolution = std::nullopt);
-
/*
* SOLVE MATRIX EQUATION
*
@@ -126,12 +113,6 @@ void spSolve(char* eMatrix, RealVector RHS, RealVector Solution, std::optionalComplex) {
- SolveComplexMatrix(Matrix, RHS, Solution, iRHS, iSolution);
- return;
- }
-#endif
#if REAL
Intermediate = Matrix->Intermediate;
@@ -183,155 +164,6 @@ void spSolve(char* eMatrix, RealVector RHS, RealVector Solution, std::optional>> Arguments:
- * Matrix (char *)
- * Pointer to matrix.
- * RHS (RealVector)
- * RHS is the real portion of the input data array, the right hand
- * side. This data is undisturbed and may be reused for other solves.
- * Solution