]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
FullMatrix::operator /=
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 2 Jun 2003 22:10:33 +0000 (22:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 2 Jun 2003 22:10:33 +0000 (22:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@7725 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 72846570b524f2e5e439def21a551a959bf48400..9efe89c77345f443795184eac455fbb040ea227b 100644 (file)
@@ -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
index 95a6e8c3a4ae046f0c9d2b8f62cf14950535bd7f..7d15b5c348479d039b694827a6eeddad2bece4d1 100644 (file)
@@ -106,6 +106,23 @@ FullMatrix<number>::operator *= (const double factor)
 
 
 
+template <typename number>
+FullMatrix<number> &
+FullMatrix<number>::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 <typename number>
 template <typename number2>
 void

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.