Go to the documentation of this file.
16 const double omega = 1.0;
17 const int maxiter = 1000;
18 const double tol = 1e-5,
21 int nrows = SK.
Nrows();
22 assert( nrows ==
static_cast<int>(f.size()) && f.size() == u.size() );
24 cout << endl <<
" Start Jacobi solver for " << nrows <<
" d.o.f.s" << endl;
26 for (
int k = 0; k < nrows; ++k)
31 vector<double> dd(nrows);
32 vector<double> r(nrows);
33 vector<double> w(nrows);
42 double sigma0 =
dscapr(w, r);
46 double sigma = sigma0;
47 while ( sigma > tol2 * sigma0 && maxiter > iter)
56 cout <<
"aver. Jacobi rate : " << exp(log(sqrt(sigma / sigma0)) / iter) <<
" (" << iter <<
" iter)" << endl;
57 cout <<
"final error: " << sqrt(sigma / sigma0) <<
" (rel) " << sqrt(sigma) <<
" (abs)\n";
void vdaxpy(std::vector< double > &x, std::vector< double > const &y, double alpha, std::vector< double > const &z)
Element-wise daxpy operation x(k) = y(k) + alpha*z(k).
double dscapr(std::vector< double > const &x, std::vector< double > const &y)
Calculates the Euclidian inner product of two vectors.
void GetDiag(std::vector< double > &d) const
void vddiv(vector< double > &x, vector< double > const &y, vector< double > const &z)
void JacobiSolve(CRS_Matrix const &SK, vector< double > const &f, vector< double > &u)
void Defect(std::vector< double > &w, std::vector< double > const &f, std::vector< double > const &u) const