Jspice3
spalloc.c File Reference
#include "spconfig.h"
#include "spmatrix.h"
#include "spdefs.h"
Include dependency graph for spalloc.c:

Go to the source code of this file.

Macros

#define spINSIDE_SPARSE
 

Functions

static void InitializeElementBlocks ()
 
static void RecordAllocation ()
 
static void AllocateBlockOfAllocationList ()
 
char * spCreate (int Size, BOOLEAN Complex, int *pError)
 
ElementPtr spcGetElement (MatrixPtr Matrix)
 
static void InitializeElementBlocks (MatrixPtr Matrix, int InitialNumberOfElements, int NumberOfFillinsExpected)
 
ElementPtr spcGetFillin (MatrixPtr Matrix)
 
static void RecordAllocation (MatrixPtr Matrix, char *AllocatedPtr)
 
static void AllocateBlockOfAllocationList (MatrixPtr Matrix)
 
void spDestroy (char *eMatrix)
 
int spError (char *eMatrix)
 
void spWhereSingular (char *eMatrix, int *pRow, int *pCol)
 
int spGetSize (char *eMatrix, BOOLEAN External)
 
void spSetReal (char *eMatrix)
 
void spSetComplex (char *eMatrix)
 
int spFillinCount (char *eMatrix)
 
int spElementCount (char *eMatrix)
 

Macro Definition Documentation

#define spINSIDE_SPARSE

Definition at line 70 of file spalloc.c.

Function Documentation

static void AllocateBlockOfAllocationList ( )
static
static void AllocateBlockOfAllocationList ( MatrixPtr  Matrix)
static

Definition at line 588 of file spalloc.c.

591 {
592 register int I;
593 register AllocationListPtr ListPtr;
594 
595 /* Begin `AllocateBlockOfAllocationList'. */
596 /* Allocate block of records for allocation list. */
597  ListPtr = ALLOC(struct AllocationRecord, (ELEMENTS_PER_ALLOCATION+1));
598  if (ListPtr == NULL)
599  { Matrix->Error = spNO_MEMORY;
600  return;
601  }
602 
603 /* String entries of allocation list into singly linked list. List is linked
604  such that any record points to the one before it. */
605 
606  ListPtr->NextRecord = Matrix->TopOfAllocationList;
607  Matrix->TopOfAllocationList = ListPtr;
608  ListPtr += ELEMENTS_PER_ALLOCATION;
609  for (I = ELEMENTS_PER_ALLOCATION; I > 0; I--)
610  { ListPtr->NextRecord = ListPtr - 1;
611  ListPtr--;
612  }
613 
614 /* Record allocation of space for allocation list on allocation list. */
615  Matrix->TopOfAllocationList->AllocatedPtr = (char *)ListPtr;
616  Matrix->RecordsRemaining = ELEMENTS_PER_ALLOCATION;
617 
618  return;
619 }
#define ALLOC(type, number)
Definition: spdefs.h:433
int RecordsRemaining
Definition: spdefs.h:863
#define NULL
Definition: spdefs.h:121
struct AllocationRecord * NextRecord
Definition: spdefs.h:582
int Error
Definition: spdefs.h:829
register int I
Definition: spsolve.c:163
char * AllocatedPtr
Definition: spdefs.h:581
#define spNO_MEMORY
Definition: spmatrix.h:105
AllocationListPtr TopOfAllocationList
Definition: spdefs.h:862
static void InitializeElementBlocks ( )
static
static void InitializeElementBlocks ( MatrixPtr  Matrix,
int  InitialNumberOfElements,
int  NumberOfFillinsExpected 
)
static

Definition at line 388 of file spalloc.c.

