Browse Source

Added more separation between sparse and the rest of the package.

pre-master-46
pnenzi 23 years ago
parent
commit
9ee4064c46
  1. 3
      src/include/smpdefs.h
  2. 2
      src/include/sperror.h
  3. 2
      src/maths/sparse/spconfig.h
  4. 28
      src/maths/sparse/spdefs.h
  5. 3
      src/maths/sparse/spsmp.c

3
src/include/smpdefs.h

@ -10,8 +10,9 @@ Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes
**********/
#include "complex.h"
#include <stdio.h>
#include <math.h>
#include <complex.h>
int SMPaddElt( SMPmatrix *, int , int , double );
double * SMPmakeElt( SMPmatrix * , int , int );

2
src/include/sperror.h

@ -6,7 +6,7 @@ Author: 1985 Thomas L. Quarles
#ifndef _SPERROR_H
#define _SPERROR_H
#include "ngspice.h"
//#include "ngspice.h"
#include "iferrmsg.h"
/*

2
src/maths/sparse/spconfig.h

@ -378,7 +378,7 @@
* Grab from Spice include files
*/
#include "ngspice.h"
// #include "ngspice.h"
#define MACHINE_RESOLUTION DBL_EPSILON
#define LARGEST_REAL DBL_MAX
#define SMALLEST_REAL DBL_MIN

28
src/maths/sparse/spdefs.h

@ -38,13 +38,15 @@
* IMPORTS
*/
#include <ngspice.h>
#include <stdio.h>
#include "complex.h"
#undef ABORT
#undef MALLOC
#undef FREE
#undef REALLOC
#undef CMPLX_MULT
#undef CMPLX_RECIPROCAL
@ -58,9 +60,13 @@
/* Begin macros. */
/* Boolean data type */
#define BOOLEAN int
#define NO 0
#define YES 1
#define NOT !
#define AND &&
#define OR ||
#define SPARSE_ID 0x772773 /* Arbitrary (is Sparse on phone). */
#define IS_SPARSE(matrix) ((matrix) != NULL && \
@ -248,6 +254,20 @@
(from_a).Imag * (from_b).Real; \
}
/* Complex reciprocation: to = 1.0 / den */
#define CMPLX_RECIPROCAL(to,den) \
{ RealNumber r_; \
if (((den).Real >= (den).Imag AND (den).Real > -(den).Imag) OR \
((den).Real < (den).Imag AND (den).Real <= -(den).Imag)) \
{ r_ = (den).Imag / (den).Real; \
(to).Imag = -r_*((to).Real = 1.0/((den).Real + r_*(den).Imag)); \
} \
else \
{ r_ = (den).Real / (den).Imag; \
(to).Real = -r_*((to).Imag = -1.0/((den).Imag + r_*(den).Real));\
} \
}
#define ALLOC(type,number) ((type *)tmalloc((unsigned)(sizeof(type)*(number))))
#define REALLOC(ptr,type,number) \
@ -267,9 +287,7 @@
}
#endif
#include "complex.h"
#include "defines.h"
/*

3
src/maths/sparse/spsmp.c

@ -95,15 +95,14 @@
*/
#include <config.h>
#include <ngspice.h>
#include <assert.h>
#include <stdio.h>
#include <spmatrix.h>
#include "spdefs.h"
#include <smpdefs.h>
#include "spdefs.h"
static void LoadGmin(SMPmatrix *eMatrix, double Gmin);

Loading…
Cancel
Save