FV3 Bundle
IPCG.h File Reference

Inexact-Preconditioned Conjugate Gradients solver. More...

#include <cmath>
#include <vector>
#include "oops/util/dot_product.h"
#include "oops/util/formats.h"
#include "oops/util/Logger.h"
Include dependency graph for IPCG.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 oops
 The namespace for the main oops code.
 

Functions

template<typename VECTOR , typename AMATRIX , typename PMATRIX >
double oops::IPCG (VECTOR &x, const VECTOR &b, const AMATRIX &A, const PMATRIX &precond, const int maxiter, const double tolerance)
 

Detailed Description

Inexact-Preconditioned Conjugate Gradients solver.

Golub-Ye Inexact-Preconditioned Conjugate Gradients solver for Ax=b. (G.H. Golub and Q. Ye 1999/00, SIAM J. Sci. Comput. 21(4) 1305-1320.)

A must be square, symmetric, positive definite. A preconditioner must be supplied that, given a vector q, returns an approximate solution of Ap=q. The preconditioner can be variable.

On entry:

  • x = starting point, \( x_0 \).
  • b = right hand side.
  • A = \( A \).
  • precond = preconditioner \( F_k \approx (A)^{-1} \).

On exit, x will contain the solution. The return value is the achieved reduction in residual norm.

Iteration will stop if the maximum iteration limit "maxiter" is reached or if the residual norm reduces by a factor of "tolerance".

VECTOR must implement:

  • dot_product
  • operator(=)
  • operator(+=),
  • operator(-=)
  • operator(*=) [double * VECTOR],
  • axpy

AMATRIX and PMATRIX must implement a method:

  • void multiply(const VECTOR&, VECTOR&) const

which applies the matrix to the first argument, and returns the matrix-vector product in the second. (Note: the const is optional, but recommended.)

Definition in file IPCG.h.