]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Small readability changes in advance of bigger performance changes.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 19 May 1998 19:21:45 +0000 (19:21 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 19 May 1998 19:21:45 +0000 (19:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@318 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/source/dsmatrix.cc

index 972864c4dfa09fe129fde9a55739bba6fe615bb7..4ecbafdb51c5cf144fc3d5fbcaa94e52d79db5ac 100644 (file)
@@ -405,12 +405,13 @@ dSMatrix::vmult (dVector& dst, const dVector& src) const
   Assert(m() == dst.size(), ExcDimensionsDontMatch(m(),dst.size()));
   Assert(n() == src.size(), ExcDimensionsDontMatch(n(),src.size()));
 
-  for (unsigned int i=0; i<m(); ++i)
+  const unsigned int n_rows = m();
+  for (unsigned int row=0; row<n_rows; ++row)
     {
       double s = 0.;
-      for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j) 
+      for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) 
        s += val[j] * src(cols->colnums[j]);
-      dst(i) = s;
+      dst(row) = s;
     }
 }
 
@@ -422,11 +423,9 @@ dSMatrix::Tvmult (dVector& dst, const dVector& src) const
   Assert(n() == dst.size(), ExcDimensionsDontMatch(n(),dst.size()));
   Assert(m() == src.size(), ExcDimensionsDontMatch(m(),src.size()));
 
-  unsigned int i;
-  
-  for (i=0;i<n();i++) dst(i) = 0.;
-  
-  for (i=0;i<m();i++)
+  dst.clear ();
+
+  for (unsigned int i=0;i<m();i++)
     {
       for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1] ;j++)
        {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.