AllowRotation and size_t

This commit is contained in:
Aik-Siong Koh
2024-01-14 21:40:33 -07:00
committed by PaddleStroke
parent fe99ad2593
commit 85557e1fa4
285 changed files with 1854 additions and 1116 deletions

View File

@@ -11,14 +11,15 @@
using namespace MbD;
void LDUSpMatParPvPrecise::doPivoting(int p)
void LDUSpMatParPvPrecise::doPivoting(size_t p)
{
//"Search from bottom to top."
//"Use scaling vector and partial pivoting with actual swapping of rows."
//"Check for singular pivot."
//"Do scaling. Do partial pivoting."
//| max rowPivot aip mag lookForFirstNonZeroInPivotCol i |
int i, rowPivoti;
int i; //Use int because of decrement
size_t rowPivoti;
double aip, mag, max;
SpRowDsptr spRowi;
rowPositionsOfNonZerosInPivotColumn->clear();
@@ -27,7 +28,7 @@ void LDUSpMatParPvPrecise::doPivoting(int p)
while (lookForFirstNonZeroInPivotCol) {
spRowi = matrixA->at(i);
if (spRowi->find(p) == spRowi->end()) {
if (i <= p) throwSingularMatrixError("");
if (i <= (int)p) throwSingularMatrixError(""); //Use int because i can be negative
}
else {
markowitzPivotColCount = 0;
@@ -35,12 +36,12 @@ void LDUSpMatParPvPrecise::doPivoting(int p)
mag = aip * rowScalings->at(i);
if (mag < 0) mag = -mag;
max = mag;
rowPivoti = i;
rowPivoti = (size_t)i;
lookForFirstNonZeroInPivotCol = false;
}
i--;
}
while (i >= p) {
while (i >= (int)p) { //Use int because i can be negative
spRowi = matrixA->at(i);
if (spRowi->find(p) == spRowi->end()) {
aip = std::numeric_limits<double>::min();
@@ -53,7 +54,7 @@ void LDUSpMatParPvPrecise::doPivoting(int p)
if (mag > max) {
max = mag;
rowPositionsOfNonZerosInPivotColumn->push_back(rowPivoti);
rowPivoti = i;
rowPivoti = (size_t)i;
}
else {
rowPositionsOfNonZerosInPivotColumn->push_back(i);
@@ -66,7 +67,7 @@ void LDUSpMatParPvPrecise::doPivoting(int p)
rowScalings->swapElems(p, rowPivoti);
rowOrder->swapElems(p, rowPivoti);
matrixL->swapElems(p, rowPivoti);
if (aip != std::numeric_limits<double>::min()) rowPositionsOfNonZerosInPivotColumn->at((int)markowitzPivotColCount - 1) = rowPivoti;
if (aip != std::numeric_limits<double>::min()) rowPositionsOfNonZerosInPivotColumn->at(markowitzPivotColCount - 1) = rowPivoti;
}
pivotValues->at(p) = max;
if (max < singularPivotTolerance) throwSingularMatrixError("");