Correct compilation warnings for 'int' casts with correct types (#75)

This commit is contained in:
huguesdpdn
2024-09-08 17:01:10 +02:00
committed by GitHub
parent 6bf651cd31
commit 91f70382be
15 changed files with 42 additions and 37 deletions

View File

@@ -21,17 +21,17 @@ void GESpMatParPvPrecise::doPivoting(size_t p)
//"Check for singular pivot."
//"Do scaling. Do partial pivoting."
//| max rowPivot aip mag lookForFirstNonZeroInPivotCol i |
int i; //Use int because of decrement
ssize_t i; //Use ssize_t because of decrement
size_t rowPivoti;
double aip, mag, max;
SpRowDsptr spRowi;
rowPositionsOfNonZerosInPivotColumn->clear();
auto lookForFirstNonZeroInPivotCol = true;
i = (int)m - 1;
i = (ssize_t)m - 1;
while (lookForFirstNonZeroInPivotCol) {
spRowi = matrixA->at(i);
if (spRowi->find(p) == spRowi->end()) {
if (i <= (int)p) throwSingularMatrixError("doPivoting"); //Use int because i can be negative
if (i <= (ssize_t)p) throwSingularMatrixError("doPivoting"); //Use ssize_t because i can be negative
}
else {
markowitzPivotColCount = 0;
@@ -44,7 +44,7 @@ void GESpMatParPvPrecise::doPivoting(size_t p)
}
i--;
}
while (i >= (int)p) { //Use int because i can be negative
while (i >= (ssize_t)p) { //Use ssize_t because i can be negative
spRowi = matrixA->at(i);
if (spRowi->find(p) == spRowi->end()) {
aip = std::numeric_limits<double>::min();