AllowRotation and size_t
This commit is contained in:
committed by
PaddleStroke
parent
fe99ad2593
commit
85557e1fa4
@@ -13,14 +13,15 @@
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
void GESpMatParPvPrecise::doPivoting(int p)
|
||||
void GESpMatParPvPrecise::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();
|
||||
@@ -29,7 +30,7 @@ void GESpMatParPvPrecise::doPivoting(int p)
|
||||
while (lookForFirstNonZeroInPivotCol) {
|
||||
spRowi = matrixA->at(i);
|
||||
if (spRowi->find(p) == spRowi->end()) {
|
||||
if (i <= p) throwSingularMatrixError("doPivoting");
|
||||
if (i <= (int)p) throwSingularMatrixError("doPivoting"); //Use int because i can be negative
|
||||
}
|
||||
else {
|
||||
markowitzPivotColCount = 0;
|
||||
@@ -37,12 +38,12 @@ void GESpMatParPvPrecise::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();
|
||||
@@ -55,7 +56,7 @@ void GESpMatParPvPrecise::doPivoting(int p)
|
||||
if (mag > max) {
|
||||
max = mag;
|
||||
rowPositionsOfNonZerosInPivotColumn->push_back(rowPivoti);
|
||||
rowPivoti = i;
|
||||
rowPivoti = (size_t)i;
|
||||
}
|
||||
else {
|
||||
rowPositionsOfNonZerosInPivotColumn->push_back(i);
|
||||
@@ -84,8 +85,8 @@ void GESpMatParPvPrecise::preSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr f
|
||||
matrixA = std::make_shared<SparseMatrix<double>>(m);
|
||||
rowScalings = std::make_shared<FullColumn<double>>(m);
|
||||
pivotValues = std::make_shared<FullColumn<double>>(m);
|
||||
rowOrder = std::make_shared<FullColumn<int>>(m);
|
||||
rowPositionsOfNonZerosInPivotColumn = std::make_shared<std::vector<int>>();
|
||||
rowOrder = std::make_shared<FullColumn<size_t>>(m);
|
||||
rowPositionsOfNonZerosInPivotColumn = std::make_shared<std::vector<size_t>>();
|
||||
}
|
||||
if (saveOriginal) {
|
||||
rightHandSideB = fullCol->copy();
|
||||
@@ -93,7 +94,7 @@ void GESpMatParPvPrecise::preSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr f
|
||||
else {
|
||||
rightHandSideB = fullCol;
|
||||
}
|
||||
for (int i = 0; i < m; i++)
|
||||
for (size_t i = 0; i < m; i++)
|
||||
{
|
||||
auto& spRowi = spMat->at(i);
|
||||
double maxRowMagnitude = spRowi->maxMagnitude();
|
||||
|
||||
Reference in New Issue
Block a user