]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow matrices to be empty upon check of equality.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 14 Apr 2000 16:23:33 +0000 (16:23 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 14 Apr 2000 16:23:33 +0000 (16:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@2727 0785d39b-7218-0410-832d-ea1e28bc413d

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

index d73fa76fe43b5d895f5c22042b8e77196a96efb2..469c7a65d6fe171eedf9bff00b17448f99d0bb95 100644 (file)
@@ -1075,13 +1075,15 @@ template <typename number>
 bool
 FullMatrix<number>::operator == (const FullMatrix<number> &m) const
 {
-  Assert (val != 0, ExcEmptyMatrix());
-  
-  bool q = (dim_range==m.dim_range) && (dim_image==m.dim_image);
-  if (!q) return false;
-
-  return equal (&val[0], &val[dim_range*dim_image],
-               &m.val[0]);
+                                  // the matrices may either be both
+                                  // empty, or of same size and with
+                                  // same values, if they shall be
+                                  // equal
+  return ( ((val==0) && (m.val==0)) ||
+          ((dim_range==m.dim_range) &&
+           (dim_image==m.dim_image) &&
+           equal (&val[0], &val[dim_range*dim_image],
+                  &m.val[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.