TBCI Numerical high perf. C++ Library
2.8.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
home
abuild
rpmbuild
BUILD
libtbcinumlib2_8-2.8.2-build
numerix-2.0
lina
include
solver
ir.h
Go to the documentation of this file.
1
4
// $Id: ir.h,v 1.7.2.3 2019/05/28 11:13:02 garloff Exp $
5
6
#ifndef TBCI_SOLVER_IR_H
7
#define TBCI_SOLVER_IR_H
8
9
#include "tbci/basics.h"
10
11
NAMESPACE_TBCI
12
30
31
INST3
(
template
<
typename
T
,
Matrix<T>
,
Vector<T>
>
class
NN
friend
\
32
int
IR
(
const
Matrix<T>
&,
Vector<T>
&,
const
Vector<T>
&,\
33
const
Preconditioner_Sig
<
T
,
Matrix<T>
>&,
unsigned
int
&,
double
&);)
34
INST3
(
template
<
typename
T
,
BdMatrix<T>
,
Vector<T>
>
class
NN
friend
\
35
int
IR
(
const
BdMatrix<T>
&,
Vector<T>
&,
const
Vector<T>
&,\
36
const
Preconditioner_Sig
<
T
,
BdMatrix<T>
>&,
unsigned
int
&,
double
&);)
37
38
39
//Aenderung Marco:
40
template < typename T, typename SysMatrix, typename SysVector >
41
int
IR
(
const
SysMatrix
&A, SysVector &
x
,
const
SysVector &
b
,
42
const
Preconditioner_Sig<T, SysMatrix>
&M,
unsigned
int
&max_iter,
double
&tol)
43
{
44
double
resid;
45
unsigned
int
dim = A.rows();
46
SysVector z(dim);
47
48
double
normb =
b
.fabs();
49
if
(normb == 0.0) normb = 1.0;
50
SysVector r(
b
- A*
x
);
51
52
53
if
((resid = r.fabs() / normb) <= tol)
54
{
55
tol = resid;
56
max_iter = 0;
57
return
0;
58
}
59
60
for
(
unsigned
int
i
= 1;
i
<= max_iter;
i
++)
61
{
62
z = M.
solve
(r);
63
x
+= z;
64
r =
b
- A *
x
;
65
if
((resid = r.fabs() / normb) <= tol)
66
{
67
tol = resid;
68
max_iter =
i
;
69
return
0;
70
}
71
}
72
73
tol = resid;
74
return
1;
75
}
76
77
NAMESPACE_END
78
79
#endif
x
const Vector< T > const Vector< T > & x
Definition
LM_fit.h:97
i
int i
Definition
LM_fit.h:71
INST3
#define INST3(x, y, z)
Definition
basics.h:240
NAMESPACE_END
#define NAMESPACE_END
Definition
basics.h:323
NAMESPACE_TBCI
#define NAMESPACE_TBCI
Definition
basics.h:317
T
#define T
Definition
bdmatlib.cc:20
SysMatrix
SysMatrix
Definition
bicgstab.h:90
BdMatrix
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition
band_matrix.h:104
Matrix
Definition
matrix.h:1575
Preconditioner_Sig
Abstract base class for all Preconditioners.
Definition
precond.h:41
Preconditioner_Sig::solve
virtual TVector< T > solve(const Vector< T > &) const =0
Vector
Definition
vector.h:1527
b
F_TMatrix< T > b
Definition
f_matrix.h:736
IR
NAMESPACE_TBCI Vector< T > class NN friend int IR(const BdMatrix< T > &, Vector< T > &, const Vector< T > &, const Preconditioner_Sig< T, BdMatrix< T > > &, unsigned int &, double &)
Generated by
1.16.1