gmres [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:itl,algorithms Component type:function
Prototype
template < class Matrix, class Vector, class VectorB, class Preconditioner, class Iter >
int gmres(const Matrix &A, Vector &x, const VectorB &b, const Preconditioner &M, int m, Iter& outer) ;
Description
This solve the unsymmetric linear system Ax = b using restarted GMRES.

A return value of 0 indicates convergence within the maximum number of iterations (determined by the iter object). A return value of 1 indicates a failure to converge.

On instantiating Iteration object outer, the first parameter Vector w must be the precondtioned one, i.e., M.solve(b, w) where b is right side of linear system. See test_gmres.cc for example.

See: Y. Saad and M. Schulter. GMRES: A generalized minimum residual algorithm for solving nonsysmmetric linear systems, SIAM J. Sci. Statist. Comp. 7(1986), pp, 856-869

Definition
gmres.h
Preconditions
Complexity
Example
In gmres.cc:
typedef matrix< Type, 
                rectangle<>, 
	        array< compressed<> >, 
                row_major >::type Matrix;
  Matrix A(5, 5);
  //SSOR preconditioner
  SSOR<Matrix> precond(A);
  SSOR<Matrix>::Precond p = precond();

  dense1D<Type> b2(A.ncols());
  p.solve(b, b2); //gmres needs teh preconditioned b to pass into iter object.
  //iteration
  noisy_iteration<double> iter(b2, max_iter, 1e-6);

  //gmres algorithm
  gmres(A, x, b, p, 10, iter); //restart constant: 10

Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.