]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
transposed SOR
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 6 Oct 2000 10:31:06 +0000 (10:31 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 6 Oct 2000 10:31:06 +0000 (10:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@3385 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.2.templates
deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparse_matrix.templates.h

index 3e1d6fab198759650e968d34366204bac0b45e8e..60134fec6d9795b8002861477761ca875eac70a3 100644 (file)
@@ -51,11 +51,16 @@ template void SparseMatrix<TYPEMAT>::precondition_SOR (Vector<TYPE2> &,
                                                     const Vector<TYPE2> &,
                                                     TYPEMAT) const;
 
+template void SparseMatrix<TYPEMAT>::precondition_TSOR (Vector<TYPE2> &,
+                                                    const Vector<TYPE2> &,
+                                                    TYPEMAT) const;
+
 template void SparseMatrix<TYPEMAT>::precondition_Jacobi (Vector<TYPE2> &,
                                                        const Vector<TYPE2> &,
                                                        TYPEMAT) const;
 
 template void SparseMatrix<TYPEMAT>::SOR (Vector<TYPE2> &, TYPEMAT) const;
+template void SparseMatrix<TYPEMAT>::TSOR (Vector<TYPE2> &, TYPEMAT) const;
 template void SparseMatrix<TYPEMAT>::SSOR (Vector<TYPE2> &, TYPEMAT) const;
 template void SparseMatrix<TYPEMAT>::SOR_step (Vector<TYPE2> &, const Vector<TYPE2> &, TYPEMAT) const;
 template void SparseMatrix<TYPEMAT>::TSOR_step (Vector<TYPE2> &, const Vector<TYPE2> &, TYPEMAT) const;
index adb40a1c8b047ac6442e12b3baf1e8feece15a8f..9fe43678a1c88115b7dae4ab01c912afdd93fcab 100644 (file)
@@ -526,6 +526,16 @@ class SparseMatrix : public Subscriptor
                           const Vector<somenumber> &src,
                           const number              om = 1.) const;
     
+                                    /**
+                                     * Apply transpose SOR preconditioning matrix to @p{src}.
+                                     * The result of this method is
+                                     * $dst = (om D - U)^{-1} src$.
+                                     */
+    template <typename somenumber>
+    void precondition_TSOR (Vector<somenumber>       &dst,
+                           const Vector<somenumber> &src,
+                           const number              om = 1.) const;
+    
                                     /**
                                      * Perform SSOR preconditioning
                                      * in-place.  Apply the
@@ -545,6 +555,15 @@ class SparseMatrix : public Subscriptor
                                      */
     template <typename somenumber>
     void SOR (Vector<somenumber> &v,
+             const number        om = 1.) const;
+
+                                    /**
+                                     * Perform a transpose SOR preconditioning in-place.
+                                     * The result is $v = (\omega D - L)^{-1} v$.
+                                     * @p{omega} is the damping parameter.
+                                     */
+    template <typename somenumber>
+    void TSOR (Vector<somenumber> &v,
              const number        om = 1.) const;
 
                                     /**
index 36a98a23ff6b43f0119d0593fe6238c1a4be412a..40fbc14c59c4d15f0c1fe6a5e4dfc0594ea51e21 100644 (file)
@@ -766,6 +766,21 @@ SparseMatrix<number>::precondition_SOR (Vector<somenumber>& dst, const Vector<so
 };
 
 
+template <typename number>
+template <typename somenumber>
+void
+SparseMatrix<number>::precondition_TSOR (Vector<somenumber>& dst, const Vector<somenumber>& src,
+                           const number om) const
+{
+  Assert (cols != 0, ExcMatrixNotInitialized());
+  Assert (val != 0, ExcMatrixNotInitialized());
+  Assert (m() == n(), ExcMatrixNotSquare());
+
+  dst = src;
+  TSOR(dst,om);
+};
+
+
 template <typename number>
 template <typename somenumber>
 void
@@ -788,6 +803,29 @@ SparseMatrix<number>::SOR (Vector<somenumber>& dst, const number om) const
 }
 
 
+template <typename number>
+template <typename somenumber>
+void
+SparseMatrix<number>::TSOR (Vector<somenumber>& dst, const number om) const
+{
+  Assert (cols != 0, ExcMatrixNotInitialized());
+  Assert (val != 0, ExcMatrixNotInitialized());
+  Assert (m() == n(), ExcMatrixNotSquare());
+  Assert (m() == dst.size(), ExcDimensionsDontMatch(m(),dst.size()));
+
+  for (unsigned int row=m(); row!=0;)
+    {
+      --row;
+      somenumber s = dst(row);
+      for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j)
+       if (cols->colnums[j] > row)
+         s -= val[j] * dst(cols->colnums[j]);
+
+      dst(row) = s * om / val[cols->rowstart[row]];
+    }
+}
+
+
 template <typename number>
 template <typename somenumber>
 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.