Go to the source code of this file.
Definition at line 14 of file 17-numcxx-cg.cxx.
33 if (i<n-1) A(i,i+1)=-1;
44 double residual=
normi(A*U-F);
45 std::cout <<
"residual:" << residual << std::endl;
static std::shared_ptr< TPreconJacobi< T > > create(const std::shared_ptr< TSparseMatrix< T >> pA)
Create preconditioner.
Jacobi preconditioner class.
A::value_type normi(const A &a)
Maximum norm of array or expression.
int CG(const Matrix &A, Vector &x, const Vector &b, const Preconditioner &M, int &max_iter, Real &tol)
Iterative template routine – CG.
static std::shared_ptr< TArray1< T > > create(index n1)
Construct smart pointer empty 1D Array.
static std::shared_ptr< TSparseMatrix< T > > create(index n1, index n2)
Static wrapper around corresponding constructor.