XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ gpbicg_r()

void gpbicg_r ( int  n,
const double  b[],
double  x[],
int  mode,
int  maxiter,
int *  iter,
double *  res,
int  lwork,
double  work[],
int *  info,
double  xx[],
double  yy[],
int *  irev 
)

Solution of linear system Ax = b using conjugate gradient squared (CGS) method (Reverse communication version)

Purpose
This routine solves the linear system Ax = b using the conjugate gradient squared (CGS) method with preconditioning.
Parameters
[in]nDimension of the matrix. (n >= 0) (if n = 0, returns without computation)
[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]modeSpecifies method to be used.
= 0: GPBICG
= 1: BICGSTAB
= 2: BICGSTAB2
(For other values, mode = 0 is assumed.)
[in]maxiterMaximum number of iterations. (maxiter > 0)
[out]iterFinal number of iterations.
[out]resFinal residual norm norm(b - A*x).
[in]lworkSize of array work[]. (lwork >= 13*n)
[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, 13, 14: Breakdown occurred.
[in,out]xx[]Array xx[] for matvec and psolve operations.
[in,out]yy[]Array yy[] for matvec and psolve operations.
[in,out]irevControl variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered (except if converged).
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished. See return code in info.
= 1, 2, 3: matvec operation. User should set A*xx in yy[]. Do not alter any other variables.
= 21, 22: psolve operation. User should set solution of M*xx = yy in xx[]. Do not alter any other variables.
= 91, 92: Returned on every iteration for the convergence test. Set irev = 99 if converged. Do not alter irev otherwise. The latest values in x[], iter and res can be used to decide the convergence. Further, these values may be used to output the intermediate results.