]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix stupid bug in operator=(double).
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 9 Dec 2009 10:29:32 +0000 (10:29 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 9 Dec 2009 10:29:32 +0000 (10:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@20218 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.templates.h

index 1226e4e4203d402b83e6b47fc5f1e9695a8fdfce..bccdf982ed858c3672c322e90d16a3d2e8aaae00 100644 (file)
@@ -135,8 +135,8 @@ SparseMatrix<number>::operator = (const double d)
   Assert (cols != 0, ExcNotInitialized());
   Assert (cols->compressed || cols->empty(), SparsityPattern::ExcNotCompressed());
 
-  if (val)
-    memset (&val[0], cols->n_nonzero_elements()*sizeof(number), 0);
+  if (val != 0)
+    memset (&val[0], 0, cols->n_nonzero_elements()*sizeof(number));
 
   return *this;
 }
@@ -185,8 +185,7 @@ SparseMatrix<number>::reinit (const SparsityPattern &sparsity)
       max_len = N;
     }
 
-  if (val != 0)
-    std::fill_n (&val[0], N, 0);
+  *this = 0.;
 }
 
 

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.