fix most of the warnings enabled by masochists

most of these people like to inflict pain on themselfs (i.e., warnings
in their own code), but they usually don't like if pain is inflicted
on them by others (i.e., warnings produced by external code which they
use). This patch should make these kinds of people happy. I'm not
really sure if the code is easier to understand with this, but at
least clang does not complain for most of the warnings of
"-Weverything" anymore.
This commit is contained in:
Andreas Lauser
2015-09-22 11:20:55 +02:00
parent be1fd178f1
commit a6499a01aa
91 changed files with 1416 additions and 1401 deletions

View File

@@ -51,7 +51,7 @@ class TridiagonalMatrix
TridiagRow_(TridiagonalMatrix &m, size_t rowIdx)
: matrix_(m)
, rowIdx_(rowIdx)
{};
{}
Scalar &operator[](size_t colIdx)
{ return matrix_.at(rowIdx_, colIdx); }
@@ -109,22 +109,22 @@ public:
typedef TridiagRow_ iterator;
typedef TridiagRow_ const_iterator;
explicit TridiagonalMatrix(int numRows = 0)
explicit TridiagonalMatrix(size_t numRows = 0)
{
resize(numRows);
};
}
TridiagonalMatrix(int numRows, Scalar value)
TridiagonalMatrix(size_t numRows, Scalar value)
{
resize(numRows);
this->operator=(value);
};
}
/*!
* \brief Copy constructor.
*/
TridiagonalMatrix(const TridiagonalMatrix &source)
{ *this = source; };
{ *this = source; }
/*!
* \brief Return the number of rows/columns of the matrix.
@@ -171,7 +171,7 @@ public:
return diag_[0][n - 1];
}
int diagIdx = 1 + colIdx - rowIdx;
size_t diagIdx = 1 + colIdx - rowIdx;
// make sure that the requested column is in range
assert(0 <= diagIdx && diagIdx < 3);
return diag_[diagIdx][colIdx];
@@ -711,7 +711,7 @@ public:
template <class XVector, class BVector>
void solve(XVector &x, const BVector &b) const
{
if (size() > 2 && diag_[2][0] != 0)
if (size() > 2 && std::abs(diag_[2][0]) < 1e-30)
solveWithUpperRight_(x, b);
else
solveWithoutUpperRight_(x, b);
@@ -793,8 +793,9 @@ private:
// backward elimination
x[n - 1] = bStar[n - 1]/mainDiag[n-1];
for (int i = n - 2; i >= 0; --i) {
x[i] = (bStar[i] - x[i + 1]*upperDiag[i+1] - x[n-1]*lastColumn[i])/mainDiag[i];
for (int i = static_cast<int>(n) - 2; i >= 0; --i) {
unsigned iu = static_cast<unsigned>(i);
x[iu] = (bStar[iu] - x[iu + 1]*upperDiag[iu+1] - x[n-1]*lastColumn[iu])/mainDiag[iu];
}
}
@@ -831,8 +832,9 @@ private:
// backward elimination
x[n - 1] = bStar[n - 1]/mainDiag[n-1];
for (int i = n - 2; i >= 0; --i) {
x[i] = (bStar[i] - x[i + 1]*upperDiag[i+1])/mainDiag[i];
for (int i = static_cast<int>(n) - 2; i >= 0; --i) {
unsigned iu = static_cast<unsigned>(i);
x[iu] = (bStar[iu] - x[iu + 1]*upperDiag[iu+1])/mainDiag[iu];
}
}