393 {
395 
396 /* Begin `InitializeElementBlocks'. */
397 
398 /* Allocate block of MatrixElements for elements. */
399  pElement = ALLOC(struct MatrixElement, InitialNumberOfElements);
400  RecordAllocation( Matrix, (char *)pElement );
401  if (Matrix->Error == spNO_MEMORY) return;
402  Matrix->ElementsRemaining = InitialNumberOfElements;
403  Matrix->NextAvailElement = pElement;
404 
405 /* Allocate block of MatrixElements for fill-ins. */
406  pElement = ALLOC(struct MatrixElement, NumberOfFillinsExpected);
407  RecordAllocation( Matrix, (char *)pElement );
408  if (Matrix->Error == spNO_MEMORY) return;
409  Matrix->FillinsRemaining = NumberOfFillinsExpected;
410  Matrix->NextAvailFillin = pElement;
411 
412 /* Allocate a fill-in list structure. */
413  Matrix->FirstFillinListNode = ALLOC(struct FillinListNodeStruct,1);
414  RecordAllocation( Matrix, (char *)Matrix->FirstFillinListNode );
415  if (Matrix->Error == spNO_MEMORY) return;
416  Matrix->LastFillinListNode = Matrix->FirstFillinListNode;
417 
419  Matrix->FirstFillinListNode->NumberOfFillinsInList =NumberOfFillinsExpected;
420  Matrix->FirstFillinListNode->Next = NULL;
421 
422  return;
423 }
ElementPtr NextAvailFillin
Definition: spdefs.h:866
#define ALLOC(type, number)
Definition: spdefs.h:433
int NumberOfFillinsInList
Definition: spdefs.h:617
struct FillinListNodeStruct * FirstFillinListNode
Definition: spdefs.h:868
struct FillinListNodeStruct * LastFillinListNode
Definition: spdefs.h:869
ElementPtr pFillinList
Definition: spdefs.h:616
int FillinsRemaining
Definition: spdefs.h:867
#define NULL
Definition: spdefs.h:121
register ElementPtr pElement
Definition: spsolve.c:158
ElementPtr NextAvailElement
Definition: spdefs.h:864
int Error
Definition: spdefs.h:829
static void RecordAllocation()
int ElementsRemaining
Definition: spdefs.h:865
struct FillinListNodeStruct * Next
Definition: spdefs.h:618
#define spNO_MEMORY
Definition: spmatrix.h:105
static void RecordAllocation ( )
static
static void RecordAllocation ( MatrixPtr  Matrix,
char *  AllocatedPtr 
)
static

Definition at line 531 of file spalloc.c.

535 {
536 /* Begin `RecordAllocation'. */
537 /*
538  * If Allocated pointer is NULL, assume that malloc returned a NULL pointer,
539  * which indicates a spNO_MEMORY error.
540  */
541  if (AllocatedPtr == NULL)
542  { Matrix->Error = spNO_MEMORY;
543  return;
544  }
545 
546 /* Allocate block of MatrixElements if necessary. */
547  if (Matrix->RecordsRemaining == 0)
548  { AllocateBlockOfAllocationList( Matrix );
549  if (Matrix->Error == spNO_MEMORY)
550  { FREE(AllocatedPtr);
551  return;
552  }
553  }
554 
555 /* Add Allocated pointer to Allocation List. */
556  (++Matrix->TopOfAllocationList)->AllocatedPtr = AllocatedPtr;
557  Matrix->RecordsRemaining--;
558  return;
559 
560 }
int RecordsRemaining
Definition: spdefs.h:863
#define FREE(ptr)
Definition: spdefs.h:436
#define NULL
Definition: spdefs.h:121
int Error
Definition: spdefs.h:829
static void AllocateBlockOfAllocationList()
#define spNO_MEMORY
Definition: spmatrix.h:105
AllocationListPtr TopOfAllocationList
Definition: spdefs.h:862
ElementPtr spcGetElement ( MatrixPtr  Matrix)

Definition at line 327 of file spalloc.c.

