NEURON
spalloc.cpp
Go to the documentation of this file.
1 /*
2  * MATRIX ALLOCATION MODULE
3  *
4  * Author: Advising professor:
5  * Kenneth S. Kundert Alberto Sangiovanni-Vincentelli
6  * UC Berkeley
7  *
8  * This file contains the allocation and deallocation routines for the
9  * sparse matrix routines.
10  *
11  * >>> User accessible functions contained in this file:
12  * spCreate
13  * spDestroy
14  * spError
15  * spWhereSingular
16  * spGetSize
17  * spSetReal
18  * spFillinCount
19  * spElementCount
20  *
21  * >>> Other functions contained in this file:
22  * spcGetElement
23  * InitializeElementBlocks
24  * spcGetFillin
25  * RecordAllocation
26  * AllocateBlockOfAllocationList
27  * EnlargeMatrix
28  * ExpandTranslationArrays
29  */
30 
31 /*
32  * Revision and copyright information.
33  *
34  * Copyright (c) 1985,86,87,88
35  * by Kenneth S. Kundert and the University of California.
36  *
37  * Permission to use, copy, modify, and distribute this software and
38  * its documentation for any purpose and without fee is hereby granted,
39  * provided that the copyright notices appear in all copies and
40  * supporting documentation and that the authors and the University of
41  * California are properly credited. The authors and the University of
42  * California make no representations as to the suitability of this
43  * software for any purpose. It is provided `as is', without express
44  * or implied warranty.
45  */
46 
47 /*
48  * IMPORTS
49  *
50  * >>> Import descriptions:
51  * spconfig.h
52  * Macros that customize the sparse matrix routines.
53  * spmatrix.h
54  * Macros and declarations to be imported by the user.
55  * spdefs.h
56  * Matrix type and macro definitions for the sparse matrix routines.
57  */
58 
59 #define spINSIDE_SPARSE
60 #include "spconfig.h"
61 #include "spdefs.h"
62 #include "spmatrix.h"
63 
64 /* avoid "declared implicitly `extern' and later `static' " warnings. */
65 static void InitializeElementBlocks(MatrixPtr Matrix, int InitialNumberOfElements, int NumberOfFillinsExpected);
66 static void RecordAllocation(MatrixPtr Matrix, char* AllocatedPtr);
68 
69 /*
70  * MATRIX ALLOCATION
71  *
72  * Allocates and initializes the data structures associated with a matrix.
73  *
74  * >>> Returned:
75  * A pointer to the matrix is returned cast into the form of a pointer to
76  * a character. This pointer is then passed and used by the other matrix
77  * routines to refer to a particular matrix. If an error occurs, the NULL
78  * pointer is returned.
79  *
80  * >>> Arguments:
81  * Size <input> (int)
82  * Size of matrix or estimate of size of matrix if matrix is EXPANDABLE.
83  * Complex <input> (int)
84  * Type of matrix. If Complex is 0 then the matrix is real, otherwise
85  * the matrix will be complex. Note that if the routines are not set up
86  * to handle the type of matrix requested, then a spPANIC error will occur.
87  * Further note that if a matrix will be both real and complex, it must
88  * be specified here as being complex.
89  * pError <output> (int *)
90  * Returns error flag, needed because function spError() will not work
91  * correctly if spCreate() returns NULL.
92  *
93  * >>> Local variables:
94  * AllocatedSize (int)
95  * The size of the matrix being allocated.
96  * Matrix (MatrixPtr)
97  * A pointer to the matrix frame being created.
98  *
99  * >>> Possible errors:
100  * spNO_MEMORY
101  * spPANIC
102  * Error is cleared in this routine.
103  */
104 
105 char* spCreate(int Size, BOOLEAN Complex, int* pError)
106 {
107  unsigned SizePlusOne;
109  int I;
110  int AllocatedSize;
111 
112  /* Begin `spCreate'. */
113  /* Clear error flag. */
114  *pError = spOKAY;
115 
116  /* Test for valid size. */
117  if ((Size < 0) OR(Size == 0 AND NOT EXPANDABLE)) {
118  *pError = spPANIC;
119  return NULL;
120  }
121 
122 /* Test for valid type. */
123  if (Complex) {
124  *pError = spPANIC;
125  return NULL;
126  }
127 #if NOT REAL
128  if (NOT Complex) {
129  *pError = spPANIC;
130  return NULL;
131  }
132 #endif
133 
134  /* Create Matrix. */
135  AllocatedSize = MAX(Size, MINIMUM_ALLOCATED_SIZE);
136  SizePlusOne = (unsigned)(AllocatedSize + 1);
137 
138  if ((Matrix = ALLOC(struct MatrixFrame, 1)) == NULL) {
139  *pError = spNO_MEMORY;
140  return NULL;
141  }
142 
143  /* Initialize matrix */
144  Matrix->ID = SPARSE_ID;
145  Matrix->Complex = Complex;
146  Matrix->PreviousMatrixWasComplex = Complex;
147  Matrix->Factored = NO;
148  Matrix->Elements = 0;
149  Matrix->Error = *pError;
150  Matrix->Fillins = 0;
151  Matrix->Reordered = NO;
152  Matrix->NeedsOrdering = YES;
153  Matrix->NumberOfInterchangesIsOdd = NO;
154  Matrix->Partitioned = NO;
155  Matrix->RowsLinked = NO;
156  Matrix->InternalVectorsAllocated = NO;
157  Matrix->SingularCol = 0;
158  Matrix->SingularRow = 0;
159  Matrix->Size = Size;
160  Matrix->AllocatedSize = AllocatedSize;
161  Matrix->ExtSize = Size;
162  Matrix->AllocatedExtSize = AllocatedSize;
163  Matrix->CurrentSize = 0;
164  Matrix->ExtToIntColMap = NULL;
165  Matrix->ExtToIntRowMap = NULL;
166  Matrix->IntToExtColMap = NULL;
167  Matrix->IntToExtRowMap = NULL;
168  Matrix->MarkowitzRow = NULL;
169  Matrix->MarkowitzCol = NULL;
170  Matrix->MarkowitzProd = NULL;
171  Matrix->DoCmplxDirect = NULL;
172  Matrix->DoRealDirect = NULL;
173  Matrix->Intermediate = NULL;
174  Matrix->RelThreshold = DEFAULT_THRESHOLD;
175  Matrix->AbsThreshold = 0.0;
176 
177  Matrix->TopOfAllocationList = NULL;
178  Matrix->RecordsRemaining = 0;
179  Matrix->ElementsRemaining = 0;
180  Matrix->FillinsRemaining = 0;
181 
182  RecordAllocation(Matrix, (char*)Matrix);
183  if (Matrix->Error == spNO_MEMORY)
184  goto MemoryError;
185 
186  /* Take out the trash. */
187  Matrix->TrashCan.Real = 0.0;
188  Matrix->TrashCan.Row = 0;
189  Matrix->TrashCan.Col = 0;
190  Matrix->TrashCan.NextInRow = NULL;
191  Matrix->TrashCan.NextInCol = NULL;
192 #if INITIALIZE
193  Matrix->TrashCan.pInitInfo = NULL;
194 #endif
195 
196  /* Allocate space in memory for Diag pointer vector. */
197  CALLOC(Matrix->Diag, ElementPtr, SizePlusOne);
198  if (Matrix->Diag == NULL)
199  goto MemoryError;
200 
201  /* Allocate space in memory for FirstInCol pointer vector. */
202  CALLOC(Matrix->FirstInCol, ElementPtr, SizePlusOne);
203  if (Matrix->FirstInCol == NULL)
204  goto MemoryError;
205 
206  /* Allocate space in memory for FirstInRow pointer vector. */
207  CALLOC(Matrix->FirstInRow, ElementPtr, SizePlusOne);
208  if (Matrix->FirstInRow == NULL)
209  goto MemoryError;
210 
211  /* Allocate space in memory for IntToExtColMap vector. */
212  if ((Matrix->IntToExtColMap = ALLOC(int, SizePlusOne)) == NULL)
213  goto MemoryError;
214 
215  /* Allocate space in memory for IntToExtRowMap vector. */
216  if ((Matrix->IntToExtRowMap = ALLOC(int, SizePlusOne)) == NULL)
217  goto MemoryError;
218 
219  /* Initialize MapIntToExt vectors. */
220  for (I = 1; I <= AllocatedSize; I++) {
221  Matrix->IntToExtRowMap[I] = I;
222  Matrix->IntToExtColMap[I] = I;
223  }
224 
225  /* Allocate space for fill-ins and initial set of elements. */
226  InitializeElementBlocks(Matrix, SPACE_FOR_ELEMENTS * AllocatedSize,
227  SPACE_FOR_FILL_INS * AllocatedSize);
228  if (Matrix->Error == spNO_MEMORY)
229  goto MemoryError;
230 
231  return (char*)Matrix;
232 
233 MemoryError:
234 
235  /* Deallocate matrix and return no pointer to matrix if there is not enough
236  memory. */
237  *pError = spNO_MEMORY;
238  spDestroy((char*)Matrix);
239  return NULL;
240 }
241 
242 /*
243  * ELEMENT ALLOCATION
244  *
245  * This routine allocates space for matrix elements. It requests large blocks
246  * of storage from the system and doles out individual elements as required.
247  * This technique, as opposed to allocating elements individually, tends to
248  * speed the allocation process.
249  *
250  * >>> Returned:
251  * A pointer to an element.
252  *
253  * >>> Arguments:
254  * Matrix <input> (MatrixPtr)
255  * Pointer to matrix.
256  *
257  * >>> Local variables:
258  * pElement (ElementPtr)
259  * A pointer to the first element in the group of elements being allocated.
260  *
261  * >>> Possible errors:
262  * spNO_MEMORY
263  */
264 
266 {
267  ElementPtr pElement;
268 
269  /* Begin `spcGetElement'. */
270 
271  /* Allocate block of MatrixElements if necessary. */
272  if (Matrix->ElementsRemaining == 0) {
273  pElement = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
274  RecordAllocation(Matrix, (char*)pElement);
275  if (Matrix->Error == spNO_MEMORY)
276  return NULL;
277  Matrix->ElementsRemaining = ELEMENTS_PER_ALLOCATION;
278  Matrix->NextAvailElement = pElement;
279  }
280 
281  /* Update Element counter and return pointer to Element. */
282  Matrix->ElementsRemaining--;
283  return Matrix->NextAvailElement++;
284 }
285 
286 /*
287  * ELEMENT ALLOCATION INITIALIZATION
288  *
289  * This routine allocates space for matrix fill-ins and an initial set of
290  * elements. Besides being faster than allocating space for elements one
291  * at a time, it tends to keep the fill-ins physically close to the other
292  * matrix elements in the computer memory. This keeps virtual memory paging
293  * to a minimum.
294  *
295  * >>> Arguments:
296  * Matrix <input> (MatrixPtr)
297  * Pointer to the matrix.
298  * InitialNumberOfElements <input> (int)
299  * This number is used as the size of the block of memory, in
300  * MatrixElements, reserved for elements. If more than this number of
301  * elements are generated, then more space is allocated later.
302  * NumberOfFillinsExpected <input> (int)
303  * This number is used as the size of the block of memory, in
304  * MatrixElements, reserved for fill-ins. If more than this number of
305  * fill-ins are generated, then more space is allocated, but they may
306  * not be physically close in computer's memory.
307  *
308  * >>> Local variables:
309  * pElement (ElementPtr)
310  * A pointer to the first element in the group of elements being allocated.
311  *
312  * >>> Possible errors:
313  * spNO_MEMORY
314  */
315 
316 static void InitializeElementBlocks(MatrixPtr Matrix, int InitialNumberOfElements, int NumberOfFillinsExpected)
317 {
318  ElementPtr pElement;
319 
320  /* Begin `InitializeElementBlocks'. */
321 
322  /* Allocate block of MatrixElements for elements. */
323  pElement = ALLOC(struct MatrixElement, InitialNumberOfElements);
324  RecordAllocation(Matrix, (char*)pElement);
325  if (Matrix->Error == spNO_MEMORY)
326  return;
327  Matrix->ElementsRemaining = InitialNumberOfElements;
328  Matrix->NextAvailElement = pElement;
329 
330  /* Allocate block of MatrixElements for fill-ins. */
331  pElement = ALLOC(struct MatrixElement, NumberOfFillinsExpected);
332  RecordAllocation(Matrix, (char*)pElement);
333  if (Matrix->Error == spNO_MEMORY)
334  return;
335  Matrix->FillinsRemaining = NumberOfFillinsExpected;
336  Matrix->NextAvailFillin = pElement;
337 
338  /* Allocate a fill-in list structure. */
339  Matrix->FirstFillinListNode = ALLOC(struct FillinListNodeStruct, 1);
340  RecordAllocation(Matrix, (char*)Matrix->FirstFillinListNode);
341  if (Matrix->Error == spNO_MEMORY)
342  return;
343  Matrix->LastFillinListNode = Matrix->FirstFillinListNode;
344 
345  Matrix->FirstFillinListNode->pFillinList = pElement;
346  Matrix->FirstFillinListNode->NumberOfFillinsInList = NumberOfFillinsExpected;
347  Matrix->FirstFillinListNode->Next = NULL;
348 
349  return;
350 }
351 
352 /*
353  * FILL-IN ALLOCATION
354  *
355  * This routine allocates space for matrix fill-ins. It requests large blocks
356  * of storage from the system and doles out individual elements as required.
357  * This technique, as opposed to allocating elements individually, tends to
358  * speed the allocation process.
359  *
360  * >>> Returned:
361  * A pointer to the fill-in.
362  *
363  * >>> Arguments:
364  * Matrix <input> (MatrixPtr)
365  * Pointer to matrix.
366  *
367  * >>> Possible errors:
368  * spNO_MEMORY
369  */
370 
372 {
373  struct FillinListNodeStruct* pListNode;
374  ElementPtr pFillins;
375 
376  /* Begin `spcGetFillin'. */
377 
378 #if NOT STRIP OR LINT
379  if (Matrix->FillinsRemaining == 0)
380  return spcGetElement(Matrix);
381 #endif
382 #if STRIP OR LINT
383 
384  if (Matrix->FillinsRemaining == 0) {
385  pListNode = Matrix->LastFillinListNode;
386 
387  /* First see if there are any stripped fill-ins left. */
388  if (pListNode->Next != NULL) {
389  Matrix->LastFillinListNode = pListNode = pListNode->Next;
390  Matrix->FillinsRemaining = pListNode->NumberOfFillinsInList;
391  Matrix->NextAvailFillin = pListNode->pFillinList;
392  } else {
393  /* Allocate block of fill-ins. */
394  pFillins = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
395  RecordAllocation(Matrix, (char*)pFillins);
396  if (Matrix->Error == spNO_MEMORY)
397  return NULL;
398  Matrix->FillinsRemaining = ELEMENTS_PER_ALLOCATION;
399  Matrix->NextAvailFillin = pFillins;
400 
401  /* Allocate a fill-in list structure. */
402  pListNode->Next = ALLOC(struct FillinListNodeStruct, 1);
403  RecordAllocation(Matrix, (char*)pListNode->Next);
404  if (Matrix->Error == spNO_MEMORY)
405  return NULL;
406  Matrix->LastFillinListNode = pListNode = pListNode->Next;
407 
408  pListNode->pFillinList = pFillins;
409  pListNode->NumberOfFillinsInList = ELEMENTS_PER_ALLOCATION;
410  pListNode->Next = NULL;
411  }
412  }
413 #endif
414 
415  /* Update Fill-in counter and return pointer to Fill-in. */
416  Matrix->FillinsRemaining--;
417  return Matrix->NextAvailFillin++;
418 }
419 
420 /*
421  * RECORD A MEMORY ALLOCATION
422  *
423  * This routine is used to record all memory allocations so that the memory
424  * can be freed later.
425  *
426  * >>> Arguments:
427  * Matrix <input> (MatrixPtr)
428  * Pointer to the matrix.
429  * AllocatedPtr <input> (char *)
430  * The pointer returned by malloc or calloc. These pointers are saved in
431  * a list so that they can be easily freed.
432  *
433  * >>> Possible errors:
434  * spNO_MEMORY
435  */
436 
437 static void RecordAllocation(MatrixPtr Matrix, char* AllocatedPtr)
438 {
439  /* Begin `RecordAllocation'. */
440  /*
441  * If Allocated pointer is NULL, assume that malloc returned a NULL pointer,
442  * which indicates a spNO_MEMORY error.
443  */
444  if (AllocatedPtr == NULL) {
445  Matrix->Error = spNO_MEMORY;
446  return;
447  }
448 
449  /* Allocate block of MatrixElements if necessary. */
450  if (Matrix->RecordsRemaining == 0) {
452  if (Matrix->Error == spNO_MEMORY) {
453  FREE(AllocatedPtr);
454  return;
455  }
456  }
457 
458  /* Add Allocated pointer to Allocation List. */
459  (++Matrix->TopOfAllocationList)->AllocatedPtr = AllocatedPtr;
460  Matrix->RecordsRemaining--;
461  return;
462 }
463 
464 /*
465  * ADD A BLOCK OF SLOTS TO ALLOCATION LIST
466  *
467  * This routine increases the size of the allocation list.
468  *
469  * >>> Arguments:
470  * Matrix <input> (MatrixPtr)
471  * Pointer to the matrix.
472  *
473  * >>> Local variables:
474  * ListPtr (AllocationListPtr)
475  * Pointer to the list that contains the pointers to segments of memory
476  * that were allocated by the operating system for the current matrix.
477  *
478  * >>> Possible errors:
479  * spNO_MEMORY
480  */
481 
483 {
484  int I;
485  AllocationListPtr ListPtr;
486 
487  /* Begin `AllocateBlockOfAllocationList'. */
488  /* Allocate block of records for allocation list. */
489  ListPtr = ALLOC(struct AllocationRecord, (ELEMENTS_PER_ALLOCATION + 1));
490  if (ListPtr == NULL) {
491  Matrix->Error = spNO_MEMORY;
492  return;
493  }
494 
495  /* String entries of allocation list into singly linked list. List is linked
496  such that any record points to the one before it. */
497 
498  ListPtr->NextRecord = Matrix->TopOfAllocationList;
499  Matrix->TopOfAllocationList = ListPtr;
500  ListPtr += ELEMENTS_PER_ALLOCATION;
501  for (I = ELEMENTS_PER_ALLOCATION; I > 0; I--) {
502  ListPtr->NextRecord = ListPtr - 1;
503  ListPtr--;
504  }
505 
506  /* Record allocation of space for allocation list on allocation list. */
507  Matrix->TopOfAllocationList->AllocatedPtr = (char*)ListPtr;
508  Matrix->RecordsRemaining = ELEMENTS_PER_ALLOCATION;
509 
510  return;
511 }
512 
513 /*
514  * MATRIX DEALLOCATION
515  *
516  * Deallocates pointers and elements of Matrix.
517  *
518  * >>> Arguments:
519  * Matrix <input> (char *)
520  * Pointer to the matrix frame which is to be removed from memory.
521  *
522  * >>> Local variables:
523  * ListPtr (AllocationListPtr)
524  * Pointer into the linked list of pointers to allocated data structures.
525  * Points to pointer to structure to be freed.
526  * NextListPtr (AllocationListPtr)
527  * Pointer into the linked list of pointers to allocated data structures.
528  * Points to the next pointer to structure to be freed. This is needed
529  * because the data structure to be freed could include the current node
530  * in the allocation list.
531  */
532 
533 void spDestroy(char* eMatrix)
534 {
535  MatrixPtr Matrix = (MatrixPtr)eMatrix;
536  AllocationListPtr ListPtr, NextListPtr;
537 
538  /* Begin `spDestroy'. */
540 
541  /* Deallocate the vectors that are located in the matrix frame. */
542  FREE(Matrix->IntToExtColMap);
543  FREE(Matrix->IntToExtRowMap);
544  FREE(Matrix->ExtToIntColMap);
545  FREE(Matrix->ExtToIntRowMap);
546  FREE(Matrix->Diag);
547  FREE(Matrix->FirstInRow);
548  FREE(Matrix->FirstInCol);
549  FREE(Matrix->MarkowitzRow);
550  FREE(Matrix->MarkowitzCol);
551  FREE(Matrix->MarkowitzProd);
552  FREE(Matrix->DoCmplxDirect);
553  FREE(Matrix->DoRealDirect);
554  FREE(Matrix->Intermediate);
555 
556  /* Sequentially step through the list of allocated pointers freeing pointers
557  * along the way. */
558  ListPtr = Matrix->TopOfAllocationList;
559  while (ListPtr != NULL) {
560  NextListPtr = ListPtr->NextRecord;
561  FREE(ListPtr->AllocatedPtr);
562  ListPtr = NextListPtr;
563  }
564  return;
565 }
566 
567 /*
568  * RETURN MATRIX ERROR STATUS
569  *
570  * This function is used to determine the error status of the given matrix.
571  *
572  * >>> Returned:
573  * The error status of the given matrix.
574  *
575  * >>> Arguments:
576  * eMatrix <input> (char *)
577  * The matrix for which the error status is desired.
578  */
579 
580 int spError(char* eMatrix)
581 {
582  /* Begin `spError'. */
583 
584  if (eMatrix != NULL) {
585  ASSERT(((MatrixPtr)eMatrix)->ID == SPARSE_ID);
586  return ((MatrixPtr)eMatrix)->Error;
587  } else
588  return spNO_MEMORY; /* This error may actually be spPANIC,
589  * no way to tell. */
590 }
591 
592 /*
593  * WHERE IS MATRIX SINGULAR
594  *
595  * This function returns the row and column number where the matrix was
596  * detected as singular or where a zero was detected on the diagonal.
597  *
598  * >>> Arguments:
599  * eMatrix <input> (char *)
600  * The matrix for which the error status is desired.
601  * pRow <output> (int *)
602  * The row number.
603  * pCol <output> (int *)
604  * The column number.
605  */
606 
607 void spWhereSingular(char* eMatrix, int* pRow, int* pCol)
608 {
609  MatrixPtr Matrix = (MatrixPtr)eMatrix;
610 
611  /* Begin `spWhereSingular'. */
613 
614  if (Matrix->Error == spSINGULAR OR Matrix->Error == spZERO_DIAG) {
615  *pRow = Matrix->SingularRow;
616  *pCol = Matrix->SingularCol;
617  } else
618  *pRow = *pCol = 0;
619  return;
620 }
621 
622 /*
623  * MATRIX SIZE
624  *
625  * Returns the size of the matrix. Either the internal or external size of
626  * the matrix is returned.
627  *
628  * >>> Arguments:
629  * eMatrix <input> (char *)
630  * Pointer to matrix.
631  * External <input> (BOOLEAN)
632  * If External is set true, the external size , i.e., the value of the
633  * largest external row or column number encountered is returned.
634  * Otherwise the true size of the matrix is returned. These two sizes
635  * may differ if the TRANSLATE option is set true.
636  */
637 
638 int spGetSize(char* eMatrix, BOOLEAN External)
639 {
640  MatrixPtr Matrix = (MatrixPtr)eMatrix;
641 
642  /* Begin `spGetSize'. */
644 
645  return Matrix->Size;
646 }
647 
648 /*
649  * SET MATRIX COMPLEX OR REAL
650  *
651  * Forces matrix to be either real or complex.
652  *
653  * >>> Arguments:
654  * eMatrix <input> (char *)
655  * Pointer to matrix.
656  */
657 
658 void spSetReal(char* eMatrix)
659 {
660  /* Begin `spSetReal'. */
661 
662  ASSERT(IS_SPARSE((MatrixPtr)eMatrix) AND REAL);
663  ((MatrixPtr)eMatrix)->Complex = NO;
664  return;
665 }
666 
667 /*
668  * ELEMENT OR FILL-IN COUNT
669  *
670  * Two functions used to return simple statistics. Either the number
671  * of total elements, or the number of fill-ins can be returned.
672  *
673  * >>> Arguments:
674  * eMatrix <input> (char *)
675  * Pointer to matrix.
676  */
677 
678 int spFillinCount(char* eMatrix)
679 {
680  /* Begin `spFillinCount'. */
681 
682  ASSERT(IS_SPARSE((MatrixPtr)eMatrix));
683  return ((MatrixPtr)eMatrix)->Fillins;
684 }
685 
686 int spElementCount(char* eMatrix)
687 {
688  /* Begin `spElementCount'. */
689 
690  ASSERT(IS_SPARSE((MatrixPtr)eMatrix));
691  return ((MatrixPtr)eMatrix)->Elements;
692 }
#define MAX(a, b)
Definition: grids.h:31
OcMatrix Matrix
Definition: ocmatrix.h:14
int spGetSize(char *eMatrix, BOOLEAN External)
Definition: spalloc.cpp:638
void spWhereSingular(char *eMatrix, int *pRow, int *pCol)
Definition: spalloc.cpp:607
ElementPtr spcGetFillin(MatrixPtr Matrix)
Definition: spalloc.cpp:371
static void RecordAllocation(MatrixPtr Matrix, char *AllocatedPtr)
Definition: spalloc.cpp:437
ElementPtr spcGetElement(MatrixPtr Matrix)
Definition: spalloc.cpp:265
char * spCreate(int Size, BOOLEAN Complex, int *pError)
Definition: spalloc.cpp:105
void spDestroy(char *eMatrix)
Definition: spalloc.cpp:533
void spSetReal(char *eMatrix)
Definition: spalloc.cpp:658
int spElementCount(char *eMatrix)
Definition: spalloc.cpp:686
static void AllocateBlockOfAllocationList(MatrixPtr Matrix)
Definition: spalloc.cpp:482
int spFillinCount(char *eMatrix)
Definition: spalloc.cpp:678
int spError(char *eMatrix)
Definition: spalloc.cpp:580
static void InitializeElementBlocks(MatrixPtr Matrix, int InitialNumberOfElements, int NumberOfFillinsExpected)
Definition: spalloc.cpp:316
#define NULL
Definition: spdefs.h:105
#define FREE(ptr)
Definition: spdefs.h:177
#define SPARSE_ID
Definition: spdefs.h:108
#define ALLOC(type, number)
Definition: spdefs.h:173
#define OR
Definition: spdefs.h:101
#define BOOLEAN
Definition: spdefs.h:96
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:549
#define YES
Definition: spdefs.h:98
#define CALLOC(ptr, type, number)
Definition: spdefs.h:187
#define NO
Definition: spdefs.h:97
#define ASSERT(condition)
Definition: spdefs.h:151
#define AND
Definition: spdefs.h:100
#define NOT
Definition: spdefs.h:99
#define IS_SPARSE(matrix)
Definition: spdefs.h:109
#define spNO_MEMORY
Definition: spmatrix.h:90
#define spZERO_DIAG
Definition: spmatrix.h:88
#define spPANIC
Definition: spmatrix.h:91
#define spSINGULAR
Definition: spmatrix.h:89
#define spOKAY
Definition: spmatrix.h:86
char * AllocatedPtr
Definition: spdefs.h:276
struct AllocationRecord * NextRecord
Definition: spdefs.h:277
int NumberOfFillinsInList
Definition: spdefs.h:304
ElementPtr pFillinList
Definition: spdefs.h:303
struct FillinListNodeStruct * Next
Definition: spdefs.h:305