From: Guido Kanschat Date: Fri, 6 Oct 2000 10:31:06 +0000 (+0000) Subject: transposed SOR X-Git-Tag: v8.0.0~20046 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c780fa42f8fe1de672c34922377ff7796a62d3e;p=dealii.git transposed SOR git-svn-id: https://svn.dealii.org/trunk@3385 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparse_matrix.2.templates b/deal.II/lac/include/lac/sparse_matrix.2.templates index 3e1d6fab19..60134fec6d 100644 --- a/deal.II/lac/include/lac/sparse_matrix.2.templates +++ b/deal.II/lac/include/lac/sparse_matrix.2.templates @@ -51,11 +51,16 @@ template void SparseMatrix::precondition_SOR (Vector &, const Vector &, TYPEMAT) const; +template void SparseMatrix::precondition_TSOR (Vector &, + const Vector &, + TYPEMAT) const; + template void SparseMatrix::precondition_Jacobi (Vector &, const Vector &, TYPEMAT) const; template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::TSOR (Vector &, TYPEMAT) const; template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; template void SparseMatrix::SOR_step (Vector &, const Vector &, TYPEMAT) const; template void SparseMatrix::TSOR_step (Vector &, const Vector &, TYPEMAT) const; diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index adb40a1c8b..9fe43678a1 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -526,6 +526,16 @@ class SparseMatrix : public Subscriptor const Vector &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 + void precondition_TSOR (Vector &dst, + const Vector &src, + const number om = 1.) const; + /** * Perform SSOR preconditioning * in-place. Apply the @@ -545,6 +555,15 @@ class SparseMatrix : public Subscriptor */ template void SOR (Vector &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 + void TSOR (Vector &v, const number om = 1.) const; /** diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index 36a98a23ff..40fbc14c59 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -766,6 +766,21 @@ SparseMatrix::precondition_SOR (Vector& dst, const Vector +template +void +SparseMatrix::precondition_TSOR (Vector& dst, const Vector& src, + const number om) const +{ + Assert (cols != 0, ExcMatrixNotInitialized()); + Assert (val != 0, ExcMatrixNotInitialized()); + Assert (m() == n(), ExcMatrixNotSquare()); + + dst = src; + TSOR(dst,om); +}; + + template template void @@ -788,6 +803,29 @@ SparseMatrix::SOR (Vector& dst, const number om) const } +template +template +void +SparseMatrix::TSOR (Vector& 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]; jrowstart[row+1]; ++j) + if (cols->colnums[j] > row) + s -= val[j] * dst(cols->colnums[j]); + + dst(row) = s * om / val[cols->rowstart[row]]; + } +} + + template template void