330 {
332 
333 /* Begin `spcGetElement'. */
334 
335 /* Allocate block of MatrixElements if necessary. */
336  if (Matrix->ElementsRemaining == 0)
337  { pElement = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
338  RecordAllocation( Matrix, (char *)pElement );
339  if (Matrix->Error == spNO_MEMORY) return NULL;
340  Matrix->ElementsRemaining = ELEMENTS_PER_ALLOCATION;
341  Matrix->NextAvailElement = pElement;
342  }
343 
344 /* Update Element counter and return pointer to Element. */
345  Matrix->ElementsRemaining--;
346  return Matrix->NextAvailElement++;
347 
348 }
#define ALLOC(type, number)
Definition: spdefs.h:433
#define NULL
Definition: spdefs.h:121
register ElementPtr pElement
Definition: spsolve.c:158
ElementPtr NextAvailElement
Definition: spdefs.h:864
int Error
Definition: spdefs.h:829
static void RecordAllocation()
int ElementsRemaining
Definition: spdefs.h:865
#define spNO_MEMORY
Definition: spmatrix.h:105
ElementPtr spcGetFillin ( MatrixPtr  Matrix)

Definition at line 454 of file spalloc.c.

457 {
458 struct FillinListNodeStruct *pListNode;
459 ElementPtr pFillins;
460 
461 /* Begin `spcGetFillin'. */
462 
463 #if NOT STRIP OR LINT
464  if (Matrix->FillinsRemaining == 0)
465  return spcGetElement( Matrix );
466 #endif
467 #if STRIP OR LINT
468 
469  if (Matrix->FillinsRemaining == 0)
470  { pListNode = Matrix->LastFillinListNode;
471 
472 /* First see if there are any stripped fill-ins left. */
473  if (pListNode->Next != NULL)
474  { Matrix->LastFillinListNode = pListNode = pListNode->Next;
475  Matrix->FillinsRemaining = pListNode->NumberOfFillinsInList;
476  Matrix->NextAvailFillin = pListNode->pFillinList;
477  }
478  else
479  {
480 /* Allocate block of fill-ins. */
481  pFillins = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
482  RecordAllocation( Matrix, (char *)pFillins );
483  if (Matrix->Error == spNO_MEMORY) return NULL;
484  Matrix->FillinsRemaining = ELEMENTS_PER_ALLOCATION;
485  Matrix->NextAvailFillin = pFillins;
486 
487 /* Allocate a fill-in list structure. */
488  pListNode->Next = ALLOC(struct FillinListNodeStruct,1);
489  RecordAllocation( Matrix, (char *)pListNode->Next );
490  if (Matrix->Error == spNO_MEMORY) return NULL;
491  Matrix->LastFillinListNode = pListNode = pListNode->Next;
492 
493  pListNode->pFillinList = pFillins;
494  pListNode->NumberOfFillinsInList = ELEMENTS_PER_ALLOCATION;
495  pListNode->Next = NULL;
496  }
497  }
498 #endif
499 
500 /* Update Fill-in counter and return pointer to Fill-in. */
501  Matrix->FillinsRemaining--;
502  return Matrix->NextAvailFillin++;
503 }
ElementPtr NextAvailFillin
Definition: spdefs.h:866
#define ALLOC(type, number)
Definition: spdefs.h:433
int NumberOfFillinsInList
Definition: spdefs.h:617
struct FillinListNodeStruct * LastFillinListNode
Definition: spdefs.h:869
ElementPtr pFillinList
Definition: spdefs.h:616
int FillinsRemaining
Definition: spdefs.h:867
#define NULL
Definition: spdefs.h:121
ElementPtr spcGetElement(MatrixPtr Matrix)
Definition: spalloc.c:327
int Error
Definition: spdefs.h:829
static void RecordAllocation()
struct FillinListNodeStruct * Next
Definition: spdefs.h:618
#define spNO_MEMORY
Definition: spmatrix.h:105
char* spCreate ( int  Size,
BOOLEAN  Complex,
int *  pError 
)

Definition at line 133 of file spalloc.c.

137 {
138 register unsigned SizePlusOne;
139 register MatrixPtr Matrix;
140 register int I;
141 int AllocatedSize;
142 
143 /* Begin `spCreate'. */
144 /* Clear error flag. */
145  *pError = spOKAY;
146 
147 /* Test for valid size. */
148  if ((Size < 0) OR (Size == 0 AND NOT EXPANDABLE))
149  { *pError = spPANIC;
150  return NULL;
151  }
152 
153 /* Test for valid type. */
154 #if NOT spCOMPLEX
155  if (Complex)
156  { *pError = spPANIC;
157  return NULL;
158  }
159 #endif
160 #if NOT REAL
161  if (NOT Complex)
162  { *pError = spPANIC;
163  return NULL;
164  }
165 #endif
166 
167 /* Create Matrix. */
168  AllocatedSize = MAX( Size, MINIMUM_ALLOCATED_SIZE );
169  SizePlusOne = (unsigned)(AllocatedSize + 1);
170 
171  if ((Matrix = ALLOC(struct MatrixFrame, 1)) == NULL)
172  { *pError = spNO_MEMORY;
173  return NULL;
174  }
175 
176 /* Initialize matrix */
177  Matrix->ID = SPARSE_ID;
178  Matrix->Complex = Complex;
179  Matrix->PreviousMatrixWasComplex = Complex;
180  Matrix->Factored = NO;
181  Matrix->Elements = 0;
182  Matrix->Error = *pError;
183  Matrix->Fillins = 0;
184  Matrix->Reordered = NO;
185  Matrix->NeedsOrdering = YES;
186  Matrix->NumberOfInterchangesIsOdd = NO;
187  Matrix->Partitioned = NO;
188  Matrix->RowsLinked = NO;
189  Matrix->InternalVectorsAllocated = NO;
190  Matrix->SingularCol = 0;
191  Matrix->SingularRow = 0;
192  Matrix->Size = Size;
193  Matrix->AllocatedSize = AllocatedSize;
194  Matrix->ExtSize = Size;
195  Matrix->AllocatedExtSize = AllocatedSize;
196  Matrix->CurrentSize = 0;
197  Matrix->ExtToIntColMap = NULL;
198  Matrix->ExtToIntRowMap = NULL;
199  Matrix->IntToExtColMap = NULL;
200  Matrix->IntToExtRowMap = NULL;
201  Matrix->MarkowitzRow = NULL;
202  Matrix->MarkowitzCol = NULL;
203  Matrix->MarkowitzProd = NULL;
204  Matrix->DoCmplxDirect = NULL;
205  Matrix->DoRealDirect = NULL;
206  Matrix->Intermediate = NULL;
207  Matrix->RelThreshold = DEFAULT_THRESHOLD;
208  Matrix->AbsThreshold = 0.0;
209 
210  Matrix->TopOfAllocationList = NULL;
211  Matrix->RecordsRemaining = 0;
212  Matrix->ElementsRemaining = 0;
213  Matrix->FillinsRemaining = 0;
214 
215  RecordAllocation( Matrix, (char *)Matrix );
216  if (Matrix->Error == spNO_MEMORY) goto MemoryError;
217 
218 /* Take out the trash. */
219  Matrix->TrashCan.Real = 0.0;
220 #if spCOMPLEX
221  Matrix->TrashCan.Imag = 0.0;
222 #endif
223  Matrix->TrashCan.Row = 0;
224  Matrix->TrashCan.Col = 0;
225  Matrix->TrashCan.NextInRow = NULL;
226  Matrix->TrashCan.NextInCol = NULL;
227 #if INITIALIZE
228  Matrix->TrashCan.pInitInfo = NULL;
229 #endif
230 
231 /* Allocate space in memory for Diag pointer vector. */
232  CALLOC( Matrix->Diag, ElementPtr, SizePlusOne);
233  if (Matrix->Diag == NULL)
234  goto MemoryError;
235 
236 /* Allocate space in memory for FirstInCol pointer vector. */
237  CALLOC( Matrix->FirstInCol, ElementPtr, SizePlusOne);
238  if (Matrix->FirstInCol == NULL)
239  goto MemoryError;
240 
241 /* Allocate space in memory for FirstInRow pointer vector. */
242  CALLOC( Matrix->FirstInRow, ElementPtr, SizePlusOne);
243  if (Matrix->FirstInRow == NULL)
244  goto MemoryError;
245 
246 /* Allocate space in memory for IntToExtColMap vector. */
247  if (( Matrix->IntToExtColMap = ALLOC(int, SizePlusOne)) == NULL)
248  goto MemoryError;
249 
250 /* Allocate space in memory for IntToExtRowMap vector. */
251  if (( Matrix->IntToExtRowMap = ALLOC(int, SizePlusOne)) == NULL)
252  goto MemoryError;
253 
254 /* Initialize MapIntToExt vectors. */
255  for (I = 1; I <= AllocatedSize; I++)
256  { Matrix->IntToExtRowMap[I] = I;
257  Matrix->IntToExtColMap[I] = I;
258  }
259 
260 #if TRANSLATE
261 /* Allocate space in memory for ExtToIntColMap vector. */
262  if (( Matrix->ExtToIntColMap = ALLOC(int, SizePlusOne)) == NULL)
263  goto MemoryError;
264 
265 /* Allocate space in memory for ExtToIntRowMap vector. */
266  if (( Matrix->ExtToIntRowMap = ALLOC(int, SizePlusOne)) == NULL)
267  goto MemoryError;
268 
269 /* Initialize MapExtToInt vectors. */
270  for (I = 1; I <= AllocatedSize; I++)
271  { Matrix->ExtToIntColMap[I] = -1;
272  Matrix->ExtToIntRowMap[I] = -1;
273  }
274  Matrix->ExtToIntColMap[0] = 0;
275  Matrix->ExtToIntRowMap[0] = 0;
276 #endif
277 
278 /* Allocate space for fill-ins and initial set of elements. */
279  InitializeElementBlocks( Matrix, SPACE_FOR_ELEMENTS*AllocatedSize,
280  SPACE_FOR_FILL_INS*AllocatedSize );
281  if (Matrix->Error == spNO_MEMORY)
282  goto MemoryError;
283 
284  return (char *)Matrix;
285 
286 MemoryError:
287 
288 /* Deallocate matrix and return no pointer to matrix if there is not enough
289  memory. */
290  *pError = spNO_MEMORY;
291  spDestroy( (char *)Matrix);
292  return NULL;
293 }
BOOLEAN Partitioned
Definition: spdefs.h:848
static void InitializeElementBlocks()
RealNumber RelThreshold
Definition: spdefs.h:853
#define ALLOC(type, number)
Definition: spdefs.h:433
void spDestroy(char *eMatrix)
Definition: spalloc.c:649
int * MarkowitzRow
Definition: spdefs.h:842
int * MarkowitzCol
Definition: spdefs.h:843
ArrayOfElementPtrs FirstInRow
Definition: spdefs.h:836
#define MAX(a, b)
Definition: spdefs.h:135
#define NO
Definition: spdefs.h:113
int Size
Definition: spdefs.h:859
int SingularCol
Definition: spdefs.h:856
BOOLEAN * DoRealDirect
Definition: spdefs.h:827
int SingularRow
Definition: spdefs.h:857
int RecordsRemaining
Definition: spdefs.h:863
#define spOKAY
Definition: spmatrix.h:101
RealNumber Real
Definition: spdefs.h:539
long * MarkowitzProd
Definition: spdefs.h:844
int * ExtToIntRowMap
Definition: spdefs.h:832
BOOLEAN PreviousMatrixWasComplex
Definition: spdefs.h:852
BOOLEAN NumberOfInterchangesIsOdd
Definition: spdefs.h:847
struct MatrixElement * NextInCol
Definition: spdefs.h:547
BOOLEAN Factored
Definition: spdefs.h:833
BOOLEAN NeedsOrdering
Definition: spdefs.h:846
RealNumber AbsThreshold
Definition: spdefs.h:820
int FillinsRemaining
Definition: spdefs.h:867
#define spPANIC
Definition: spmatrix.h:106
#define CALLOC(ptr, type, number)
Definition: spdefs.h:440
#define NULL
Definition: spdefs.h:121
#define OR
Definition: fteparse.h:93
int * IntToExtColMap
Definition: spdefs.h:840
int ExtSize
Definition: spdefs.h:830
register int Size
Definition: spsolve.c:163
int * IntToExtRowMap
Definition: spdefs.h:841
int Fillins
Definition: spdefs.h:834
#define SPARSE_ID
Definition: spdefs.h:124
int Error
Definition: spdefs.h:829
int CurrentSize
Definition: spdefs.h:824
BOOLEAN Complex
Definition: spdefs.h:823
RealVector Intermediate
Definition: spdefs.h:838
BOOLEAN RowsLinked
Definition: spdefs.h:855
struct MatrixElement TrashCan
Definition: spdefs.h:860
unsigned long ID
Definition: spdefs.h:837
#define YES
Definition: spdefs.h:114
BOOLEAN InternalVectorsAllocated
Definition: spdefs.h:839
static void RecordAllocation()
int AllocatedExtSize
Definition: spdefs.h:822
int Elements
Definition: spdefs.h:828
struct MatrixElement * NextInRow
Definition: spdefs.h:546
ArrayOfElementPtrs Diag
Definition: spdefs.h:825
#define NOT
Definition: fteparse.h:94
int * ExtToIntColMap
Definition: spdefs.h:831
BOOLEAN Reordered
Definition: spdefs.h:854
int ElementsRemaining
Definition: spdefs.h:865
register int I
Definition: spsolve.c:163
#define spNO_MEMORY
Definition: spmatrix.h:105
BOOLEAN * DoCmplxDirect
Definition: spdefs.h:826
ArrayOfElementPtrs FirstInCol
Definition: spdefs.h:835
AllocationListPtr TopOfAllocationList
Definition: spdefs.h:862
#define AND
Definition: fteparse.h:92
int AllocatedSize
Definition: spdefs.h:821
void spDestroy ( char *  eMatrix)

Definition at line 649 of file spalloc.c.

652 {
653 MatrixPtr Matrix = (MatrixPtr)eMatrix;
654 register AllocationListPtr ListPtr, NextListPtr;
655 
656 
657 /* Begin `spDestroy'. */
658  ASSERT( IS_SPARSE( Matrix ) );
659 
660 /* Deallocate the vectors that are located in the matrix frame. */
661  FREE( Matrix->IntToExtColMap );
662  FREE( Matrix->IntToExtRowMap );
663  FREE( Matrix->ExtToIntColMap );
664  FREE( Matrix->ExtToIntRowMap );
665  FREE( Matrix->Diag );
666  FREE( Matrix->FirstInRow );
667  FREE( Matrix->FirstInCol );
668  FREE( Matrix->MarkowitzRow );
669  FREE( Matrix->MarkowitzCol );
670  FREE( Matrix->MarkowitzProd );
671  FREE( Matrix->DoCmplxDirect );
672  FREE( Matrix->DoRealDirect );
673  FREE( Matrix->Intermediate );
674 
675 /* Sequentially step through the list of allocated pointers freeing pointers
676  * along the way. */
677  ListPtr = Matrix->TopOfAllocationList;
678  while (ListPtr != NULL)
679  { NextListPtr = ListPtr->NextRecord;
680  if ((char *) ListPtr == ListPtr->AllocatedPtr)
681  {
682  FREE( ListPtr );
683  }
684  else
685  {
686  FREE( ListPtr->AllocatedPtr );
687  }
688  ListPtr = NextListPtr;
689  }
690  return;
691 }
int * MarkowitzRow
Definition: spdefs.h:842
int * MarkowitzCol
Definition: spdefs.h:843
ArrayOfElementPtrs FirstInRow
Definition: spdefs.h:836
BOOLEAN * DoRealDirect
Definition: spdefs.h:827
long * MarkowitzProd
Definition: spdefs.h:844
int * ExtToIntRowMap
Definition: spdefs.h:832
#define FREE(ptr)
Definition: spdefs.h:436
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
#define NULL
Definition: spdefs.h:121
int * IntToExtColMap
Definition: spdefs.h:840
int * IntToExtRowMap
Definition: spdefs.h:841
struct AllocationRecord * NextRecord
Definition: spdefs.h:582
RealVector Intermediate
Definition: spdefs.h:838
ArrayOfElementPtrs Diag
Definition: spdefs.h:825
int * ExtToIntColMap
Definition: spdefs.h:831
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:871
char * AllocatedPtr
Definition: spdefs.h:581
BOOLEAN * DoCmplxDirect
Definition: spdefs.h:826
ArrayOfElementPtrs FirstInCol
Definition: spdefs.h:835
AllocationListPtr TopOfAllocationList
Definition: spdefs.h:862
int spElementCount ( char *  eMatrix)

Definition at line 885 of file spalloc.c.

888 {
889 /* Begin `spElementCount'. */
890 
891  ASSERT( IS_SPARSE( (MatrixPtr)eMatrix ) );
892  return ((MatrixPtr)eMatrix)->Elements;
893 }
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
int spError ( char *  eMatrix)

Definition at line 713 of file spalloc.c.

716 {
717 /* Begin `spError'. */
718 
719  if (eMatrix != NULL)
720  { ASSERT(((MatrixPtr)eMatrix)->ID == SPARSE_ID);
721  return ((MatrixPtr)eMatrix)->Error;
722  }
723  else return spNO_MEMORY; /* This error may actually be spPANIC,
724  * no way to tell. */
725 }
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
#define NULL
Definition: spdefs.h:121
#define SPARSE_ID
Definition: spdefs.h:124
#define spNO_MEMORY
Definition: spmatrix.h:105
int spFillinCount ( char *  eMatrix)

Definition at line 873 of file spalloc.c.

876 {
877 /* Begin `spFillinCount'. */
878 
879  ASSERT( IS_SPARSE( (MatrixPtr)eMatrix ) );
880  return ((MatrixPtr)eMatrix)->Fillins;
881 }
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
int spGetSize ( char *  eMatrix,
BOOLEAN  External 
)

Definition at line 791 of file spalloc.c.

795 {
796 MatrixPtr Matrix = (MatrixPtr)eMatrix;
797 
798 /* Begin `spGetSize'. */
799  ASSERT( IS_SPARSE( Matrix ) );
800 
801 #if TRANSLATE
802  if (External)
803  return Matrix->ExtSize;
804  else
805  return Matrix->Size;
806 #else
807  return Matrix->Size;
808 #endif
809 }
int Size
Definition: spdefs.h:859
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
int ExtSize
Definition: spdefs.h:830
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:871
void spSetComplex ( char *  eMatrix)

Definition at line 842 of file spalloc.c.

845 {
846 /* Begin `spSetComplex'. */
847 
848  ASSERT( IS_SPARSE( (MatrixPtr)eMatrix ) AND spCOMPLEX);
849  ((MatrixPtr)eMatrix)->Complex = YES;
850  return;
851 }
#define spCOMPLEX
Definition: spconfig.h:284
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
#define YES
Definition: spdefs.h:114
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:871
#define AND
Definition: fteparse.h:92
void spSetReal ( char *  eMatrix)

Definition at line 829 of file spalloc.c.

832 {
833 /* Begin `spSetReal'. */
834 
835  ASSERT( IS_SPARSE( (MatrixPtr)eMatrix ) AND REAL);
836  ((MatrixPtr)eMatrix)->Complex = NO;
837  return;
838 }
#define NO
Definition: spdefs.h:113
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:871
#define AND
Definition: fteparse.h:92
void spWhereSingular ( char *  eMatrix,
int *  pRow,
int *  pCol 
)

Definition at line 751 of file spalloc.c.

755 {
756 MatrixPtr Matrix = (MatrixPtr)eMatrix;
757 
758 /* Begin `spWhereSingular'. */
759  ASSERT( IS_SPARSE( Matrix ) );
760 
761  if (Matrix->Error == spSINGULAR OR Matrix->Error == spZERO_DIAG)
762  { *pRow = Matrix->SingularRow;
763  *pCol = Matrix->SingularCol;
764  }
765  else *pRow = *pCol = 0;
766  return;
767 }
int SingularCol
Definition: spdefs.h:856
int SingularRow
Definition: spdefs.h:857
#define spSINGULAR
Definition: spmatrix.h:104
#define IS_SPARSE(matrix)
Definition: spdefs.h:125
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
#define OR
Definition: fteparse.h:93
int Error
Definition: spdefs.h:829
struct MatrixFrame * MatrixPtr
Definition: spdefs.h:871
#define spZERO_DIAG
Definition: spmatrix.h:103