|
|
◆ fom()
| void fom |
( |
int |
n, |
|
|
void(*)(int, const double[], double[]) |
matvec, |
|
|
void(*)(int, const double[], double[]) |
psolve, |
|
|
void(*)(int, const double[], double, int, int *) |
chkconv, |
|
|
const double |
b[], |
|
|
double |
x[], |
|
|
int |
m, |
|
|
int |
maxiter, |
|
|
int * |
iter, |
|
|
double * |
res, |
|
|
int |
lwork, |
|
|
double |
work[], |
|
|
int * |
info |
|
) |
| |
Solution of linear system Ax = b using full orthogonalization method (FOM)
- Purpose
- This routine solves the linear system Ax = b using the full orthogonalization iterative method (FOM) with preconditioning.
- Parameters
-
| [in] | n | Dimension of the matrix. (n >= 0) (If n = 0, returns without computation) |
| [in] | matvec | User supplied subroutine which calculates the matrix and vector product as follows.
code void matvec(int n, const double x[], double y[]) { Compute A*x, and return result in y[]. } endcode |
| [in] | psolve | User supplied subroutine which perform the preconditioner solve routine for the linear system M*x = b as follows, where M is a preconditioner metrix.
code void psolve(int n, const double b[], double x[]) { Solve M*x = b, and return solution in x[]. } endcode |
| [in] | chkconv | User supplied subroutine which is called on every iteration for the convergence test as follows, where x[] is the current approximate solution, res is the current residual norm norm(b - A*x), and iter is the current number of iterations. This routine can also be used to output the intermediate results.
code void chkconv(int n, const double x[], double res, int iter, int *ichk) { Set *ichk = 1 if converged. Otherwise, set *ichk = 0. } endcode |
| [in] | b[] | Array b[lb] (lb >= n)
Right hand side vector b. |
| [in,out] | x[] | Array x[lx] (lx >= n)
[in] Initial guess of solution.
[out] Obtained approximate solution. |
| [in] | m | Restart parameter. (0 < m <= n) |
| [in] | maxiter | Maximum number of iterations. (maxiter > 0) |
| [out] | iter | Final number of iterations. |
| [out] | res | Final residual norm norm(b - A*x). |
| [in] | lwork | Size of array work[]. (lwork >= (m + 6)*n + (m + 2)*m) |
| [out] | work[] | Array work[lwork]
Work array. |
| [out] | info | = 0: Successful exit
< 0: The (-info)-th argument is invalid.
= 11: Maximum number of iterations exceeded.
= 12: Breakdown occurred. |
|