From 9a09c5f385aea2d8fc50ed4da765c05b333f8278 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 14 Apr 2000 16:23:33 +0000 Subject: [PATCH] Allow matrices to be empty upon check of equality. git-svn-id: https://svn.dealii.org/trunk@2727 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/full_matrix.templates.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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]))); }; -- 2.39.5