HalleyChebyAD
|
#include <limits>
#include <memory>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
Go to the source code of this file.
Functions | |
template<typename Operator , typename Vector , typename Preconditioner > | |
int | MINRES (const Operator &A, Vector &x, const Vector &b, const Preconditioner *M, double shift, int &max_iter, double &tol, bool show) |
Preconditioner Minres algorithm. More... | |
int MINRES | ( | const Operator & | A, |
Vector & | x, | ||
const Vector & | b, | ||
const Preconditioner * | M, | ||
double | shift, | ||
int & | max_iter, | ||
double & | tol, | ||
bool | show | ||
) |
Preconditioner Minres algorithm.
minres solves the n x n system of linear equations Ax = b or the n x n least squares problem min ||Ax - b||_2^2, where A is a symmetric matrix (possibly indefinite or singular) and b is a given vector. The dimension n is defined by length(b).
A | const OPERATOR & (INPUT) A is a linear operator with a method Apply(const Vector & X, Vector & Y) which gives the product y = A*x for any given n-vector x. |
x | VECTOR & (INPUT/OUTPUT) "x" is the initial guess (INPUT) and the solution of the linear system (OUTPUT). |
b | const VECTOR & (INPUT) "b" is the right hand side of the linear system |
M | const PRECONDITIONER * (INPUT) "M" is a linear operator (preconditioner) with a method Apply(const Vector & X, Vector & Y) such that y = M(x) solves the system My = x given any n-vector x. If M is a null pointer, preconditioning is not used. Otherwise, "M" defines a (implicitely) a positive-definite preconditioner M = C*C'. |
shift | double (INPUT) If shift != 0, minres really solves (A - shift*I)x = b (or the corresponding least-squares problem if shift is an eigenvalue of A). |
max_iter | int& (INPUT/OUTPUT) "max_iter" is the maximum number of minres iterations (INPUT) and the actual number of iteration at termination (OUTPUT) |
tol | double& (INPUT) "tol" is tolerance for the stopping criterion |
show | bool (INPUT) If "show" is true print information on screen. |
When M = C*C' exists, minres implicitly solves the system
P(A - shift*I)P'xbar = Pb, i.e. Abar xbar = bbar, where P = inv(C), Abar = P(A - shift*I)P', bbar = Pb, and returns the solution x = P'xbar. The associated residual is rbar = bbar - Abar xbar = P(b - (A - shift*I)x) = Pr.
Known bugs:
Other notes: