IterativeInline.cxx
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_ITERATIVE_INLINE_CXX
21 
22 namespace Seldon
23 {
24 
26  template<class T>
28  {
29  }
30 
31 
32 #ifdef SELDON_WITH_VIRTUAL
33  template<class T>
36  {
37  }
38 
39 
41 
44  template<class T>
45  inline void Preconditioner_Base<T>
46  ::Solve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>& z)
47  {
48  Copy(r, z);
49  }
50 
52 
55  template<class T>
56  inline void Preconditioner_Base<T>
57  ::TransSolve(const VirtualMatrix<T>&, const Vector<T>& r, Vector<T>& z)
58  {
59  Copy(r, z);
60  }
61 
62 
64  template<class T>
65  inline void Preconditioner_Base<T>
66  ::SetInputPreconditioning(const string& keyword, const Vector<string>& param)
67  {
68  }
69 
70 
72  template<class T>
73  inline void Preconditioner_Base<T>::CopyParameter(const Preconditioner_Base<T>&)
74  {
75  }
76 
77 
78 #else
79 
80 
82 
85  template<class T> template<class Matrix1, class Vector1>
86  inline void Preconditioner_Base<T>
87  ::Solve(const Matrix1& A, const Vector1& r, Vector1& z)
88  {
89  Copy(r, z);
90  }
91 
92 
94 
97  template<class T> template<class Matrix1, class Vector1>
98  inline void Preconditioner_Base<T>
99  ::TransSolve(const Matrix1& A, const Vector1 & r, Vector1 & z)
100  {
101  Solve(A, r, z);
102  }
103 #endif
104 
105 
107  template<class T> template<class T1, class Matrix1, class Vector1>
108  inline void Iteration<T>
109  ::MltAdd(const T1& alpha, const Matrix1& A, const Vector1& x,
110  const T1& beta, Vector1& y)
111  {
112 #ifdef SELDON_WITH_VIRTUAL
113  A.MltAddVector(alpha, x, beta, y);
114 #else
115  Seldon::MltAdd(alpha, A, x, beta, y);
116 #endif
117  }
118 
119 
121  template<class T> template<class Matrix1, class Vector1>
122  inline void Iteration<T>
123  ::Mlt(const Matrix1& A, const Vector1& x, Vector1& y)
124  {
125 #ifdef SELDON_WITH_VIRTUAL
126  A.MltVector(x, y);
127 #else
128  Seldon::Mlt(A, x, y);
129 #endif
130  }
131 
132 
134  template<class T> template<class Matrix1, class Vector1>
135  inline void Iteration<T>
137  const Matrix1& A, const Vector1& x, Vector1& y)
138  {
139 #ifdef SELDON_WITH_VIRTUAL
140  A.MltVector(trans, x, y);
141 #else
142  Seldon::Mlt(trans, A, x, y);
143 #endif
144  }
145 
146 
147 } // end namespace
148 
149 #define SELDON_FILE_ITERATIVE_INLINE_CXX
150 #endif
151 
Seldon::Preconditioner_Base::Preconditioner_Base
Preconditioner_Base()
Default constructor.
Definition: IterativeInline.cxx:27
Seldon::Iteration::Mlt
void Mlt(const Matrix1 &A, const Vector1 &x, Vector1 &y)
Computes y = A x.
Definition: IterativeInline.cxx:123
Seldon::class_SeldonTrans
Definition: MatrixFlag.hxx:55
Seldon::Iteration::MltAdd
void MltAdd(const T1 &alpha, const Matrix1 &A, const Vector1 &x, const T1 &beta, Vector1 &y)
Computes y = beta y + alpha A x.
Definition: IterativeInline.cxx:109
Seldon::Preconditioner_Base::TransSolve
void TransSolve(const Matrix1 &A, const Vector1 &r, Vector1 &z)
Solves M^t z = r.
Definition: IterativeInline.cxx:99
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::Preconditioner_Base::Solve
void Solve(const Matrix1 &A, const Vector1 &r, Vector1 &z)
Solves M z = r.
Definition: IterativeInline.cxx:87
Seldon::Preconditioner_Base
Base class for preconditioners.
Definition: Iterative.hxx:26