// -*- C++ -*-
// $RCSfile: cg.h,v $
// $Revision: 1.3 $
// $Author: langer $
// $Date: 2000/10/31 19:15:09 $

// Not written by the OOF team..

//*****************************************************************
// Iterative template routine -- CG
//
// CG solves the symmetric positive definite linear
// system Ax=b using the Conjugate Gradient method.
//
// CG follows the algorithm described on p. 15 in the 
// SIAM Templates book.
//
// The return value indicates convergence within max_iter (input)
// iterations (0), or no convergence within max_iter iterations (1).
//
// Upon successful return, output arguments have the following values:
//  
//        x  --  approximate solution to Ax = b
// max_iter  --  the number of iterations performed before the
//               tolerance was reached
//      tol  --  the residual after the final iteration
//  
//*****************************************************************

#ifndef CG_H
#define CG_H

template < class Matrix, class Vector, class Preconditioner, class Real >
int 
CG(const Matrix &A, Vector &x, const Vector &b,
   const Preconditioner &M, int &max_iter, Real &tol);

#include "cg.C"
#endif // CG_H


syntax highlighted by Code2HTML, v. 0.9.1