Werner compil warning (#32)

* Replace int by size_t in for loops.

* Various dtor missing and some other warning fixes.

* fixed size_t vs int

* fixed size_t vs int

---------

Co-authored-by: Paddle <PaddleStroke@users.noreply.github.com>
Co-authored-by: Aik-Siong Koh <askoh@askoh.com>
This commit is contained in:
PaddleStroke
2023-11-16 21:32:13 +01:00
committed by GitHub
parent f452cd6298
commit 6f4fca7efb
35 changed files with 125 additions and 116 deletions

View File

@@ -98,7 +98,7 @@ namespace MbD {
inline double SparseMatrix<T>::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
sum += this->at(i)->sumOfSquares();
}
@@ -107,7 +107,7 @@ namespace MbD {
template<>
inline void SparseMatrix<double>::zeroSelf()
{
for (int i = 0; i < this->size(); i++) {
for (size_t i = 0; i < this->size(); i++) {
this->at(i)->zeroSelf();
}
}
@@ -119,7 +119,7 @@ namespace MbD {
template<typename T>
inline void SparseMatrix<T>::atijplusFullColumn(int i, int j, FColsptr<T> fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
for (size_t ii = 0; ii < fullCol->size(); ii++)
{
this->atijplusNumber(i + ii, j, fullCol->at(ii));
}
@@ -127,7 +127,7 @@ namespace MbD {
template<typename T>
inline void SparseMatrix<T>::atijminusFullColumn(int i, int j, FColDsptr fullCol)
{
for (int ii = 0; ii < fullCol->size(); ii++)
for (size_t ii = 0; ii < fullCol->size(); ii++)
{
this->atijminusNumber(i + ii, j, fullCol->at(ii));
}
@@ -191,7 +191,7 @@ namespace MbD {
inline double SparseMatrix<T>::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
double element = this->at(i)->maxMagnitude();
if (max < element) max = element;
@@ -202,7 +202,7 @@ namespace MbD {
inline std::ostream& SparseMatrix<T>::printOn(std::ostream& s) const
{
s << "SpMat[" << std::endl;
for (int i = 0; i < this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
s << *(this->at(i)) << std::endl;
}
@@ -229,7 +229,7 @@ namespace MbD {
//"Just evaluate quickly."
auto answer = clonesptr();
for (int i = 0; i < answer->size(); i++)
for (size_t i = 0; i < answer->size(); i++)
{
answer->atiput(i, answer->at(i)->plusSparseRow(spMat->at(i)));
}
@@ -243,7 +243,7 @@ namespace MbD {
template<typename T>
inline void SparseMatrix<T>::magnifySelf(T factor)
{
for (int i = 0; i < this->size(); i++) {
for (size_t i = 0; i < this->size(); i++) {
this->at(i)->magnifySelf(factor);
}
}