56 #define spINSIDE_SPARSE
93 for (I =
Matrix->Size; I > 0; I--) {
94 pElement =
Matrix->FirstInCol[I];
95 while (pElement !=
NULL) {
103 Matrix->TrashCan.Real = 0.0;
159 if ((Row == 0)
OR(Col == 0))
160 return &
Matrix->TrashCan.Real;
165 ASSERT(Row <= Matrix->Size
AND Col <= Matrix->Size);
194 &(
Matrix->FirstInCol[Col]),
237 pElement = *LastAddr;
240 while (pElement !=
NULL) {
241 if (pElement->
Row < Row) {
245 }
else if (pElement->
Row == Row) {
503 if (pElement ==
NULL)
508 Matrix->Diag[Row] = pElement;
511 pCreatedElement = pElement;
514 pElement->
Real = 0.0;
516 pElement->pInitInfo =
NULL;
521 *LastAddr = pElement;
524 pElement =
Matrix->FirstInRow[Row];
526 while (pElement !=
NULL) {
528 if (pElement->
Col < Col) {
530 pLastElement = pElement;
537 pElement = pCreatedElement;
538 if (pLastElement ==
NULL) {
541 Matrix->FirstInRow[Row] = pElement;
557 if (pElement ==
NULL)
562 Matrix->Diag[Row] = pElement;
565 pCreatedElement = pElement;
570 pElement->
Real = 0.0;
572 pElement->pInitInfo =
NULL;
577 *LastAddr = pElement;
581 return pCreatedElement;
615 FirstInRowArray =
Matrix->FirstInRow;
616 for (Col =
Matrix->Size; Col >= 1; Col--) {
618 pElement =
Matrix->FirstInCol[Col];
620 while (pElement !=
NULL) {
622 FirstInRowEntry = &FirstInRowArray[pElement->
Row];
624 *FirstInRowEntry = pElement;
650 int I, OldAllocatedSize =
Matrix->AllocatedSize;
655 if (NewSize <= OldAllocatedSize)
659 NewSize =
MAX(NewSize, EXPANSION_FACTOR * OldAllocatedSize);
660 Matrix->AllocatedSize = NewSize;
693 Matrix->InternalVectorsAllocated =
NO;
696 for (I = OldAllocatedSize + 1; I <= NewSize; I++) {
697 Matrix->IntToExtColMap[I] = I;
698 Matrix->IntToExtRowMap[I] = I;
745 ((
ElementPtr)pElement)->pInitInfo = pInitInfo;
753 return (
char*)((
ElementPtr)pElement)->pInitInfo;
770 for (J =
Matrix->Size; J > 0; J--) {
771 pElement =
Matrix->FirstInCol[J];
772 Col =
Matrix->IntToExtColMap[J];
773 while (pElement !=
NULL) {
774 if (pElement->pInitInfo ==
NULL) {
775 pElement->
Real = 0.0;
777 Error = (*pInit)((
RealNumber*)pElement, pElement->pInitInfo,
778 Matrix->IntToExtRowMap[pElement->Row], Col);
789 Matrix->TrashCan.Real = 0.0;
ElementPtr spcFindElementInCol(MatrixPtr Matrix, ElementPtr *LastAddr, int Row, int Col, BOOLEAN CreateIfMissing)
int spGetOnes(char *Matrix, int Pos, int Neg, int Eqn, spTemplate *Template)
int spGetQuad(char *Matrix, int Row1, int Row2, int Col1, int Col2, spTemplate *Template)
void spcLinkRows(MatrixPtr Matrix)
ElementPtr spcGetFillin(MatrixPtr Matrix)
void spClear(char *eMatrix)
static void EnlargeMatrix(MatrixPtr Matrix, int NewSize)
ElementPtr spcGetElement(MatrixPtr Matrix)
RealNumber * spGetElement(char *eMatrix, int Row, int Col)
ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr *LastAddr, BOOLEAN Fillin)
int spGetAdmittance(char *Matrix, int Node1, int Node2, spTemplate *Template)
#define REALLOC(ptr, type, number)
struct MatrixFrame * MatrixPtr
struct MatrixElement * ElementPtr
#define ASSERT(condition)
#define IS_SPARSE(matrix)
char * spGetInitInfo(spREAL *)
#define spADD_REAL_QUAD(template, real)
void spInstallInitInfo(spREAL *, char *)
int spInitialize(char *, int(*)())
struct MatrixElement * NextInCol
struct MatrixElement * NextInRow