From: prill Date: Mon, 18 Dec 2006 13:16:01 +0000 (+0000) Subject: Fixed small bug in direct inversion of full matrices. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44add8c8fe44fdfbcddd5ff0d40956b513bc3f5a;p=dealii-svn.git Fixed small bug in direct inversion of full matrices. git-svn-id: https://svn.dealii.org/trunk@14260 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index 7c00e81909..b4b65ee8d3 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -695,6 +695,12 @@ inconvenience this causes.

lac

    +
  1. Fixed: The FullMatrix::invert + function would return wrong results if one tried to invert a + matrix of dimension smaller than 5 in situ. This is now fixed. +
    + (Florian Prill 2006/12/18) +

  2. Improved: The SparsityPattern class would produce diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 9f126ef801..d6bf96dfed 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -1999,7 +1999,15 @@ FullMatrix::invert (const FullMatrix &M) ExcDimensionMismatch(this->n_cols(), M.n_cols())); Assert (this->n_rows() == M.n_rows(), ExcDimensionMismatch(this->n_rows(), M.n_rows())); - + + if ((&M == this) && (this->n_cols() <= 4)) + { + // avoid overwriting source + // by destination matrix: + FullMatrix M2 = M; + invert(M2); + } + else switch (this->n_cols()) { case 1: