use ngspice memory allocation scheme
This commit is contained in:
parent
2b3a916dd2
commit
e2908767e2
|
|
@ -150,7 +150,7 @@ int AllocatedSize;
|
||||||
AllocatedSize = MAX( Size, MINIMUM_ALLOCATED_SIZE );
|
AllocatedSize = MAX( Size, MINIMUM_ALLOCATED_SIZE );
|
||||||
SizePlusOne = (unsigned)(AllocatedSize + 1);
|
SizePlusOne = (unsigned)(AllocatedSize + 1);
|
||||||
|
|
||||||
if ((Matrix = ALLOC(struct MatrixFrame, 1)) == NULL)
|
if ((Matrix = SP_MALLOC(struct MatrixFrame, 1)) == NULL)
|
||||||
{ *pError = spNO_MEMORY;
|
{ *pError = spNO_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -211,26 +211,26 @@ int AllocatedSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate space in memory for Diag pointer vector. */
|
/* Allocate space in memory for Diag pointer vector. */
|
||||||
CALLOC( Matrix->Diag, ElementPtr, SizePlusOne);
|
SP_CALLOC( Matrix->Diag, ElementPtr, SizePlusOne);
|
||||||
if (Matrix->Diag == NULL)
|
if (Matrix->Diag == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Allocate space in memory for FirstInCol pointer vector. */
|
/* Allocate space in memory for FirstInCol pointer vector. */
|
||||||
CALLOC( Matrix->FirstInCol, ElementPtr, SizePlusOne);
|
SP_CALLOC( Matrix->FirstInCol, ElementPtr, SizePlusOne);
|
||||||
if (Matrix->FirstInCol == NULL)
|
if (Matrix->FirstInCol == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Allocate space in memory for FirstInRow pointer vector. */
|
/* Allocate space in memory for FirstInRow pointer vector. */
|
||||||
CALLOC( Matrix->FirstInRow, ElementPtr, SizePlusOne);
|
SP_CALLOC( Matrix->FirstInRow, ElementPtr, SizePlusOne);
|
||||||
if (Matrix->FirstInRow == NULL)
|
if (Matrix->FirstInRow == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Allocate space in memory for IntToExtColMap vector. */
|
/* Allocate space in memory for IntToExtColMap vector. */
|
||||||
if (( Matrix->IntToExtColMap = ALLOC(int, SizePlusOne)) == NULL)
|
if (( Matrix->IntToExtColMap = SP_MALLOC(int, SizePlusOne)) == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Allocate space in memory for IntToExtRowMap vector. */
|
/* Allocate space in memory for IntToExtRowMap vector. */
|
||||||
if (( Matrix->IntToExtRowMap = ALLOC(int, SizePlusOne)) == NULL)
|
if (( Matrix->IntToExtRowMap = SP_MALLOC(int, SizePlusOne)) == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Initialize MapIntToExt vectors. */
|
/* Initialize MapIntToExt vectors. */
|
||||||
|
|
@ -241,11 +241,11 @@ int AllocatedSize;
|
||||||
|
|
||||||
#if TRANSLATE
|
#if TRANSLATE
|
||||||
/* Allocate space in memory for ExtToIntColMap vector. */
|
/* Allocate space in memory for ExtToIntColMap vector. */
|
||||||
if (( Matrix->ExtToIntColMap = ALLOC(int, SizePlusOne)) == NULL)
|
if (( Matrix->ExtToIntColMap = SP_MALLOC(int, SizePlusOne)) == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Allocate space in memory for ExtToIntRowMap vector. */
|
/* Allocate space in memory for ExtToIntRowMap vector. */
|
||||||
if (( Matrix->ExtToIntRowMap = ALLOC(int, SizePlusOne)) == NULL)
|
if (( Matrix->ExtToIntRowMap = SP_MALLOC(int, SizePlusOne)) == NULL)
|
||||||
goto MemoryError;
|
goto MemoryError;
|
||||||
|
|
||||||
/* Initialize MapExtToInt vectors. */
|
/* Initialize MapExtToInt vectors. */
|
||||||
|
|
@ -314,7 +314,7 @@ ElementPtr pElement;
|
||||||
|
|
||||||
/* Allocate block of MatrixElements if necessary. */
|
/* Allocate block of MatrixElements if necessary. */
|
||||||
if (Matrix->ElementsRemaining == 0)
|
if (Matrix->ElementsRemaining == 0)
|
||||||
{ pElement = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
|
{ pElement = SP_MALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
|
||||||
RecordAllocation( Matrix, (void *)pElement );
|
RecordAllocation( Matrix, (void *)pElement );
|
||||||
if (Matrix->Error == spNO_MEMORY) return NULL;
|
if (Matrix->Error == spNO_MEMORY) return NULL;
|
||||||
Matrix->ElementsRemaining = ELEMENTS_PER_ALLOCATION;
|
Matrix->ElementsRemaining = ELEMENTS_PER_ALLOCATION;
|
||||||
|
|
@ -375,21 +375,21 @@ ElementPtr pElement;
|
||||||
/* Begin `InitializeElementBlocks'. */
|
/* Begin `InitializeElementBlocks'. */
|
||||||
|
|
||||||
/* Allocate block of MatrixElements for elements. */
|
/* Allocate block of MatrixElements for elements. */
|
||||||
pElement = ALLOC(struct MatrixElement, InitialNumberOfElements);
|
pElement = SP_MALLOC(struct MatrixElement, InitialNumberOfElements);
|
||||||
RecordAllocation( Matrix, (void *)pElement );
|
RecordAllocation( Matrix, (void *)pElement );
|
||||||
if (Matrix->Error == spNO_MEMORY) return;
|
if (Matrix->Error == spNO_MEMORY) return;
|
||||||
Matrix->ElementsRemaining = InitialNumberOfElements;
|
Matrix->ElementsRemaining = InitialNumberOfElements;
|
||||||
Matrix->NextAvailElement = pElement;
|
Matrix->NextAvailElement = pElement;
|
||||||
|
|
||||||
/* Allocate block of MatrixElements for fill-ins. */
|
/* Allocate block of MatrixElements for fill-ins. */
|
||||||
pElement = ALLOC(struct MatrixElement, NumberOfFillinsExpected);
|
pElement = SP_MALLOC(struct MatrixElement, NumberOfFillinsExpected);
|
||||||
RecordAllocation( Matrix, (void *)pElement );
|
RecordAllocation( Matrix, (void *)pElement );
|
||||||
if (Matrix->Error == spNO_MEMORY) return;
|
if (Matrix->Error == spNO_MEMORY) return;
|
||||||
Matrix->FillinsRemaining = NumberOfFillinsExpected;
|
Matrix->FillinsRemaining = NumberOfFillinsExpected;
|
||||||
Matrix->NextAvailFillin = pElement;
|
Matrix->NextAvailFillin = pElement;
|
||||||
|
|
||||||
/* Allocate a fill-in list structure. */
|
/* Allocate a fill-in list structure. */
|
||||||
Matrix->FirstFillinListNode = ALLOC(struct FillinListNodeStruct,1);
|
Matrix->FirstFillinListNode = SP_MALLOC(struct FillinListNodeStruct,1);
|
||||||
RecordAllocation( Matrix, (void *)Matrix->FirstFillinListNode );
|
RecordAllocation( Matrix, (void *)Matrix->FirstFillinListNode );
|
||||||
if (Matrix->Error == spNO_MEMORY) return;
|
if (Matrix->Error == spNO_MEMORY) return;
|
||||||
Matrix->LastFillinListNode = Matrix->FirstFillinListNode;
|
Matrix->LastFillinListNode = Matrix->FirstFillinListNode;
|
||||||
|
|
@ -457,14 +457,14 @@ ElementPtr pFillins;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allocate block of fill-ins. */
|
/* Allocate block of fill-ins. */
|
||||||
pFillins = ALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
|
pFillins = SP_MALLOC(struct MatrixElement, ELEMENTS_PER_ALLOCATION);
|
||||||
RecordAllocation( Matrix, (void *)pFillins );
|
RecordAllocation( Matrix, (void *)pFillins );
|
||||||
if (Matrix->Error == spNO_MEMORY) return NULL;
|
if (Matrix->Error == spNO_MEMORY) return NULL;
|
||||||
Matrix->FillinsRemaining = ELEMENTS_PER_ALLOCATION;
|
Matrix->FillinsRemaining = ELEMENTS_PER_ALLOCATION;
|
||||||
Matrix->NextAvailFillin = pFillins;
|
Matrix->NextAvailFillin = pFillins;
|
||||||
|
|
||||||
/* Allocate a fill-in list structure. */
|
/* Allocate a fill-in list structure. */
|
||||||
pListNode->Next = ALLOC(struct FillinListNodeStruct,1);
|
pListNode->Next = SP_MALLOC(struct FillinListNodeStruct,1);
|
||||||
RecordAllocation( Matrix, (void *)pListNode->Next );
|
RecordAllocation( Matrix, (void *)pListNode->Next );
|
||||||
if (Matrix->Error == spNO_MEMORY) return NULL;
|
if (Matrix->Error == spNO_MEMORY) return NULL;
|
||||||
Matrix->LastFillinListNode = pListNode = pListNode->Next;
|
Matrix->LastFillinListNode = pListNode = pListNode->Next;
|
||||||
|
|
@ -526,7 +526,7 @@ RecordAllocation(
|
||||||
if (Matrix->RecordsRemaining == 0)
|
if (Matrix->RecordsRemaining == 0)
|
||||||
{ AllocateBlockOfAllocationList( Matrix );
|
{ AllocateBlockOfAllocationList( Matrix );
|
||||||
if (Matrix->Error == spNO_MEMORY)
|
if (Matrix->Error == spNO_MEMORY)
|
||||||
{ FREE(AllocatedPtr);
|
{ SP_FREE(AllocatedPtr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -571,7 +571,7 @@ register AllocationListPtr ListPtr;
|
||||||
|
|
||||||
/* Begin `AllocateBlockOfAllocationList'. */
|
/* Begin `AllocateBlockOfAllocationList'. */
|
||||||
/* Allocate block of records for allocation list. */
|
/* Allocate block of records for allocation list. */
|
||||||
ListPtr = ALLOC(struct AllocationRecord, (ELEMENTS_PER_ALLOCATION+1));
|
ListPtr = SP_MALLOC(struct AllocationRecord, (ELEMENTS_PER_ALLOCATION+1));
|
||||||
if (ListPtr == NULL)
|
if (ListPtr == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
|
|
@ -629,19 +629,19 @@ register AllocationListPtr ListPtr, NextListPtr;
|
||||||
ASSERT_IS_SPARSE( Matrix );
|
ASSERT_IS_SPARSE( Matrix );
|
||||||
|
|
||||||
/* Deallocate the vectors that are located in the matrix frame. */
|
/* Deallocate the vectors that are located in the matrix frame. */
|
||||||
FREE( Matrix->IntToExtColMap );
|
SP_FREE( Matrix->IntToExtColMap );
|
||||||
FREE( Matrix->IntToExtRowMap );
|
SP_FREE( Matrix->IntToExtRowMap );
|
||||||
FREE( Matrix->ExtToIntColMap );
|
SP_FREE( Matrix->ExtToIntColMap );
|
||||||
FREE( Matrix->ExtToIntRowMap );
|
SP_FREE( Matrix->ExtToIntRowMap );
|
||||||
FREE( Matrix->Diag );
|
SP_FREE( Matrix->Diag );
|
||||||
FREE( Matrix->FirstInRow );
|
SP_FREE( Matrix->FirstInRow );
|
||||||
FREE( Matrix->FirstInCol );
|
SP_FREE( Matrix->FirstInCol );
|
||||||
FREE( Matrix->MarkowitzRow );
|
SP_FREE( Matrix->MarkowitzRow );
|
||||||
FREE( Matrix->MarkowitzCol );
|
SP_FREE( Matrix->MarkowitzCol );
|
||||||
FREE( Matrix->MarkowitzProd );
|
SP_FREE( Matrix->MarkowitzProd );
|
||||||
FREE( Matrix->DoCmplxDirect );
|
SP_FREE( Matrix->DoCmplxDirect );
|
||||||
FREE( Matrix->DoRealDirect );
|
SP_FREE( Matrix->DoRealDirect );
|
||||||
FREE( Matrix->Intermediate );
|
SP_FREE( Matrix->Intermediate );
|
||||||
|
|
||||||
/* Sequentially step through the list of allocated pointers freeing pointers
|
/* Sequentially step through the list of allocated pointers freeing pointers
|
||||||
* along the way. */
|
* along the way. */
|
||||||
|
|
|
||||||
|
|
@ -1008,23 +1008,23 @@ register int I, OldAllocatedSize = Matrix->AllocatedSize;
|
||||||
NewSize = MAX( NewSize, (int)(EXPANSION_FACTOR * OldAllocatedSize) );
|
NewSize = MAX( NewSize, (int)(EXPANSION_FACTOR * OldAllocatedSize) );
|
||||||
Matrix->AllocatedSize = NewSize;
|
Matrix->AllocatedSize = NewSize;
|
||||||
|
|
||||||
if (( REALLOC(Matrix->IntToExtColMap, int, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->IntToExtColMap, int, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (( REALLOC(Matrix->IntToExtRowMap, int, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->IntToExtRowMap, int, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (( REALLOC(Matrix->Diag, ElementPtr, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->Diag, ElementPtr, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (( REALLOC(Matrix->FirstInCol, ElementPtr, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->FirstInCol, ElementPtr, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (( REALLOC(Matrix->FirstInRow, ElementPtr, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->FirstInRow, ElementPtr, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1033,12 +1033,12 @@ register int I, OldAllocatedSize = Matrix->AllocatedSize;
|
||||||
* Destroy the Markowitz and Intermediate vectors, they will be recreated
|
* Destroy the Markowitz and Intermediate vectors, they will be recreated
|
||||||
* in spOrderAndFactor().
|
* in spOrderAndFactor().
|
||||||
*/
|
*/
|
||||||
FREE( Matrix->MarkowitzRow );
|
SP_FREE( Matrix->MarkowitzRow );
|
||||||
FREE( Matrix->MarkowitzCol );
|
SP_FREE( Matrix->MarkowitzCol );
|
||||||
FREE( Matrix->MarkowitzProd );
|
SP_FREE( Matrix->MarkowitzProd );
|
||||||
FREE( Matrix->DoRealDirect );
|
SP_FREE( Matrix->DoRealDirect );
|
||||||
FREE( Matrix->DoCmplxDirect );
|
SP_FREE( Matrix->DoCmplxDirect );
|
||||||
FREE( Matrix->Intermediate );
|
SP_FREE( Matrix->Intermediate );
|
||||||
Matrix->InternalVectorsAllocated = NO;
|
Matrix->InternalVectorsAllocated = NO;
|
||||||
|
|
||||||
/* Initialize the new portion of the vectors. */
|
/* Initialize the new portion of the vectors. */
|
||||||
|
|
@ -1097,11 +1097,11 @@ register int I, OldAllocatedSize = Matrix->AllocatedExtSize;
|
||||||
NewSize = MAX( NewSize, (int)(EXPANSION_FACTOR * OldAllocatedSize) );
|
NewSize = MAX( NewSize, (int)(EXPANSION_FACTOR * OldAllocatedSize) );
|
||||||
Matrix->AllocatedExtSize = NewSize;
|
Matrix->AllocatedExtSize = NewSize;
|
||||||
|
|
||||||
if (( REALLOC(Matrix->ExtToIntRowMap, int, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->ExtToIntRowMap, int, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (( REALLOC(Matrix->ExtToIntColMap, int, NewSize+1)) == NULL)
|
if (( SP_REALLOC(Matrix->ExtToIntColMap, int, NewSize+1)) == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -453,26 +453,35 @@
|
||||||
/*
|
/*
|
||||||
* MEMORY ALLOCATION
|
* MEMORY ALLOCATION
|
||||||
*/
|
*/
|
||||||
#include <stddef.h>
|
//#include <stddef.h>
|
||||||
spcEXTERN void *malloc(size_t size);
|
#include <stdlib.h>
|
||||||
spcEXTERN void *calloc(size_t nmemb, size_t size);
|
spcEXTERN void *tmalloc(size_t);
|
||||||
spcEXTERN void *realloc(void *ptr, size_t size);
|
spcEXTERN void *trealloc(const void *, size_t);
|
||||||
spcEXTERN void free(void *ptr);
|
spcEXTERN void txfree(const void *);
|
||||||
spcEXTERN void abort(void);
|
spcEXTERN void abort(void);
|
||||||
|
|
||||||
#define ALLOC(type,number) ((type *)malloc((unsigned)(sizeof(type)*(number))))
|
#define SP_MALLOC(type,number) (type *) tmalloc((size_t)(number) * sizeof(type))
|
||||||
#define REALLOC(ptr,type,number) \
|
#define SP_REALLOC(ptr,type,number) \
|
||||||
ptr = (type *)realloc((char *)ptr,(unsigned)(sizeof(type)*(number)))
|
ptr = (type *) trealloc(ptr, (size_t)(number) * sizeof(type))
|
||||||
#define FREE(ptr) { if ((ptr) != NULL) free((char *)(ptr)); (ptr) = NULL; }
|
#define SP_FREE(ptr) { if ((ptr) != NULL) txfree(ptr); (ptr) = NULL; }
|
||||||
|
|
||||||
|
#include "ngspice/config.h"
|
||||||
|
|
||||||
/* Calloc that properly handles allocating a cleared vector. */
|
/* A new calloc */
|
||||||
#define CALLOC(ptr,type,number) \
|
#ifndef HAVE_LIBGC
|
||||||
{ int i; ptr = ALLOC(type, number); \
|
#define SP_CALLOC(ptr,type,number) \
|
||||||
if (ptr != (type *)NULL) \
|
{ ptr = (type *) calloc((size_t)(number), sizeof(type)); \
|
||||||
for(i=(number)-1;i>=0; i--) ptr[i] = (type) 0; \
|
|
||||||
}
|
}
|
||||||
|
#else /* HAVE_LIBCG */
|
||||||
|
#define SP_CALLOC(ptr,type,number) \
|
||||||
|
{ ptr = (type *) tmalloc((size_t)(number) * sizeof(type)); \
|
||||||
|
}
|
||||||
|
#include <gc/gc.h>
|
||||||
|
#define tmalloc(m) GC_malloc(m)
|
||||||
|
#define trealloc(m, n) GC_realloc((m), (n))
|
||||||
|
#define tfree(m)
|
||||||
|
#define txfree(m)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -734,28 +734,28 @@ int Size;
|
||||||
Size= Matrix->Size;
|
Size= Matrix->Size;
|
||||||
|
|
||||||
if (Matrix->MarkowitzRow == NULL)
|
if (Matrix->MarkowitzRow == NULL)
|
||||||
{ if (( Matrix->MarkowitzRow = ALLOC(int, Size+1)) == NULL)
|
{ if (( Matrix->MarkowitzRow = SP_MALLOC(int, Size+1)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
if (Matrix->MarkowitzCol == NULL)
|
if (Matrix->MarkowitzCol == NULL)
|
||||||
{ if (( Matrix->MarkowitzCol = ALLOC(int, Size+1)) == NULL)
|
{ if (( Matrix->MarkowitzCol = SP_MALLOC(int, Size+1)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
if (Matrix->MarkowitzProd == NULL)
|
if (Matrix->MarkowitzProd == NULL)
|
||||||
{ if (( Matrix->MarkowitzProd = ALLOC(long, Size+2)) == NULL)
|
{ if (( Matrix->MarkowitzProd = SP_MALLOC(long, Size+2)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create DoDirect vectors for use in spFactor(). */
|
/* Create DoDirect vectors for use in spFactor(). */
|
||||||
#if REAL
|
#if REAL
|
||||||
if (Matrix->DoRealDirect == NULL)
|
if (Matrix->DoRealDirect == NULL)
|
||||||
{ if (( Matrix->DoRealDirect = ALLOC(BOOLEAN, Size+1)) == NULL)
|
{ if (( Matrix->DoRealDirect = SP_MALLOC(BOOLEAN, Size+1)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if spCOMPLEX
|
#if spCOMPLEX
|
||||||
if (Matrix->DoCmplxDirect == NULL)
|
if (Matrix->DoCmplxDirect == NULL)
|
||||||
{ if (( Matrix->DoCmplxDirect = ALLOC(BOOLEAN, Size+1)) == NULL)
|
{ if (( Matrix->DoCmplxDirect = SP_MALLOC(BOOLEAN, Size+1)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -763,12 +763,12 @@ int Size;
|
||||||
/* Create Intermediate vectors for use in MatrixSolve. */
|
/* Create Intermediate vectors for use in MatrixSolve. */
|
||||||
#if spCOMPLEX
|
#if spCOMPLEX
|
||||||
if (Matrix->Intermediate == NULL)
|
if (Matrix->Intermediate == NULL)
|
||||||
{ if ((Matrix->Intermediate = ALLOC(RealNumber,2*(Size+1))) == NULL)
|
{ if ((Matrix->Intermediate = SP_MALLOC(RealNumber,2*(Size+1))) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (Matrix->Intermediate == NULL)
|
if (Matrix->Intermediate == NULL)
|
||||||
{ if ((Matrix->Intermediate = ALLOC(RealNumber, Size+1)) == NULL)
|
{ if ((Matrix->Intermediate = SP_MALLOC(RealNumber, Size+1)) == NULL)
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -153,8 +153,8 @@ int *PrintOrdToIntRowMap, *PrintOrdToIntColMap;
|
||||||
#else
|
#else
|
||||||
Top = Matrix->AllocatedSize;
|
Top = Matrix->AllocatedSize;
|
||||||
#endif
|
#endif
|
||||||
CALLOC( PrintOrdToIntRowMap, int, Top + 1 );
|
SP_CALLOC( PrintOrdToIntRowMap, int, Top + 1 );
|
||||||
CALLOC( PrintOrdToIntColMap, int, Top + 1 );
|
SP_CALLOC( PrintOrdToIntColMap, int, Top + 1 );
|
||||||
if ( PrintOrdToIntRowMap == NULL OR PrintOrdToIntColMap == NULL)
|
if ( PrintOrdToIntRowMap == NULL OR PrintOrdToIntColMap == NULL)
|
||||||
{ Matrix->Error = spNO_MEMORY;
|
{ Matrix->Error = spNO_MEMORY;
|
||||||
return;
|
return;
|
||||||
|
|
@ -341,8 +341,8 @@ int *PrintOrdToIntRowMap, *PrintOrdToIntColMap;
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
|
|
||||||
FREE(PrintOrdToIntColMap);
|
SP_FREE(PrintOrdToIntColMap);
|
||||||
FREE(PrintOrdToIntRowMap);
|
SP_FREE(PrintOrdToIntRowMap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue