]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Ensure symmetry only up to a small relative number.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Dec 2006 16:27:25 +0000 (16:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Dec 2006 16:27:25 +0000 (16:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@14273 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.html
deal.II/lac/source/sparse_direct.cc

index 0aab7c15ed9fc1d8e34eaacc7d06672fe95bb5c7..6d31f4f082f7eec2e3e2b2191d23f920af979c76 100644 (file)
@@ -695,6 +695,15 @@ inconvenience this causes.
 <h3>lac</h3>
 
 <ol>
+  <li> <p>Fixed: The <code class="class">SparseDirectMA27</code> 
+       class works for symmetric matrices and had a check to make sure the
+       matrix is indeed symmetric. However, the check compared entries for
+       equality, something one should not do for floating point numbers. It now
+       checks that symmetric entries are equal up to a small relative number.
+       <br>
+       (WB 2006/12/21)
+       </p>
+
   <li> <p>Fixed: The <code class="member">FullMatrix::invert</code> 
        function would return wrong results if one tried to invert a
        matrix of dimension smaller than 5 in situ. This is now fixed.
index a2d3097924e8de1f9f637224ebf6ef88819a10a2..6c773a1dca121920ec878ca8a0f4e6434f56ea46 100644 (file)
@@ -1014,7 +1014,8 @@ SparseDirectMA27::fill_A (const SparseMatrix<number> &matrix)
                                            // value, unless this one is zero
           Assert ((matrix(row,*col) == 0)
                   ||
-                  (matrix(row,*col) == matrix(*col,row)),
+                  (std::fabs(matrix(row,*col) - matrix(*col,row))
+                  <= 1e-15 * std::fabs (matrix(row,*col))),
                   ExcMatrixNotSymmetric());
        }
       else
@@ -1022,7 +1023,8 @@ SparseDirectMA27::fill_A (const SparseMatrix<number> &matrix)
                                          // symmetry
         Assert ((matrix(row,*col) == 0)
                 ||
-                (matrix(row,*col) == matrix(*col,row)),
+                (std::fabs(matrix(row,*col) - matrix(*col,row))
+                  <= 1e-15 * std::fabs (matrix(row,*col))),
                 ExcMatrixNotSymmetric());
         
   Assert (global_index == n_nonzero_elements, ExcInternalError());  

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.