Jspice3
spdefs.h File Reference
#include <stdio.h>
#include "misc.h"
Include dependency graph for spdefs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ComplexNumber
 
struct  MatrixElement
 
struct  AllocationRecord
 
struct  FillinListNodeStruct
 
struct  MatrixFrame
 

Macros

#define LINT   NO
 
#define BOOLEAN   int
 
#define NO   0
 
#define YES   1
 
#define NOT   !
 
#define AND   &&
 
#define OR   ||
 
#define NULL   0
 
#define SPARSE_ID   0x772773 /* Arbitrary (is Sparse on phone). */
 
#define IS_SPARSE(matrix)
 
#define IS_VALID(matrix)
 
#define IS_FACTORED(matrix)   ((matrix)->Factored && !(matrix)->NeedsOrdering)
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define ABS(a)   ((a) < 0 ? -(a) : (a))
 
#define SQR(a)   ((a)*(a))
 
#define SWAP(type, a, b)   {type swapx; swapx = a; a = b; b = swapx;}
 
#define ELEMENT_MAG(ptr)   ((ptr)->Real < 0.0 ? -(ptr)->Real : (ptr)->Real)
 
#define CMPLX_ASSIGN(to, from)
 
#define CMPLX_CONJ_ASSIGN(to, from)
 
#define CMPLX_NEGATE_ASSIGN(to, from)
 
#define CMPLX_CONJ_NEGATE_ASSIGN(to, from)
 
#define CMPLX_CONJ(a)   (a).Imag = -(a).Imag
 
#define CMPLX_NEGATE(a)
 
#define CMPLX_1_NORM(a)   (ABS((a).Real) + ABS((a).Imag))
 
#define CMPLX_INF_NORM(a)   (MAX (ABS((a).Real),ABS((a).Imag)))
 
#define CMPLX_2_NORM(a)   (sqrt((a).Real*(a).Real + (a).Imag*(a).Imag))
 
#define CMPLX_ADD(to, from_a, from_b)
 
#define CMPLX_SUBT(to, from_a, from_b)
 
#define CMPLX_ADD_ASSIGN(to, from)
 
#define CMPLX_SUBT_ASSIGN(to, from)
 
#define SCLR_MULT(to, sclr, cmplx)
 
#define SCLR_MULT_ASSIGN(to, sclr)
 
#define CMPLX_MULT(to, from_a, from_b)
 
#define CMPLX_MULT_ASSIGN(to, from)
 
#define CMPLX_CONJ_MULT(to, from_a, from_b)
 
#define CMPLX_MULT_ADD(to, mult_a, mult_b, add)
 
#define CMPLX_MULT_SUBT(to, mult_a, mult_b, subt)
 
#define CMPLX_CONJ_MULT_ADD(to, mult_a, mult_b, add)
 
#define CMPLX_MULT_ADD_ASSIGN(to, from_a, from_b)
 
#define CMPLX_MULT_SUBT_ASSIGN(to, from_a, from_b)
 
#define CMPLX_CONJ_MULT_ADD_ASSIGN(to, from_a, from_b)
 
#define CMPLX_CONJ_MULT_SUBT_ASSIGN(to, from_a, from_b)
 
#define CMPLX_DIV(to, num, den)
 
#define CMPLX_DIV_ASSIGN(num, den)
 
#define CMPLX_RECIPROCAL(to, den)
 
#define ASSERT(condition)
 
#define ABORT()
 
#define IMAG_VECTORS
 
#define IMAG_RHS
 
#define ALLOC(type, number)   ((type *)tmalloc((unsigned)(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; }
 
#define CALLOC(ptr, type, number)
 

Typedefs

typedef spREAL RealNumber
 
typedef spREALRealVector
 
typedef struct ComplexNumberComplexVector
 
typedef struct MatrixElementElementPtr
 
typedef ElementPtrArrayOfElementPtrs
 
typedef struct AllocationRecordAllocationListPtr
 
typedef struct MatrixFrameMatrixPtr
 

Functions

ElementPtr spcGetElement ()
 
ElementPtr spcGetFillin ()
 
ElementPtr spcFindElementInCol ()
 
ElementPtr spcCreateElement ()
 
void spcCreateInternalVectors ()
 
void spcLinkRows ()
 
void spcColExchange ()
 
void spcRowExchange ()
 

Macro Definition Documentation

#define ABORT ( )

Definition at line 410 of file spdefs.h.

