From: wolf Date: Mon, 2 Jun 2003 22:10:33 +0000 (+0000) Subject: FullMatrix::operator /= X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a17cc4024d072d1812d982aa1c3cbe9ccff8e5a;p=dealii-svn.git FullMatrix::operator /= git-svn-id: https://svn.dealii.org/trunk@7725 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index 72846570b5..9efe89c773 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -239,6 +239,12 @@ class FullMatrix : public Table<2,number> * fixed factor. */ FullMatrix & operator *= (const double factor); + + /** + * Scale the entire matrix by the + * inverse of the given factor. + */ + FullMatrix & operator /= (const double factor); /** * Weighted addition. The matrix diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 95a6e8c3a4..7d15b5c348 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -106,6 +106,23 @@ FullMatrix::operator *= (const double factor) +template +FullMatrix & +FullMatrix::operator /= (const double factor) +{ + number *p = &this->el(0,0); + const number *e = &this->el(0,0) + n()*m(); + + const number factor_inv = 1./factor; + + while (p != e) + *p++ *= factor_inv; + + return *this; +} + + + template template void