59 #define spINSIDE_SPARSE
107 unsigned SizePlusOne;
117 if ((Size < 0)
OR(Size == 0
AND NOT EXPANDABLE)) {
135 AllocatedSize =
MAX(Size, MINIMUM_ALLOCATED_SIZE);
136 SizePlusOne = (unsigned)(AllocatedSize + 1);
145 Matrix->Complex = Complex;
146 Matrix->PreviousMatrixWasComplex = Complex;
153 Matrix->NumberOfInterchangesIsOdd =
NO;
156 Matrix->InternalVectorsAllocated =
NO;
160 Matrix->AllocatedSize = AllocatedSize;
162 Matrix->AllocatedExtSize = AllocatedSize;
174 Matrix->RelThreshold = DEFAULT_THRESHOLD;
175 Matrix->AbsThreshold = 0.0;
178 Matrix->RecordsRemaining = 0;
179 Matrix->ElementsRemaining = 0;
180 Matrix->FillinsRemaining = 0;
187 Matrix->TrashCan.Real = 0.0;
220 for (I = 1; I <= AllocatedSize; I++) {
221 Matrix->IntToExtRowMap[I] = I;
222 Matrix->IntToExtColMap[I] = I;
227 SPACE_FOR_FILL_INS * AllocatedSize);
272 if (
Matrix->ElementsRemaining == 0) {
277 Matrix->ElementsRemaining = ELEMENTS_PER_ALLOCATION;
278 Matrix->NextAvailElement = pElement;
282 Matrix->ElementsRemaining--;
283 return Matrix->NextAvailElement++;
327 Matrix->ElementsRemaining = InitialNumberOfElements;
328 Matrix->NextAvailElement = pElement;
335 Matrix->FillinsRemaining = NumberOfFillinsExpected;
336 Matrix->NextAvailFillin = pElement;
343 Matrix->LastFillinListNode =
Matrix->FirstFillinListNode;
345 Matrix->FirstFillinListNode->pFillinList = pElement;
346 Matrix->FirstFillinListNode->NumberOfFillinsInList = NumberOfFillinsExpected;
378 #if NOT STRIP OR LINT
379 if (
Matrix->FillinsRemaining == 0)
384 if (
Matrix->FillinsRemaining == 0) {
385 pListNode =
Matrix->LastFillinListNode;
389 Matrix->LastFillinListNode = pListNode = pListNode->
Next;
398 Matrix->FillinsRemaining = ELEMENTS_PER_ALLOCATION;
399 Matrix->NextAvailFillin = pFillins;
406 Matrix->LastFillinListNode = pListNode = pListNode->
Next;
416 Matrix->FillinsRemaining--;
417 return Matrix->NextAvailFillin++;
444 if (AllocatedPtr ==
NULL) {
450 if (
Matrix->RecordsRemaining == 0) {
459 (++
Matrix->TopOfAllocationList)->AllocatedPtr = AllocatedPtr;
460 Matrix->RecordsRemaining--;
490 if (ListPtr ==
NULL) {
499 Matrix->TopOfAllocationList = ListPtr;
500 ListPtr += ELEMENTS_PER_ALLOCATION;
501 for (I = ELEMENTS_PER_ALLOCATION; I > 0; I--) {
507 Matrix->TopOfAllocationList->AllocatedPtr = (
char*)ListPtr;
508 Matrix->RecordsRemaining = ELEMENTS_PER_ALLOCATION;
558 ListPtr =
Matrix->TopOfAllocationList;
559 while (ListPtr !=
NULL) {
562 ListPtr = NextListPtr;
584 if (eMatrix !=
NULL) {
615 *pRow =
Matrix->SingularRow;
616 *pCol =
Matrix->SingularCol;
int spGetSize(char *eMatrix, BOOLEAN External)
void spWhereSingular(char *eMatrix, int *pRow, int *pCol)
ElementPtr spcGetFillin(MatrixPtr Matrix)
static void RecordAllocation(MatrixPtr Matrix, char *AllocatedPtr)
ElementPtr spcGetElement(MatrixPtr Matrix)
char * spCreate(int Size, BOOLEAN Complex, int *pError)
void spDestroy(char *eMatrix)
void spSetReal(char *eMatrix)
int spElementCount(char *eMatrix)
static void AllocateBlockOfAllocationList(MatrixPtr Matrix)
int spFillinCount(char *eMatrix)
int spError(char *eMatrix)
static void InitializeElementBlocks(MatrixPtr Matrix, int InitialNumberOfElements, int NumberOfFillinsExpected)
#define ALLOC(type, number)
struct MatrixFrame * MatrixPtr
#define CALLOC(ptr, type, number)
#define ASSERT(condition)
#define IS_SPARSE(matrix)
struct AllocationRecord * NextRecord
int NumberOfFillinsInList
struct FillinListNodeStruct * Next