Precond_Ssor.hxx
1 // Copyright (C) 2003-2009 Marc DuruflĂ©
2 //
3 // This file is part of the linear-algebra library Seldon,
4 // http://seldon.sourceforge.net/.
5 //
6 // Seldon is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your option)
9 // any later version.
10 //
11 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
14 // more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with Seldon. If not, see http://www.gnu.org/licenses/.
18 
19 
20 #ifndef SELDON_FILE_PRECOND_SSOR_HXX
21 
22 namespace Seldon
23 {
24 
25  template <class T>
27  {
28  protected :
30  int nb_iter;
31  typename ClassComplexType<T>::Treal omega;
32 
33  public :
35 
36  bool IsSymmetric() const;
39 
40  void SetParameterRelaxation(const typename ClassComplexType<T>::Treal& param);
41  void SetNumberIterations(int nb_iterations);
43 
44 #ifdef SELDON_WITH_VIRTUAL
45  template<class T0>
46  void SolveGen(const SeldonTranspose&, const VirtualMatrix<T>&, const Vector<T0>&, Vector<T0>&,
47  bool init_guess_null = true);
48 
49  void Solve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>& z);
50  void TransSolve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>&);
51 
52  void Solve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>& z, bool init);
53  void TransSolve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>&, bool init);
54 #else
55  template<class Vector1, class Matrix1>
56  void Solve(const Matrix1& A, const Vector1& r, Vector1& z,
57  bool init_guess_null = true);
58 
59  template<class Vector1, class Matrix1>
60  void TransSolve(const Matrix1& A, const Vector1& r, Vector1& z,
61  bool init_guess_null = true);
62 #endif
63 
64  };
65 
66 }
67 
68 #define SELDON_FILE_PRECOND_SSOR_HXX
69 #endif
Seldon::SeldonTranspose
Definition: MatrixFlag.hxx:32
Seldon::SorPreconditioner::SetNumberIterations
void SetNumberIterations(int nb_iterations)
sets the number of SOR sweeps to perform when calling Solve/TransSolve
Definition: Precond_Ssor.cxx:71
Seldon::Vector
Definition: SeldonHeader.hxx:207
Seldon::SorPreconditioner::InitUnSymmetricPreconditioning
void InitUnSymmetricPreconditioning()
if called, forward sweep is applied when calling Solve backward sweep is applied when calling TransSo...
Definition: Precond_Ssor.cxx:54
Seldon::SorPreconditioner::InitSymmetricPreconditioning
void InitSymmetricPreconditioning()
if called forward and backward sweep will be applied such that the preconditioning is symmetric
Definition: Precond_Ssor.cxx:45
Seldon::SorPreconditioner::symmetric_precond
bool symmetric_precond
true for Symmetric relaxation
Definition: Precond_Ssor.hxx:29
Seldon::SorPreconditioner::Solve
void Solve(const Matrix1 &A, const Vector1 &r, Vector1 &z, bool init_guess_null=true)
Solves M z = r.
Definition: Precond_Ssor.cxx:163
Seldon::SorPreconditioner::SorPreconditioner
SorPreconditioner()
Default constructor.
Definition: Precond_Ssor.cxx:27
Seldon::SorPreconditioner::nb_iter
int nb_iter
number of iterations
Definition: Precond_Ssor.hxx:30
Seldon::SorPreconditioner::SetParameterRelaxation
void SetParameterRelaxation(const typename ClassComplexType< T >::Treal &param)
sets the relaxation parameter omega
Definition: Precond_Ssor.cxx:63
Seldon::SorPreconditioner::omega
ClassComplexType< T >::Treal omega
relaxation parameter
Definition: Precond_Ssor.hxx:31
Seldon::SorPreconditioner::TransSolve
void TransSolve(const Matrix1 &A, const Vector1 &r, Vector1 &z, bool init_guess_null=true)
Solves M^t z = r.
Definition: Precond_Ssor.cxx:178
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::SorPreconditioner
Definition: Precond_Ssor.hxx:26
Seldon::VirtualMatrix
Abstract base class for all matrices.
Definition: Matrix_Base.hxx:42
Seldon::SorPreconditioner::CopyParameter
void CopyParameter(const Preconditioner_Base< T > &)
copies the parameters of another sor preconditioning
Definition: Precond_Ssor.cxx:79
Seldon::Preconditioner_Base
Base class for preconditioners.
Definition: Iterative.hxx:26
Seldon::SorPreconditioner::IsSymmetric
bool IsSymmetric() const
returns true if symmetric sor is used
Definition: Precond_Ssor.cxx:36