#define ABS (   a)    ((a) < 0 ? -(a) : (a))

Definition at line 139 of file spdefs.h.

#define ALLOC (   type,
  number 
)    ((type *)tmalloc((unsigned)(sizeof(type)*(number))))

Definition at line 433 of file spdefs.h.

#define AND   &&

Definition at line 116 of file spdefs.h.

#define ASSERT (   condition)

Definition at line 398 of file spdefs.h.

#define BOOLEAN   int

Definition at line 112 of file spdefs.h.

#define CALLOC (   ptr,
  type,
  number 
)
Value:
{ int i; ptr = ALLOC(type, number); \
if (ptr != (type *)NULL) \
for(i=(number)-1;i>=0; i--) ptr[i] = (type) 0; \
}
#define ALLOC(type, number)
Definition: spdefs.h:433
if(TDesc==NULL)
Definition: cd.c:1326
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
char * ptr
Definition: output.c:153

Definition at line 440 of file spdefs.h.

#define CMPLX_1_NORM (   a)    (ABS((a).Real) + ABS((a).Imag))

Definition at line 188 of file spdefs.h.

#define CMPLX_2_NORM (   a)    (sqrt((a).Real*(a).Real + (a).Imag*(a).Imag))

Definition at line 194 of file spdefs.h.

#define CMPLX_ADD (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real = (from_a).Real + (from_b).Real; \
(to).Imag = (from_a).Imag + (from_b).Imag; \
}

Definition at line 197 of file spdefs.h.

#define CMPLX_ADD_ASSIGN (   to,
  from 
)
Value:
{ (to).Real += (from).Real; \
(to).Imag += (from).Imag; \
}

Definition at line 209 of file spdefs.h.

#define CMPLX_ASSIGN (   to,
  from 
)
Value:
{ (to).Real = (from).Real; \
(to).Imag = (from).Imag; \
}

Definition at line 165 of file spdefs.h.

#define CMPLX_CONJ (   a)    (a).Imag = -(a).Imag

Definition at line 181 of file spdefs.h.

#define CMPLX_CONJ_ASSIGN (   to,
  from 
)
Value:
{ (to).Real = (from).Real; \
(to).Imag = -(from).Imag; \
}

Definition at line 169 of file spdefs.h.

#define CMPLX_CONJ_MULT (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real = (from_a).Real * (from_b).Real + \
(from_a).Imag * (from_b).Imag; \
(to).Imag = (from_a).Real * (from_b).Imag - \
(from_a).Imag * (from_b).Real; \
}

Definition at line 251 of file spdefs.h.

#define CMPLX_CONJ_MULT_ADD (   to,
  mult_a,
  mult_b,
  add 
)
Value:
{ (to).Real = (mult_a).Real * (mult_b).Real + \
(mult_a).Imag * (mult_b).Imag + (add).Real; \
(to).Imag = (mult_a).Real * (mult_b).Imag - \
(mult_a).Imag * (mult_b).Real + (add).Imag; \
}

Definition at line 279 of file spdefs.h.

#define CMPLX_CONJ_MULT_ADD_ASSIGN (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real += (from_a).Real * (from_b).Real + \
(from_a).Imag * (from_b).Imag; \
(to).Imag += (from_a).Real * (from_b).Imag - \
(from_a).Imag * (from_b).Real; \
}

Definition at line 307 of file spdefs.h.

#define CMPLX_CONJ_MULT_SUBT_ASSIGN (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real -= (from_a).Real * (from_b).Real + \
(from_a).Imag * (from_b).Imag; \
(to).Imag -= (from_a).Real * (from_b).Imag - \
(from_a).Imag * (from_b).Real; \
}

Definition at line 317 of file spdefs.h.

#define CMPLX_CONJ_NEGATE_ASSIGN (   to,
  from 
)
Value:
{ (to).Real = -(from).Real; \
(to).Imag = (from).Imag; \
}

Definition at line 177 of file spdefs.h.

#define CMPLX_DIV (   to,
  num,
  den 
)
Value:
{ RealNumber r_, s_; \
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; \
s_ = (den).Real + r_*(den).Imag; \
(to).Real = ((num).Real + r_*(num).Imag)/s_; \
(to).Imag = ((num).Imag - r_*(num).Real)/s_; \
} \
else \
{ r_ = (den).Real / (den).Imag; \
s_ = (den).Imag + r_*(den).Real; \
(to).Real = (r_*(num).Real + (num).Imag)/s_; \
(to).Imag = (r_*(num).Imag - (num).Real)/s_; \
} \
}
if(TDesc==NULL)
Definition: cd.c:1326
#define OR
Definition: spdefs.h:117
#define AND
Definition: spdefs.h:116
spREAL RealNumber
Definition: spdefs.h:458

Definition at line 329 of file spdefs.h.

#define CMPLX_DIV_ASSIGN (   num,
  den 
)
Value:
{ RealNumber r_, s_, t_; \
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; \
s_ = (den).Real + r_*(den).Imag; \
t_ = ((num).Real + r_*(num).Imag)/s_; \
(num).Imag = ((num).Imag - r_*(num).Real)/s_; \
(num).Real = t_; \
} \
else \
{ r_ = (den).Real / (den).Imag; \
s_ = (den).Imag + r_*(den).Real; \
t_ = (r_*(num).Real + (num).Imag)/s_; \
(num).Imag = (r_*(num).Imag - (num).Real)/s_; \
(num).Real = t_; \
} \
}
if(TDesc==NULL)
Definition: cd.c:1326
#define OR
Definition: spdefs.h:117
#define AND
Definition: spdefs.h:116
spREAL RealNumber
Definition: spdefs.h:458

Definition at line 347 of file spdefs.h.

#define CMPLX_INF_NORM (   a)    (MAX (ABS((a).Real),ABS((a).Imag)))

Definition at line 191 of file spdefs.h.

#define CMPLX_MULT (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real = (from_a).Real * (from_b).Real - \
(from_a).Imag * (from_b).Imag; \
(to).Imag = (from_a).Real * (from_b).Imag + \
(from_a).Imag * (from_b).Real; \
}

Definition at line 233 of file spdefs.h.

#define CMPLX_MULT_ADD (   to,
  mult_a,
  mult_b,
  add 
)
Value:
{ (to).Real = (mult_a).Real * (mult_b).Real - \
(mult_a).Imag * (mult_b).Imag + (add).Real; \
(to).Imag = (mult_a).Real * (mult_b).Imag + \
(mult_a).Imag * (mult_b).Real + (add).Imag; \
}

Definition at line 260 of file spdefs.h.

#define CMPLX_MULT_ADD_ASSIGN (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real += (from_a).Real * (from_b).Real - \
(from_a).Imag * (from_b).Imag; \
(to).Imag += (from_a).Real * (from_b).Imag + \
(from_a).Imag * (from_b).Real; \
}

Definition at line 288 of file spdefs.h.

#define CMPLX_MULT_ASSIGN (   to,
  from 
)
Value:
{ RealNumber to_real_ = (to).Real; \
(to).Real = to_real_ * (from).Real - \
(to).Imag * (from).Imag; \
(to).Imag = to_real_ * (from).Imag + \
(to).Imag * (from).Real; \
}
spREAL RealNumber
Definition: spdefs.h:458

Definition at line 241 of file spdefs.h.

#define CMPLX_MULT_SUBT (   to,
  mult_a,
  mult_b,
  subt 
)
Value:
{ (to).Real = (subt).Real - (mult_a).Real * (mult_b).Real + \
(mult_a).Imag * (mult_b).Imag; \
(to).Imag = (subt).Imag - (mult_a).Real * (mult_b).Imag - \
(mult_a).Imag * (mult_b).Real; \
}

Definition at line 269 of file spdefs.h.

#define CMPLX_MULT_SUBT_ASSIGN (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real -= (from_a).Real * (from_b).Real - \
(from_a).Imag * (from_b).Imag; \
(to).Imag -= (from_a).Real * (from_b).Imag + \
(from_a).Imag * (from_b).Real; \
}

Definition at line 297 of file spdefs.h.

#define CMPLX_NEGATE (   a)
Value:
{ (a).Real = -(a).Real; \
(a).Imag = -(a).Imag; \
}
Definition: sced.h:120

Definition at line 182 of file spdefs.h.

#define CMPLX_NEGATE_ASSIGN (   to,
  from 
)
Value:
{ (to).Real = -(from).Real; \
(to).Imag = -(from).Imag; \
}

Definition at line 173 of file spdefs.h.

#define CMPLX_RECIPROCAL (   to,
  den 
)
Value:
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));\
} \
}
if(TDesc==NULL)
Definition: cd.c:1326
#define OR
Definition: spdefs.h:117
#define AND
Definition: spdefs.h:116
spREAL RealNumber
Definition: spdefs.h:458

