From: wolf Date: Fri, 14 Apr 2000 16:23:33 +0000 (+0000) Subject: Allow matrices to be empty upon check of equality. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba187a8c1aac1ce76fc97181eb75f82c7be8514e;p=dealii-svn.git Allow matrices to be empty upon check of equality. git-svn-id: https://svn.dealii.org/trunk@2727 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index d73fa76fe4..469c7a65d6 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -1075,13 +1075,15 @@ template bool FullMatrix::operator == (const FullMatrix &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]))); };