Skip to content
Snippets Groups Projects
Commit ec07560b authored by graeser's avatar graeser Committed by graeser
Browse files

Check size of matrix for diagonalIsOne

Backport of patch in r3838 of the trunk

[[Imported from SVN: r3839]]
parent 67e64a36
No related branches found
No related tags found
No related merge requests found
...@@ -53,9 +53,9 @@ public: ...@@ -53,9 +53,9 @@ public:
} }
template<class MatrixType> template<class MatrixType>
static bool diagonalIsOne(const MatrixType& A, int j, int size) static bool diagonalIsOne(const MatrixType& A, int j)
{ {
if (size==1) if (j>=A.N())
return A[0][0]>1-1e-5; return A[0][0]>1-1e-5;
return A[j][j]>1-1e-5; return A[j][j]>1-1e-5;
} }
...@@ -561,7 +561,7 @@ public: ...@@ -561,7 +561,7 @@ public:
{ {
for(int i=0; i<fineBits.size(); ++i) for(int i=0; i<fineBits.size(); ++i)
if (fineBits.test(i)) if (fineBits.test(i))
if (diagonalIsOne(*cIt, i, fineBits.size())) if (diagonalIsOne(*cIt, i))
t[cIt.index()][i] = true; t[cIt.index()][i] = true;
} }
} }
...@@ -611,7 +611,7 @@ public: ...@@ -611,7 +611,7 @@ public:
const typename BitVectorType::const_reference fineBits = f[rowIdx*virtualBlockSize+i]; const typename BitVectorType::const_reference fineBits = f[rowIdx*virtualBlockSize+i];
for(int j=0; j<fineBits.size(); ++j) for(int j=0; j<fineBits.size(); ++j)
if (fineBits.test(j)) if (fineBits.test(j))
if (diagonalIsOne(*cIt, j, fineBits.size())) if (diagonalIsOne(*cIt, j))
t[cIt.index()*virtualBlockSize+i][j] = true; t[cIt.index()*virtualBlockSize+i][j] = true;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment