]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix fill function. See tests/lac/lapack_fill.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 27 Feb 2006 12:49:21 +0000 (12:49 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Mon, 27 Feb 2006 12:49:21 +0000 (12:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@12509 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/lapack_full_matrix.h

index 1c4d52208a7c9e38d225b05bdfdc2544c3396056..95e9960d21d0f63cf11f5b3bcdbd3d5360ed4886 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005 by the deal.II authors
+//    Copyright (C) 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -344,20 +344,17 @@ LAPACKFullMatrix<number>::fill (
   const unsigned int src_offset_i,
   const unsigned int src_offset_j)
 {
-  const unsigned int endcol = src_offset_j + this->n_cols();
-  
-  const typename MATRIX::const_iterator
-    end = M.end(src_offset_i+this->n_rows()-dst_offset_i-1);
+  const typename MATRIX::const_iterator end = M.end();
   for (typename MATRIX::const_iterator entry = M.begin(src_offset_i);
        entry != end; ++entry)
     {
       const unsigned int i = entry->row();
       const unsigned int j = entry->column();
-      
-      if (j >= src_offset_j && j < endcol)
-       this->operator()(dst_offset_i-src_offset_i+i,
-                        dst_offset_j-src_offset_j+j)
-         = entry->value();
+
+      const unsigned int dst_i=dst_offset_i+i-src_offset_i;
+      const unsigned int dst_j=dst_offset_j+j-src_offset_j;
+      if (dst_i<this->n_rows() && dst_j<this->n_cols())
+       (*this)(dst_i, dst_j) = entry->value();
     }
   
   state = LAPACKSupport::matrix;

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.