2 #include <../../nrnconf.h> 54 "Sparse1.3: Copyright (c) 1985,86,87,88 by Kenneth S. Kundert";
73 #define spINSIDE_SPARSE 124 register unsigned SizePlusOne;
134 if ((Size < 0)
OR (Size == 0
AND NOT EXPANDABLE))
154 AllocatedSize =
MAX( Size, MINIMUM_ALLOCATED_SIZE );
155 SizePlusOne = (unsigned)(AllocatedSize + 1);
168 Matrix->
Error = *pError;
202 if (Matrix->Error ==
spNO_MEMORY)
goto MemoryError;
205 Matrix->TrashCan.Real = 0.0;
207 Matrix->TrashCan.Imag = 0.0;
209 Matrix->TrashCan.Row = 0;
210 Matrix->TrashCan.Col = 0;
211 Matrix->TrashCan.NextInRow =
NULL;
212 Matrix->TrashCan.NextInCol =
NULL;
214 Matrix->TrashCan.pInitInfo =
NULL;
219 if (Matrix->Diag ==
NULL)
224 if (Matrix->FirstInCol ==
NULL)
229 if (Matrix->FirstInRow ==
NULL)
233 if (( Matrix->IntToExtColMap =
ALLOC(
int, SizePlusOne)) ==
NULL)
237 if (( Matrix->IntToExtRowMap =
ALLOC(
int, SizePlusOne)) ==
NULL)
241 for (I = 1; I <= AllocatedSize; I++)
242 { Matrix->IntToExtRowMap[
I] =
I;
243 Matrix->IntToExtColMap[
I] =
I;
248 if (( Matrix->ExtToIntColMap =
ALLOC(
int, SizePlusOne)) ==
NULL)
252 if (( Matrix->ExtToIntRowMap =
ALLOC(
int, SizePlusOne)) ==
NULL)
256 for (I = 1; I <= AllocatedSize; I++)
257 { Matrix->ExtToIntColMap[
I] = -1;
258 Matrix->ExtToIntRowMap[
I] = -1;
260 Matrix->ExtToIntColMap[0] = 0;
261 Matrix->ExtToIntRowMap[0] = 0;
266 SPACE_FOR_FILL_INS*AllocatedSize );
375 NumberOfFillinsExpected )
378 int InitialNumberOfElements, NumberOfFillinsExpected;
449 #if NOT STRIP OR LINT 527 if (AllocatedPtr ==
NULL)
536 {
FREE(AllocatedPtr);
594 ListPtr += ELEMENTS_PER_ALLOCATION;
595 for (I = ELEMENTS_PER_ALLOCATION; I > 0; I--)
637 register char *eMatrix;
664 while (ListPtr !=
NULL)
667 ListPtr = NextListPtr;
744 else *pRow = *pCol = 0;
ArrayOfElementPtrs FirstInRow
static void InitializeElementBlocks()
#define ALLOC(type, number)
void spDestroy(char *eMatrix)
AllocationListPtr TopOfAllocationList
void spSetReal(char *eMatrix)
void spSetComplex(char *eMatrix)
int NumberOfFillinsInList
int spElementCount(char *eMatrix)
ElementPtr NextAvailElement
int spGetSize(char *eMatrix, BOOLEAN External)
struct FillinListNodeStruct * Next
int spError(char *eMatrix)
ArrayOfElementPtrs FirstInCol
#define IS_SPARSE(matrix)
int spFillinCount(char *eMatrix)
ElementPtr spcGetFillin(MatrixPtr Matrix)
struct AllocationRecord * NextRecord
BOOLEAN InternalVectorsAllocated
#define CALLOC(ptr, type, number)
register ElementPtr pElement
#define ASSERT(condition)
struct FillinListNodeStruct * LastFillinListNode
BOOLEAN NumberOfInterchangesIsOdd
ElementPtr spcGetElement(MatrixPtr Matrix)
ElementPtr NextAvailFillin
struct FillinListNodeStruct * FirstFillinListNode
static void RecordAllocation()
struct MatrixFrame * MatrixPtr
void spWhereSingular(char *eMatrix, int *pRow, int *pCol)
static void AllocateBlockOfAllocationList()
char * spCreate(int Size, BOOLEAN Complex, int *pError)
BOOLEAN PreviousMatrixWasComplex