From 29ef9804d5686ee5163a0dc13cb7e25f8bcb1db5 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 24 Jan 2010 23:43:31 +0000 Subject: [PATCH] Fix a recently introduced bug where we started counting from too high. git-svn-id: https://svn.dealii.org/trunk@20428 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/sparse_matrix.templates.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index da1d17fae7..204443ee5c 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -1509,7 +1509,8 @@ SparseMatrix::TSOR (Vector& dst, Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); - for (unsigned int row=m(); row!=0; --row) + unsigned int row=m()-1; + while (true) { somenumber s = dst(row); for (unsigned int j=cols->rowstart[row]; jrowstart[row+1]; ++j) @@ -1517,6 +1518,11 @@ SparseMatrix::TSOR (Vector& dst, s -= val[j] * dst(cols->colnums[j]); dst(row) = s * om / val[cols->rowstart[row]]; + + if (row == 0) + break; + + --row; } } -- 2.39.5