Skip to content
Snippets Groups Projects
Commit 5cfa8569 authored by Simon Praetorius's avatar Simon Praetorius Committed by Oliver Sander
Browse files

Use the correct type for number of rows/columns/nonzeros

parent 81455070
No related branches found
No related tags found
No related merge requests found
...@@ -341,8 +341,8 @@ public: ...@@ -341,8 +341,8 @@ public:
void setMatrix(const Matrix& matrix, const Ignore* ignore) void setMatrix(const Matrix& matrix, const Ignore* ignore)
{ {
// count the number of entries and diagonal entries // count the number of entries and diagonal entries
int nonZeros = 0; size_t nonZeros = 0;
int numberOfIgnoredDofs = 0; size_t numberOfIgnoredDofs = 0;
auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){ auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){
...@@ -358,16 +358,16 @@ public: ...@@ -358,16 +358,16 @@ public:
numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true); numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true);
} }
// Total number of rows nIsZero_ = (size_t(flatRows) <= numberOfIgnoredDofs);
int N = flatRows - numberOfIgnoredDofs;
nIsZero_ = (N <= 0);
if ( nIsZero_ ) if ( nIsZero_ )
{ {
return; return;
} }
// Total number of rows
size_t N = flatRows - numberOfIgnoredDofs;
/* /*
* CHOLMOD uses compressed-column sparse matrices, but for symmetric * CHOLMOD uses compressed-column sparse matrices, but for symmetric
* matrices this is the same as the compressed-row sparse matrix used * matrices this is the same as the compressed-row sparse matrix used
...@@ -429,7 +429,7 @@ public: ...@@ -429,7 +429,7 @@ public:
// now accumulate // now accumulate
Ap[0] = 0; Ap[0] = 0;
for ( int i=0; i<N; i++ ) for ( size_t i=0; i<N; i++ )
{ {
Ap[i+1] += Ap[i]; Ap[i+1] += Ap[i];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment