diff --git a/src/maths/sparse/spalloc.c b/src/maths/sparse/spalloc.c index 14321d66a..19cd0cd9d 100644 --- a/src/maths/sparse/spalloc.c +++ b/src/maths/sparse/spalloc.c @@ -59,8 +59,10 @@ * Matrix type and macro definitions for the sparse matrix routines. */ #include +#include #define spINSIDE_SPARSE + #include "spconfig.h" #include "spmatrix.h" #include "spdefs.h" @@ -69,9 +71,6 @@ #endif /* PARALLEL_ARCH */ - - - /* * Function declarations */ diff --git a/src/maths/sparse/spdefs.h b/src/maths/sparse/spdefs.h index 8db08028f..53e718661 100644 --- a/src/maths/sparse/spdefs.h +++ b/src/maths/sparse/spdefs.h @@ -368,7 +368,11 @@ typedef struct /* Allocation */ -#define ALLOC(type,number) ((type *)tmalloc((unsigned)(sizeof(type)*(number)))) +extern void * tmalloc(size_t); +extern void * txfree(void *); +extern void * trealloc(void *, size_t); + +#define ALLOC(type,number) ((type *)tmalloc((size_t)(sizeof(type)*(number)))) #define REALLOC(ptr,type,number) \ ptr = (type *)trealloc((char *)ptr,(unsigned)(sizeof(type)*(number))) #define FREE(ptr) { if ((ptr) != NULL) txfree((char *)(ptr)); (ptr) = NULL; } diff --git a/src/maths/sparse/spoutput.c b/src/maths/sparse/spoutput.c index 51ba12973..59cf44669 100644 --- a/src/maths/sparse/spoutput.c +++ b/src/maths/sparse/spoutput.c @@ -46,6 +46,7 @@ * Matrix type and macro definitions for the sparse matrix routines. */ #include +#include #define spINSIDE_SPARSE #include "spconfig.h" diff --git a/src/maths/sparse/spsmp.c b/src/maths/sparse/spsmp.c index 5226ac5ec..1e0e21883 100644 --- a/src/maths/sparse/spsmp.c +++ b/src/maths/sparse/spsmp.c @@ -95,16 +95,13 @@ */ #include - #include #include - +#include #include #include "spdefs.h" #include - - static void LoadGmin(SMPmatrix *eMatrix, double Gmin); @@ -358,14 +355,14 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent) y = z; *pExponent = x + y; - x = scalb(re, (int) -y); - z = scalb(im, (int) -y); + x = scalbn(re, (int) -y); + z = scalbn(im, (int) -y); #ifdef debug_print printf(" ** values are: re %g, im %g, y %g, re' %g, im' %g\n", re, im, y, x, z); #endif - pMantissa->real = scalb(re, (int) -y); - pMantissa->imag = scalb(im, (int) -y); + pMantissa->real = scalbn(re, (int) -y); + pMantissa->imag = scalbn(im, (int) -y); #ifdef debug_print printf("Determinant 10->2: (%20g,%20g)^%d\n", pMantissa->real,