Definition at line 367 of file spdefs.h.

#define CMPLX_SUBT (   to,
  from_a,
  from_b 
)
Value:
{ (to).Real = (from_a).Real - (from_b).Real; \
(to).Imag = (from_a).Imag - (from_b).Imag; \
}

Definition at line 203 of file spdefs.h.

#define CMPLX_SUBT_ASSIGN (   to,
  from 
)
Value:
{ (to).Real -= (from).Real; \
(to).Imag -= (from).Imag; \
}

Definition at line 215 of file spdefs.h.

#define ELEMENT_MAG (   ptr)    ((ptr)->Real < 0.0 ? -(ptr)->Real : (ptr)->Real)

Definition at line 161 of file spdefs.h.

#define FREE (   ptr)    { if ((ptr) != NULL) txfree((char *)(ptr)); (ptr) = NULL; }

Definition at line 436 of file spdefs.h.

#define IMAG_RHS

Definition at line 430 of file spdefs.h.

#define IMAG_VECTORS

Definition at line 429 of file spdefs.h.

#define IS_FACTORED (   matrix)    ((matrix)->Factored && !(matrix)->NeedsOrdering)

Definition at line 131 of file spdefs.h.

#define IS_SPARSE (   matrix)
Value:
((matrix) != NULL && \
(matrix)->ID == SPARSE_ID)
#define NULL
Definition: spdefs.h:121
#define SPARSE_ID
Definition: spdefs.h:124

Definition at line 125 of file spdefs.h.

#define IS_VALID (   matrix)
Value:
((matrix) != NULL && \
(matrix)->ID == SPARSE_ID && \
(matrix)->Error >= spOKAY && \
(matrix)->Error < spFATAL)
#define spOKAY
Definition: spmatrix.h:101
#define spFATAL
Definition: spmatrix.h:108
#define NULL
Definition: spdefs.h:121
#define SPARSE_ID
Definition: spdefs.h:124

Definition at line 127 of file spdefs.h.

#define LINT   NO

Definition at line 91 of file spdefs.h.

#define MAX (   a,
 
)    ((a) > (b) ? (a) : (b))

Definition at line 135 of file spdefs.h.

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 136 of file spdefs.h.

#define NO   0

Definition at line 113 of file spdefs.h.

#define NOT   !

Definition at line 115 of file spdefs.h.

#define NULL   0

Definition at line 121 of file spdefs.h.

#define OR   ||

Definition at line 117 of file spdefs.h.

#define REALLOC (   ptr,
  type,
  number 
)    ptr = (type *)trealloc((char *)ptr,(unsigned)(sizeof(type)*(number)))

Definition at line 434 of file spdefs.h.

#define SCLR_MULT (   to,
  sclr,
  cmplx 
)
Value:
{ (to).Real = (sclr) * (cmplx).Real; \
(to).Imag = (sclr) * (cmplx).Imag; \
}

Definition at line 221 of file spdefs.h.

#define SCLR_MULT_ASSIGN (   to,
  sclr 
)
Value:
{ (to).Real *= (sclr); \
(to).Imag *= (sclr); \
}

Definition at line 227 of file spdefs.h.

#define SPARSE_ID   0x772773 /* Arbitrary (is Sparse on phone). */

Definition at line 124 of file spdefs.h.

#define SQR (   a)    ((a)*(a))

Definition at line 142 of file spdefs.h.

#define SWAP (   type,
  a,
 
)    {type swapx; swapx = a; a = b; b = swapx;}

Definition at line 145 of file spdefs.h.

#define YES   1

Definition at line 114 of file spdefs.h.

Typedef Documentation

Definition at line 585 of file spdefs.h.

Definition at line 554 of file spdefs.h.

typedef struct ComplexNumber * ComplexVector
typedef struct MatrixElement* ElementPtr

Definition at line 553 of file spdefs.h.

typedef struct MatrixFrame* MatrixPtr

Definition at line 871 of file spdefs.h.

typedef spREAL RealNumber

Definition at line 458 of file spdefs.h.

typedef spREAL * RealVector

Definition at line 458 of file spdefs.h.

Function Documentation

void spcColExchange ( )
ElementPtr spcCreateElement ( )
void spcCreateInternalVectors ( )
ElementPtr spcFindElementInCol ( )
ElementPtr spcGetElement ( )
ElementPtr spcGetFillin ( )
void spcLinkRows ( )
void spcRowExchange ( )