57 #define spINSIDE_SPARSE
186 int Step, Size, ReorderingRequired;
194 if (RelThreshold <= 0.0)
195 RelThreshold =
Matrix->RelThreshold;
196 if (RelThreshold > 1.0)
197 RelThreshold =
Matrix->RelThreshold;
198 Matrix->RelThreshold = RelThreshold;
199 if (AbsThreshold < 0.0)
200 AbsThreshold =
Matrix->AbsThreshold;
201 Matrix->AbsThreshold = AbsThreshold;
202 ReorderingRequired =
NO;
206 for (Step = 1; Step <= Size; Step++) {
207 pPivot =
Matrix->Diag[Step];
209 if ((LargestInCol * RelThreshold <
ELEMENT_MAG(pPivot))) {
212 ReorderingRequired =
YES;
216 if (
NOT ReorderingRequired)
224 #if ANNOTATE >= ON_STRANGE_BEHAVIOR
225 printf(
"Reordering, Step = %1d\n", Step);
239 if (
NOT Matrix->InternalVectorsAllocated)
248 Matrix->MaxRowCountInLowerTri = -1;
251 for (; Step <= Size; Step++) {
264 WriteStatus(
Matrix, Step);
318 if (
Matrix->NeedsOrdering) {
320 0.0, 0.0, DIAG_PIVOTING_AS_DEFAULT);
328 if (
Matrix->Diag[1]->Real == 0.0)
333 for (Step = 2; Step <= Size; Step++) {
334 if (
Matrix->DoRealDirect[Step]) {
338 pElement =
Matrix->FirstInCol[Step];
339 while (pElement !=
NULL) {
340 Dest[pElement->
Row] = pElement->
Real;
345 pColumn =
Matrix->FirstInCol[Step];
346 while (pColumn->
Row < Step) {
348 pColumn->
Real = Dest[pColumn->
Row] * pElement->
Real;
350 Dest[pElement->
Row] -= pColumn->
Real * pElement->
Real;
355 pElement =
Matrix->Diag[Step]->NextInCol;
356 while (pElement !=
NULL) {
357 pElement->
Real = Dest[pElement->
Row];
362 if (Dest[Step] == 0.0)
364 Matrix->Diag[Step]->Real = 1.0 / Dest[Step];
369 pElement =
Matrix->FirstInCol[Step];
370 while (pElement !=
NULL) {
371 pDest[pElement->
Row] = &pElement->
Real;
376 pColumn =
Matrix->FirstInCol[Step];
377 while (pColumn->
Row < Step) {
379 Mult = (*pDest[pColumn->
Row] *= pElement->
Real);
381 *pDest[pElement->
Row] -= Mult * pElement->
Real;
386 if (
Matrix->Diag[Step]->Real == 0.0)
388 Matrix->Diag[Step]->Real = 1.0 /
Matrix->Diag[Step]->Real;
447 DoRealDirect =
Matrix->DoRealDirect;
452 Mode = DEFAULT_PARTITION;
454 for (Step = 1; Step <= Size; Step++)
456 DoRealDirect[Step] =
YES;
460 for (Step = 1; Step <= Size; Step++)
462 DoRealDirect[Step] =
NO;
469 Nc = (
int*)
Matrix->MarkowitzRow;
470 No = (
int*)
Matrix->MarkowitzCol;
471 Nm = (
int*)
Matrix->MarkowitzProd;
474 for (Step = 1; Step <= Size; Step++) {
475 Nc[Step] = No[Step] = Nm[Step] = 0;
477 pElement =
Matrix->FirstInCol[Step];
478 while (pElement !=
NULL) {
483 pColumn =
Matrix->FirstInCol[Step];
484 while (pColumn->
Row < Step) {
493 for (Step = 1; Step <= Size; Step++) {
507 DoRealDirect[Step] = (Nm[Step] + No[Step] > 3 * Nc[Step] - 2 * Nm[Step]);
511 #if (ANNOTATE == FULL)
514 for (Step = 1; Step <= Size; Step++)
516 printf(
"Operation count for inner loop of factorization = %d.\n", Ops);
608 int Count, I, Size =
Matrix->Size;
621 for (I = Step; I <= Size; I++) {
624 pElement =
Matrix->FirstInRow[I];
625 while (pElement !=
NULL AND pElement->
Col < Step)
627 while (pElement !=
NULL) {
633 ExtRow =
Matrix->IntToExtRowMap[I];
636 if (
RHS[ExtRow] != 0.0)
638 Matrix->MarkowitzRow[I] = Count;
642 for (I = Step; I <= Size; I++) {
645 pElement =
Matrix->FirstInCol[I];
646 while (pElement !=
NULL AND pElement->
Row < Step)
648 while (pElement !=
NULL) {
652 Matrix->MarkowitzCol[I] = Count;
687 int I, *pMarkowitzRow, *pMarkowitzCol;
688 long Product, *pMarkowitzProduct;
695 pMarkowitzProduct = &(
Matrix->MarkowitzProd[Step]);
696 pMarkowitzRow = &(
Matrix->MarkowitzRow[Step]);
697 pMarkowitzCol = &(
Matrix->MarkowitzCol[Step]);
699 for (I = Step; I <= Size; I++) {
701 if ((*pMarkowitzRow > SHRT_MAX
AND * pMarkowitzCol != 0)
OR(*pMarkowitzCol > SHRT_MAX
AND * pMarkowitzRow != 0)) {
702 fProduct = (double)(*pMarkowitzRow++) * (double)(*pMarkowitzCol++);
703 if (fProduct >= (
double)LONG_MAX)
704 *pMarkowitzProduct++ = LONG_MAX;
706 *pMarkowitzProduct++ = fProduct;
708 Product = *pMarkowitzRow++ * *pMarkowitzCol++;
709 if ((*pMarkowitzProduct++ = Product) == 0)
764 if (ChosenPivot !=
NULL) {
765 Matrix->PivotSelectionMethod =
's';
770 #if DIAGONAL_PIVOTING
779 if (ChosenPivot !=
NULL) {
780 Matrix->PivotSelectionMethod =
'q';
789 if (ChosenPivot !=
NULL) {
790 Matrix->PivotSelectionMethod =
'd';
798 Matrix->PivotSelectionMethod =
'e';
843 long* pMarkowitzProduct;
849 pMarkowitzProduct = &(
Matrix->MarkowitzProd[
Matrix->Size + 1]);
854 Singletons =
Matrix->Singletons--;
861 Matrix->MarkowitzProd[Step - 1] = 0;
863 while (Singletons-- > 0) {
885 while (*pMarkowitzProduct--) {
892 I = pMarkowitzProduct -
Matrix->MarkowitzProd + 1;
901 if ((ChosenPivot =
Matrix->Diag[I]) !=
NULL) {
910 if (
Matrix->MarkowitzCol[I] == 0) {
911 ChosenPivot =
Matrix->FirstInCol[I];
912 while ((ChosenPivot !=
NULL)
AND(ChosenPivot->
Row < Step))
920 if (
Matrix->MarkowitzRow[I] == 0) {
921 ChosenPivot =
Matrix->FirstInRow[I];
922 while ((ChosenPivot !=
NULL)
AND(ChosenPivot->
Col < Step))
932 ChosenPivot =
Matrix->FirstInRow[I];
933 while ((ChosenPivot !=
NULL)
AND(ChosenPivot->
Col < Step))
953 #if DIAGONAL_PIVOTING
954 #if MODIFIED_MARKOWITZ
1024 long MinMarkowitzProduct, *pMarkowitzProduct;
1026 int I, NumberOfTies;
1027 ElementPtr ChosenPivot, TiedElements[MAX_MARKOWITZ_TIES + 1];
1028 RealNumber Magnitude, LargestInCol, Ratio, MaxRatio;
1033 MinMarkowitzProduct = LONG_MAX;
1034 pMarkowitzProduct = &(
Matrix->MarkowitzProd[
Matrix->Size + 2]);
1038 Matrix->MarkowitzProd[Step - 1] = -1;
1061 while (MinMarkowitzProduct < *(--pMarkowitzProduct)) {
1069 I = pMarkowitzProduct -
Matrix->MarkowitzProd;
1082 if (*pMarkowitzProduct == 1) {
1088 if (pOtherInRow ==
NULL AND pOtherInCol ==
NULL) {
1089 pOtherInRow =
Matrix->FirstInRow[I];
1090 while (pOtherInRow !=
NULL) {
1091 if (pOtherInRow->
Col >= Step
AND pOtherInRow->
Col != I)
1095 pOtherInCol =
Matrix->FirstInCol[I];
1096 while (pOtherInCol !=
NULL) {
1097 if (pOtherInCol->
Row >= Step
AND pOtherInCol->
Row != I)
1105 if (pOtherInRow !=
NULL AND pOtherInCol !=
NULL) {
1106 if (pOtherInRow->
Col == pOtherInCol->
Row) {
1109 if (Magnitude >= LargestOffDiagonal) {
1117 if (*pMarkowitzProduct < MinMarkowitzProduct) {
1119 TiedElements[0] = pDiag;
1120 MinMarkowitzProduct = *pMarkowitzProduct;
1124 if (NumberOfTies < MAX_MARKOWITZ_TIES) {
1125 TiedElements[++NumberOfTies] = pDiag;
1126 if (NumberOfTies >= MinMarkowitzProduct * TIES_MULTIPLIER)
1133 if (NumberOfTies < 0)
1138 MaxRatio = 1.0 /
Matrix->RelThreshold;
1140 for (I = 0; I <= NumberOfTies; I++) {
1141 pDiag = TiedElements[I];
1144 Ratio = LargestInCol / Magnitude;
1145 if (Ratio < MaxRatio) {
1146 ChosenPivot = pDiag;
1206 long MinMarkowitzProduct, *pMarkowitzProduct;
1209 ElementPtr ChosenPivot, pOtherInRow, pOtherInCol;
1210 RealNumber Magnitude, LargestInCol, LargestOffDiagonal;
1214 MinMarkowitzProduct = LONG_MAX;
1215 pMarkowitzProduct = &(
Matrix->MarkowitzProd[
Matrix->Size + 2]);
1219 Matrix->MarkowitzProd[Step - 1] = -1;
1242 while (*(--pMarkowitzProduct) >= MinMarkowitzProduct) {
1245 I = pMarkowitzProduct -
Matrix->MarkowitzProd;
1258 if (*pMarkowitzProduct == 1) {
1264 if (pOtherInRow ==
NULL AND pOtherInCol ==
NULL) {
1265 pOtherInRow =
Matrix->FirstInRow[I];
1266 while (pOtherInRow !=
NULL) {
1267 if (pOtherInRow->
Col >= Step
AND pOtherInRow->
Col != I)
1271 pOtherInCol =
Matrix->FirstInCol[I];
1272 while (pOtherInCol !=
NULL) {
1273 if (pOtherInCol->
Row >= Step
AND pOtherInCol->
Row != I)
1281 if (pOtherInRow !=
NULL AND pOtherInCol !=
NULL) {
1282 if (pOtherInRow->
Col == pOtherInCol->
Row) {
1285 if (Magnitude >= LargestOffDiagonal) {
1293 MinMarkowitzProduct = *pMarkowitzProduct;
1294 ChosenPivot = pDiag;
1297 if (ChosenPivot !=
NULL) {
1359 long MinMarkowitzProduct, *pMarkowitzProduct;
1362 int NumberOfTies = 0, Size =
Matrix->Size;
1364 RealNumber Magnitude, Ratio, RatioOfAccepted = 0.0, LargestInCol;
1368 MinMarkowitzProduct = LONG_MAX;
1369 pMarkowitzProduct = &(
Matrix->MarkowitzProd[Size + 2]);
1370 Matrix->MarkowitzProd[Size + 1] =
Matrix->MarkowitzProd[Step];
1373 for (J = Size + 1; J > Step; J--) {
1374 if (*(--pMarkowitzProduct) > MinMarkowitzProduct)
1387 if (Magnitude <= Matrix->RelThreshold * LargestInCol)
1390 if (*pMarkowitzProduct < MinMarkowitzProduct) {
1392 ChosenPivot = pDiag;
1393 MinMarkowitzProduct = *pMarkowitzProduct;
1394 RatioOfAccepted = LargestInCol / Magnitude;
1399 Ratio = LargestInCol / Magnitude;
1400 if (Ratio < RatioOfAccepted) {
1401 ChosenPivot = pDiag;
1402 RatioOfAccepted = Ratio;
1404 if (NumberOfTies >= MinMarkowitzProduct * TIES_MULTIPLIER)
1469 int I, Size =
Matrix->Size;
1471 int NumberOfTies = 0;
1472 long Product, MinMarkowitzProduct;
1474 RealNumber Magnitude, LargestElementMag, Ratio, RatioOfAccepted = 0.0, LargestInCol;
1478 LargestElementMag = 0.0;
1479 MinMarkowitzProduct = LONG_MAX;
1482 for (I = Step; I <= Size; I++) {
1483 pElement =
Matrix->FirstInCol[I];
1485 while (pElement !=
NULL AND pElement->
Row < Step)
1491 while (pElement !=
NULL) {
1494 if ((Magnitude =
ELEMENT_MAG(pElement)) > LargestElementMag) {
1495 LargestElementMag = Magnitude;
1496 pLargestElement = pElement;
1502 if ((Product <= MinMarkowitzProduct)
AND(Magnitude >
Matrix->RelThreshold * LargestInCol)
AND(Magnitude >
Matrix->AbsThreshold)) {
1505 if (Product < MinMarkowitzProduct) {
1507 ChosenPivot = pElement;
1508 MinMarkowitzProduct = Product;
1509 RatioOfAccepted = LargestInCol / Magnitude;
1514 Ratio = LargestInCol / Magnitude;
1515 if (Ratio < RatioOfAccepted) {
1516 ChosenPivot = pElement;
1517 RatioOfAccepted = Ratio;
1519 if (NumberOfTies >= MinMarkowitzProduct * TIES_MULTIPLIER)
1527 if (ChosenPivot !=
NULL)
1530 if (LargestElementMag == 0.0) {
1536 return pLargestElement;
1573 while (pElement !=
NULL) {
1574 if ((Magnitude =
ELEMENT_MAG(pElement)) > Largest)
1575 Largest = Magnitude;
1628 Row = pElement->
Row;
1629 Col = pElement->
Col;
1630 pElement =
Matrix->FirstInCol[Col];
1633 while ((pElement !=
NULL)
AND(pElement->
Row < Step))
1637 if (pElement->
Row != Row)
1644 if ((Magnitude =
ELEMENT_MAG(pElement)) > Largest) {
1645 if (pElement->
Row != Row)
1646 Largest = Magnitude;
1690 long OldMarkowitzProd_Step, OldMarkowitzProd_Row, OldMarkowitzProd_Col;
1695 Matrix->PivotsOriginalRow = Row;
1696 Matrix->PivotsOriginalCol = Col;
1698 if ((Row == Step)
AND(Col == Step))
1710 OldMarkowitzProd_Step =
Matrix->MarkowitzProd[Step];
1711 OldMarkowitzProd_Row =
Matrix->MarkowitzProd[Row];
1712 OldMarkowitzProd_Col =
Matrix->MarkowitzProd[Col];
1717 Matrix->NumberOfInterchangesIsOdd =
NOT Matrix->NumberOfInterchangesIsOdd;
1721 if ((
Matrix->MarkowitzProd[Row] == 0) != (OldMarkowitzProd_Row == 0)) {
1722 if (OldMarkowitzProd_Row == 0)
1732 Matrix->NumberOfInterchangesIsOdd =
NOT Matrix->NumberOfInterchangesIsOdd;
1736 if ((
Matrix->MarkowitzProd[Col] == 0) != (OldMarkowitzProd_Col == 0)) {
1737 if (OldMarkowitzProd_Col == 0)
1744 Matrix->FirstInCol + Col,
1749 Matrix->FirstInCol + Row,
1753 Matrix->FirstInCol + Step,
1757 Matrix->MarkowitzProd[Step] =
Matrix->MarkowitzCol[Step] *
Matrix->MarkowitzRow[Step];
1758 if ((
Matrix->MarkowitzProd[Step] == 0) != (OldMarkowitzProd_Step == 0)) {
1759 if (OldMarkowitzProd_Step == 0)
1805 SWAP(
int, Row1, Row2);
1807 Row1Ptr =
Matrix->FirstInRow[Row1];
1808 Row2Ptr =
Matrix->FirstInRow[Row2];
1811 if (Row1Ptr ==
NULL) {
1812 Column = Row2Ptr->
Col;
1816 }
else if (Row2Ptr ==
NULL) {
1817 Column = Row1Ptr->
Col;
1821 }
else if (Row1Ptr->
Col < Row2Ptr->
Col) {
1822 Column = Row1Ptr->
Col;
1826 }
else if (Row1Ptr->
Col > Row2Ptr->
Col) {
1827 Column = Row2Ptr->
Col;
1833 Column = Row1Ptr->
Col;
1843 if (
Matrix->InternalVectorsAllocated)
1888 SWAP(
int, Col1, Col2);
1890 Col1Ptr =
Matrix->FirstInCol[Col1];
1891 Col2Ptr =
Matrix->FirstInCol[Col2];
1894 if (Col1Ptr ==
NULL) {
1899 }
else if (Col2Ptr ==
NULL) {
1904 }
else if (Col1Ptr->
Row < Col2Ptr->
Row) {
1909 }
else if (Col1Ptr->
Row > Col2Ptr->
Row) {
1926 if (
Matrix->InternalVectorsAllocated)
1972 ElementPtr *ElementAboveRow1, *ElementAboveRow2;
1973 ElementPtr ElementBelowRow1, ElementBelowRow2;
1978 ElementAboveRow1 = &(
Matrix->FirstInCol[Column]);
1979 pElement = *ElementAboveRow1;
1980 while (pElement->
Row < Row1) {
1981 ElementAboveRow1 = &(pElement->
NextInCol);
1982 pElement = *ElementAboveRow1;
1984 if (Element1 !=
NULL) {
1986 if (Element2 ==
NULL) {
1988 if (ElementBelowRow1 !=
NULL AND ElementBelowRow1->
Row < Row2) {
1990 *ElementAboveRow1 = ElementBelowRow1;
1993 pElement = ElementBelowRow1;
1995 ElementAboveRow2 = &(pElement->
NextInCol);
1996 pElement = *ElementAboveRow2;
1997 }
while (pElement !=
NULL AND pElement->
Row < Row2);
2000 *ElementAboveRow2 = Element1;
2002 *ElementAboveRow1 = ElementBelowRow1;
2004 Element1->
Row = Row2;
2007 if (ElementBelowRow1->
Row == Row2) {
2011 *ElementAboveRow1 = Element2;
2014 pElement = ElementBelowRow1;
2016 ElementAboveRow2 = &(pElement->
NextInCol);
2017 pElement = *ElementAboveRow2;
2018 }
while (pElement->
Row < Row2);
2023 *ElementAboveRow1 = Element2;
2025 *ElementAboveRow2 = Element1;
2028 Element1->
Row = Row2;
2029 Element2->
Row = Row1;
2033 ElementBelowRow1 = pElement;
2036 if (ElementBelowRow1->
Row != Row2) {
2038 ElementAboveRow2 = &(pElement->
NextInCol);
2039 pElement = *ElementAboveRow2;
2040 }
while (pElement->
Row < Row2);
2045 *ElementAboveRow2 = Element2->
NextInCol;
2046 *ElementAboveRow1 = Element2;
2049 Element2->
Row = Row1;
2094 ElementPtr *ElementLeftOfCol1, *ElementLeftOfCol2;
2095 ElementPtr ElementRightOfCol1, ElementRightOfCol2;
2100 ElementLeftOfCol1 = &(
Matrix->FirstInRow[Row]);
2101 pElement = *ElementLeftOfCol1;
2102 while (pElement->
Col < Col1) {
2103 ElementLeftOfCol1 = &(pElement->
NextInRow);
2104 pElement = *ElementLeftOfCol1;
2106 if (Element1 !=
NULL) {
2107 ElementRightOfCol1 = Element1->
NextInRow;
2108 if (Element2 ==
NULL) {
2110 if (ElementRightOfCol1 !=
NULL AND ElementRightOfCol1->
Col < Col2) {
2112 *ElementLeftOfCol1 = ElementRightOfCol1;
2115 pElement = ElementRightOfCol1;
2117 ElementLeftOfCol2 = &(pElement->
NextInRow);
2118 pElement = *ElementLeftOfCol2;
2119 }
while (pElement !=
NULL AND pElement->
Col < Col2);
2122 *ElementLeftOfCol2 = Element1;
2124 *ElementLeftOfCol1 = ElementRightOfCol1;
2126 Element1->
Col = Col2;
2129 if (ElementRightOfCol1->
Col == Col2) {
2133 *ElementLeftOfCol1 = Element2;
2136 pElement = ElementRightOfCol1;
2138 ElementLeftOfCol2 = &(pElement->
NextInRow);
2139 pElement = *ElementLeftOfCol2;
2140 }
while (pElement->
Col < Col2);
2142 ElementRightOfCol2 = Element2->
NextInRow;
2145 *ElementLeftOfCol1 = Element2;
2146 Element2->
NextInRow = ElementRightOfCol1;
2147 *ElementLeftOfCol2 = Element1;
2148 Element1->
NextInRow = ElementRightOfCol2;
2150 Element1->
Col = Col2;
2151 Element2->
Col = Col1;
2155 ElementRightOfCol1 = pElement;
2158 if (ElementRightOfCol1->
Col != Col2) {
2160 ElementLeftOfCol2 = &(pElement->
NextInRow);
2161 pElement = *ElementLeftOfCol2;
2162 }
while (pElement->
Col < Col2);
2164 ElementRightOfCol2 = Element2->
NextInRow;
2167 *ElementLeftOfCol2 = Element2->
NextInRow;
2168 *ElementLeftOfCol1 = Element2;
2169 Element2->
NextInRow = ElementRightOfCol1;
2171 Element2->
Col = Col1;
2213 if (
ABS(pPivot->
Real) == 0.0) {
2220 while (pUpper !=
NULL) {
2226 while (pLower !=
NULL) {
2305 int *MarkoRow =
Matrix->MarkowitzRow, *MarkoCol =
Matrix->MarkowitzCol;
2316 if ((MarkoRow[Row] > SHRT_MAX
AND MarkoCol[Row] != 0)
OR(MarkoCol[Row] > SHRT_MAX
AND MarkoRow[Row] != 0)) {
2317 Product = MarkoCol[Row] * MarkoRow[Row];
2318 if (Product >= (
double)LONG_MAX)
2319 Matrix->MarkowitzProd[Row] = LONG_MAX;
2321 Matrix->MarkowitzProd[Row] = Product;
2323 Matrix->MarkowitzProd[Row] = MarkoRow[Row] * MarkoCol[Row];
2324 if (MarkoRow[Row] == 0)
2333 if ((MarkoRow[Col] > SHRT_MAX
AND MarkoCol[Col] != 0)
OR(MarkoCol[Col] > SHRT_MAX
AND MarkoRow[Col] != 0)) {
2334 Product = MarkoCol[Col] * MarkoRow[Col];
2335 if (Product >= (
double)LONG_MAX)
2336 Matrix->MarkowitzProd[Col] = LONG_MAX;
2338 Matrix->MarkowitzProd[Col] = Product;
2340 Matrix->MarkowitzProd[Col] = MarkoRow[Col] * MarkoCol[Col];
2341 if ((MarkoCol[Col] == 0)
AND(MarkoRow[Col] != 0))
2383 ppElementAbove = &
Matrix->FirstInCol[Col];
2384 pElement = *ppElementAbove;
2385 while (pElement !=
NULL) {
2386 if (pElement->
Row < Row) {
2388 pElement = *ppElementAbove;
2397 Matrix->MarkowitzProd[Row] = ++
Matrix->MarkowitzRow[Row] *
Matrix->MarkowitzCol[Row];
2398 if ((
Matrix->MarkowitzRow[Row] == 1)
AND(
Matrix->MarkowitzCol[Row] != 0))
2400 Matrix->MarkowitzProd[Col] = ++
Matrix->MarkowitzCol[Col] *
Matrix->MarkowitzRow[Col];
2401 if ((
Matrix->MarkowitzRow[Col] != 0)
AND(
Matrix->MarkowitzCol[Col] == 1))
2441 #if ANNOTATE == FULL
2450 static void WriteStatus(
Matrix, Step)
2459 printf(
"Step = %1d ", Step);
2460 printf(
"Pivot found at %1d,%1d using ",
Matrix->PivotsOriginalRow,
2461 Matrix->PivotsOriginalCol);
2462 switch (
Matrix->PivotSelectionMethod) {
2464 printf(
"SearchForSingleton\n");
2467 printf(
"QuicklySearchDiagonal\n");
2470 printf(
"SearchDiagonal\n");
2473 printf(
"SearchEntireMatrix\n");
2477 printf(
"MarkowitzRow = ");
2478 for (I = 1; I <=
Matrix->Size; I++)
2482 printf(
"MarkowitzCol = ");
2483 for (I = 1; I <=
Matrix->Size; I++)
2487 printf(
"MarkowitzProduct = ");
2488 for (I = 1; I <=
Matrix->Size; I++)
2494 printf(
"IntToExtRowMap = ");
2495 for (I = 1; I <=
Matrix->Size; I++)
2499 printf(
"IntToExtColMap = ");
2500 for (I = 1; I <=
Matrix->Size; I++)
2504 printf(
"ExtToIntRowMap = ");
2505 for (I = 1; I <=
Matrix->ExtSize; I++)
2509 printf(
"ExtToIntColMap = ");
2510 for (I = 1; I <=
Matrix->ExtSize; I++)
#define ALLOC(type, number)
struct MatrixFrame * MatrixPtr
#define ASSERT(condition)
#define IS_SPARSE(matrix)
static void ExchangeRowsAndCols(MatrixPtr Matrix, ElementPtr pPivot, int Step)
static void ExchangeColElements(MatrixPtr Matrix, int Row1, ElementPtr Element1, int Row2, ElementPtr Element2, int Column)
static ElementPtr SearchForPivot(MatrixPtr Matrix, int Step, int DiagPivoting)
void spPartition(char *eMatrix, int Mode)
void spcRowExchange(MatrixPtr Matrix, int Row1, int Row2)
ElementPtr spcFindElementInCol(MatrixPtr Matrix, ElementPtr *LastAddr, int Row, int Col, BOOLEAN CreateIfMissing)
static void CreateInternalVectors(MatrixPtr Matrix)
static ElementPtr SearchForSingleton(MatrixPtr Matrix, int Step)
static void UpdateMarkowitzNumbers(MatrixPtr Matrix, ElementPtr pPivot)
static RealNumber FindBiggestInColExclude(MatrixPtr Matrix, ElementPtr pElement, int Step)
static ElementPtr SearchEntireMatrix(MatrixPtr Matrix, int Step)
int spFactor(char *eMatrix)
int spOrderAndFactor(char *eMatrix, RealNumber *RHS, RealNumber RelThreshold, RealNumber AbsThreshold, BOOLEAN DiagPivoting)
static void CountMarkowitz(MatrixPtr Matrix, RealVector RHS, int Step)
static ElementPtr SearchDiagonal(MatrixPtr Matrix, int Step)
void spcLinkRows(MatrixPtr)
static int MatrixIsSingular(MatrixPtr Matrix, int Step)
static void RealRowColElimination(MatrixPtr Matrix, ElementPtr pPivot)
static ElementPtr QuicklySearchDiagonal(MatrixPtr Matrix, int Step)
ElementPtr spcCreateElement(MatrixPtr Matrix, int Row, int Col, ElementPtr *LastAddr, BOOLEAN Fillin)
void spcColExchange(MatrixPtr Matrix, int Col1, int Col2)
static int ZeroPivot(MatrixPtr Matrix, int Step)
static RealNumber FindLargestInCol(ElementPtr pElement)
static ElementPtr CreateFillin(MatrixPtr Matrix, int Row, int Col)
static void MarkowitzProducts(MatrixPtr Matrix, int Step)
static void ExchangeRowElements(MatrixPtr Matrix, int Col1, ElementPtr Element1, int Col2, ElementPtr Element2, int Row)
#define spINDIRECT_PARTITION
#define spDIRECT_PARTITION
#define spDEFAULT_PARTITION
struct MatrixElement * NextInCol
struct MatrixElement * NextInRow