#include "spconfig.h"
#include "spmatrix.h"
#include "spdefs.h"
Go to the source code of this file.
|
static void | Translate () |
|
static void | EnlargeMatrix () |
|
static void | ExpandTranslationArrays () |
|
void | spItoR (char *eMatrix) |
|
void | spRtoI (char *eMatrix) |
|
void | spLoadGmin (char *Matrixp, double Gmin) |
|
void | spGetStat (char *Matrixp, int *Size, int *NonZero, int *FillIns) |
|
int | spAddCol (char *Matrixp, int Accum_Col, int Addend_Col) |
|
int | spZeroCol (char *Matrixp, int Col) |
|
static double | my_logb (double x) |
|
static double | my_scalb (double x, int n) |
|
int | spDProd (char *Matrix, double *pMantissaR, double *pMantissaI, int *pExponent) |
|
void | spClear (char *eMatrix) |
|
RealNumber * | spGetElement (char *eMatrix, int Row, int Col) |
|
ElementPtr | spcFindElementInCol (MatrixPtr Matrix, ElementPtr *LastAddr, int Row, int Col, BOOLEAN CreateIfMissing) |
|
ElementPtr | spcCreateElement (MatrixPtr Matrix, int Row, int Col, ElementPtr *LastAddr, BOOLEAN Fillin) |
|
void | spcLinkRows (MatrixPtr Matrix) |
|
static void | EnlargeMatrix (MatrixPtr Matrix, int NewSize) |
|
#define M_LN10 2.30258509299404568402 |
#define M_LN2 0.69314718055994530942 |
static void EnlargeMatrix |
( |
| ) |
|
|
static |
static void EnlargeMatrix |
( |
MatrixPtr |
Matrix, |
|
|
int |
NewSize |
|
) |
| |
|
static |
Definition at line 1313 of file spbuild.c.
1321 Matrix->
Size = NewSize;
1323 if (NewSize <= OldAllocatedSize)
1327 NewSize =
MAX( NewSize, EXPANSION_FACTOR * OldAllocatedSize );
1364 for (I = OldAllocatedSize+1; I <= NewSize; I++)
ArrayOfElementPtrs FirstInRow
BOOLEAN InternalVectorsAllocated
#define REALLOC(ptr, type, number)
ArrayOfElementPtrs FirstInCol
static void ExpandTranslationArrays |
( |
| ) |
|
|
static |
static double my_logb |
( |
double |
x | ) |
|
|
static |
static double my_scalb |
( |
double |
x, |
|
|
int |
n |
|
) |
| |
|
static |
Definition at line 363 of file spbuild.c.
368 double y, z = 1.0, k = 2.0;
376 for (y = 1.0; n; n >>= 1) {
int spAddCol |
( |
char * |
Matrixp, |
|
|
int |
Accum_Col, |
|
|
int |
Addend_Col |
|
) |
| |
Definition at line 270 of file spbuild.c.
284 while (Addend !=
NULL) {
285 while (Accum && Accum->
Row < Addend->
Row) {
289 if (!Accum || Accum->
Row > Addend->
Row) {
294 Accum->Imag += Addend->Imag;
298 return spError( (
char *)Matrix );
struct MatrixElement * NextInCol
ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr *LastAddr, BOOLEAN Fillin)
struct MatrixFrame * MatrixPtr
ArrayOfElementPtrs FirstInCol
Definition at line 1115 of file spbuild.c.
1146 pElement->
Row = Row;
1147 pElement->
Col = Col;
1148 pElement->
Real = 0.0;
1150 pElement->Imag = 0.0;
1153 pElement->pInitInfo =
NULL;
1162 pLastElement =
NULL;
1163 while (pElement !=
NULL)
1166 if (pElement->
Col < Col)
1172 else pElement =
NULL;
1176 pElement = pCreatedElement;
1177 if (pLastElement ==
NULL)
1207 pElement->
Row = Row;
1209 pElement->
Col = Col;
1211 pElement->
Real = 0.0;
1213 pElement->Imag = 0.0;
1216 pElement->pInitInfo =
NULL;
1225 return pCreatedElement;
ElementPtr spcGetElement()
ArrayOfElementPtrs FirstInRow
struct MatrixElement * NextInCol
register ElementPtr pElement
ElementPtr spcGetFillin()
struct MatrixElement * NextInRow
Definition at line 692 of file spbuild.c.
704 pElement = *LastAddr;
707 while (pElement !=
NULL)
708 {
if (pElement->
Row < Row)
714 else if (pElement->
Row == Row)
struct MatrixElement * NextInCol
register ElementPtr pElement
ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr *LastAddr, BOOLEAN Fillin)
void spClear |
( |
char * |
eMatrix | ) |
|
Definition at line 492 of file spbuild.c.
506 {
for (I = Matrix->
Size; I > 0; I--)
508 while (pElement !=
NULL)
509 { pElement->
Real = 0.0;
510 pElement->Imag = 0.0;
517 {
for (I = Matrix->
Size; I > 0; I--)
519 while (pElement !=
NULL)
520 { pElement->
Real = 0.0;
#define IS_SPARSE(matrix)
BOOLEAN PreviousMatrixWasComplex
struct MatrixElement * NextInCol
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
register ElementPtr pElement
struct MatrixElement TrashCan
struct MatrixFrame * MatrixPtr
ArrayOfElementPtrs FirstInCol
Definition at line 1262 of file spbuild.c.
1272 for (Col = Matrix->
Size; Col >= 1; Col--)
1277 while (pElement !=
NULL)
1278 { pElement->
Col = Col;
1279 FirstInRowEntry = &FirstInRowArray[pElement->
Row];
ArrayOfElementPtrs FirstInRow
struct MatrixElement * NextInCol
register ElementPtr pElement
struct MatrixElement * NextInRow
ArrayOfElementPtrs FirstInCol
int spDProd |
( |
char * |
Matrix, |
|
|
double * |
pMantissaR, |
|
|
double * |
pMantissaI, |
|
|
int * |
pExponent |
|
) |
| |
Definition at line 390 of file spbuild.c.
397 double re, im, x, y, z;
403 printf(
"Determinant 10: (%20g,%20g)^%d\n", re, im, p);
417 printf(
" ** base10 -> base2 int = %g, frac = %20g\n", x, y);
423 printf(
" ** multiplier = %20g\n", z);
434 else if (im != 0.0) {
446 printf(
" ** renormalize changes = %g,%g\n", y, z);
455 printf(
" ** values are: re %g, im %g, y %g, re' %g, im' %g\n",
458 *pMantissaR =
my_scalb(re, (
int) -y);
459 *pMantissaI =
my_scalb(im, (
int) -y);
462 printf(
"Determinant 10->2: (%20g,%20g)^%d\n", *pMantissaR,
463 *pMantissaI, *pExponent);
465 return spError( (
char *)Matrix );
static double my_logb(double x)
static double my_scalb(double x, int n)
RealNumber* spGetElement |
( |
char * |
eMatrix, |
|
|
int |
Row, |
|
|
int |
Col |
|
) |
| |
Definition at line 586 of file spbuild.c.
599 if ((Row == 0)
OR (Col == 0))
618 if ((Row > Matrix->
Size)
OR (Col > Matrix->
Size))
#define IS_SPARSE(matrix)
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
register ElementPtr pElement
struct MatrixElement TrashCan
ElementPtr spcFindElementInCol(MatrixPtr Matrix, ElementPtr *LastAddr, int Row, int Col, BOOLEAN CreateIfMissing)
struct MatrixFrame * MatrixPtr
static void EnlargeMatrix()
ArrayOfElementPtrs FirstInCol
void spGetStat |
( |
char * |
Matrixp, |
|
|
int * |
Size, |
|
|
int * |
NonZero, |
|
|
int * |
FillIns |
|
) |
| |
Definition at line 252 of file spbuild.c.
struct MatrixFrame * MatrixPtr
void spItoR |
( |
char * |
eMatrix | ) |
|
Definition at line 120 of file spbuild.c.
132 {
for (I = Matrix->
Size; I > 0; I--)
134 while (pElement !=
NULL)
#define IS_SPARSE(matrix)
BOOLEAN PreviousMatrixWasComplex
struct MatrixElement * NextInCol
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
register ElementPtr pElement
struct MatrixElement TrashCan
struct MatrixFrame * MatrixPtr
ArrayOfElementPtrs FirstInCol
void spLoadGmin |
( |
char * |
Matrixp, |
|
|
double |
Gmin |
|
) |
| |
Definition at line 224 of file spbuild.c.
239 for (I = Matrix->
Size; I > 0; I--) {
#define IS_SPARSE(matrix)
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
struct MatrixFrame * MatrixPtr
void spRtoI |
( |
char * |
eMatrix | ) |
|
Definition at line 176 of file spbuild.c.
188 {
for (I = Matrix->
Size; I > 0; I--)
190 while (pElement !=
NULL)
#define IS_SPARSE(matrix)
BOOLEAN PreviousMatrixWasComplex
struct MatrixElement * NextInCol
ASSERT(IS_VALID(Matrix) AND IS_FACTORED(Matrix))
register ElementPtr pElement
struct MatrixElement TrashCan
struct MatrixFrame * MatrixPtr
ArrayOfElementPtrs FirstInCol
int spZeroCol |
( |
char * |
Matrixp, |
|
|
int |
Col |
|
) |
| |
Definition at line 306 of file spbuild.c.
322 return spError( (
char *)Matrix );
struct MatrixElement * NextInCol
struct MatrixFrame * MatrixPtr
ArrayOfElementPtrs FirstInCol
static void Translate |
( |
| ) |
|
|
static |