#include <tnt_iml.h>
Public Member Functions | |
Diagonal_Preconditioner (int N, const SCALAR *V) | |
Diagonal_Preconditioner (const Vector< SCALAR > &V) | |
Vector< SCALAR > | operator() (const Vector< SCALAR > &b) const |
Private Attributes | |
Vector< SCALAR > | one_over_diag_ |
Example:
double Vals1 = { .... }; complex<double> Vals2 = { .... }; double Vals3 = { ... };
Matrix<double> A(N, N, Vals1); Sparse_Matrix< complex<double> > S(M, M, nz, I, J, Vals2);
DiagonalPreconditioner<double> D1 (A.diag()); DiagonalPreconditioner<complex> D2(S.diag()); DiagonalPreconditioner<double> D3(N, Vals3);
x = D1(b); (solve diag(A) * x = b )
This is a funciton object which is invoked using operator(). That is, its use appears like a function call, f(x), where x is a vector. Preconditioners are read-only objects --their contents cannot be modified. If one of the diagonal elements of A is zero, then the results are undefined. (In some implementations, the reciprocals of the diagonals are kept to avoid costly floating point divisions. These may be created at time of object construction and result in floating point exceptions.
Definition at line 42 of file tnt_iml.h.
TNT::Linear_Algebra::Diagonal_Preconditioner< SCALAR >::Diagonal_Preconditioner | ( | int | N, | |
const SCALAR * | V | |||
) | [inline] |
TNT::Linear_Algebra::Diagonal_Preconditioner< SCALAR >::Diagonal_Preconditioner | ( | const Vector< SCALAR > & | V | ) | [inline] |
Vector<SCALAR> TNT::Linear_Algebra::Diagonal_Preconditioner< SCALAR >::operator() | ( | const Vector< SCALAR > & | b | ) | const [inline] |
Vector<SCALAR> TNT::Linear_Algebra::Diagonal_Preconditioner< SCALAR >::one_over_diag_ [private] |