H2Lib  3.0
Typedefs | Functions
krylov

Iterative solvers of Krylov type. More...

Typedefs

typedef void(* addeval_t) (field alpha, void *matrix, pcavector x, pavector y)
 Matrix callback. More...
 
typedef void(* mvm_t) (field alpha, bool trans, void *matrix, pcavector x, pavector y)
 Matrix callback. More...
 
typedef void(* prcd_t) (void *pdata, pavector r)
 Preconditioner callback. More...
 

Functions

real norm2_matrix (mvm_t mvm, void *A, uint rows, uint cols)
 Approximate the spectral norm $\|A\|_2$ of a matrix $A$. More...
 
real norm2diff_matrix (mvm_t mvmA, void *A, mvm_t mvmB, void *B, uint rows, uint cols)
 Approximate the spectral norm $\|A-B\|_2$ of the difference of two matrices $A$ and $B$. More...
 
real norm2diff_pre_matrix (mvm_t mvmA, void *A, prcd_t evalB, prcd_t evaltransB, void *B, uint rows, uint cols)
 Approximate the spectral norm $\|A-B\|_2$ of the difference of two matrices $A$ and $B$. The matrix $B$ is given as a factorization and can be applied to some vector. More...
 
real norm2diff_id_pre_matrix (mvm_t mvmA, void *A, prcd_t solveB, prcd_t solvetransB, void *B, uint rows, uint cols)
 Approximate the spectral norm $\|I - B^{-1}A\|_2$. The matrix $B$ is given as a factorization and can be applied to some vector. Usually $B$ is an approximation to $A$ and therefore this functions measures the quality of some preconditioner for $A$. More...
 
void init_cg (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector r, pavector p, pavector a)
 Initialize a standard conjugate gradient method to solve $A x = b$. More...
 
void step_cg (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector r, pavector p, pavector a)
 One step of a standard conjugate gradient method. More...
 
real evalfunctional_cg (addeval_t addeval, void *matrix, pcavector b, pcavector x, pcavector r)
 error information of a standard conjugate gradient method More...
 
void init_pcg (addeval_t addeval, void *matrix, prcd_t prcd, void *pdata, pcavector b, pavector x, pavector r, pavector q, pavector p, pavector a)
 Initialize a preconditioned conjugate gradient method to solve $N^{1/2} A N^{1/2} \widehat{x} = N^{1/2} b$ with $x = N^{1/2} \widehat{x}$. More...
 
void step_pcg (addeval_t addeval, void *matrix, prcd_t prcd, void *pdata, pcavector b, pavector x, pavector r, pavector q, pavector p, pavector a)
 One step of a preconditioned conjugate gradient method. More...
 
void init_uzawa (prcd_t solve_A11, void *matrix_A11, mvm_t mvm_A21, void *matrix_A21, pcavector b1, pcavector b2, pavector x1, pavector x2, pavector r2, pavector p2, pavector a1, pavector s2)
 Initialize the standard Uzawa iteration. More...
 
void step_uzawa (prcd_t solve_A11, void *matrix_A11, mvm_t mvm_A21, void *matrix_A21, pcavector b1, pcavector b2, pavector x1, pavector x2, pavector r2, pavector p2, pavector a1, pavector s2)
 Perform one step of the standard Uzawa iteration. More...
 
void init_puzawa (prcd_t solve_A11, void *matrix_A11, mvm_t mvm_A21, void *matrix_A21, prcd_t prcd, void *pdata, pcavector b1, pcavector b2, pavector x1, pavector x2, pavector r2, pavector q2, pavector p2, pavector a1, pavector s2)
 Initialize a preconditioned Uzawa iteration. More...
 
void step_puzawa (prcd_t solve_A11, void *matrix_A11, mvm_t mvm_A21, void *matrix_A21, prcd_t prcd, void *pdata, pcavector b1, pcavector b2, pavector x1, pavector x2, pavector r2, pavector q2, pavector p2, pavector a1, pavector s2)
 Perform one step of the preconditioned Uzawa iteration. More...
 
void init_bicg (addeval_t addeval, addeval_t addevaltrans, void *matrix, pcavector b, pavector x, pavector r, pavector rt, pavector p, pavector pt, pavector a, pavector at)
 Initialize a biconjugate gradient method. More...
 
void step_bicg (addeval_t addeval, addeval_t addevaltrans, void *matrix, pcavector b, pavector x, pavector r, pavector rt, pavector p, pavector pt, pavector a, pavector at)
 One step a biconjugate gradient method. More...
 
void init_bicgstab (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector r, pavector rt, pavector p, pavector a, pavector as)
 Initialize a stabilized biconjugate gradient method. More...
 
void step_bicgstab (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector r, pavector rt, pavector p, pavector a, pavector as)
 One step a stabilized biconjugate gradient method. More...
 
void init_gmres (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 Initialize GMRES. More...
 
void step_gmres (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 One step of the GMRES method. More...
 
void finish_gmres (addeval_t addeval, void *matrix, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 Completes or restarts the GMRES method. More...
 
real residualnorm_gmres (pcavector rhat, uint k)
 Returns norm of current residual vector. More...
 
void init_pgmres (addeval_t addeval, void *matrix, prcd_t prcd, void *pdata, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 Initialize preconditioned GMRES. More...
 
void step_pgmres (addeval_t addeval, void *matrix, prcd_t prcd, void *pdata, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 One step of the preconditioned GMRES method. More...
 
void finish_pgmres (addeval_t addeval, void *matrix, prcd_t prcd, void *pdata, pcavector b, pavector x, pavector rhat, pavector q, uint *kk, pamatrix qr, pavector tau)
 Completes or restarts the preconditioned GMRES method. More...
 
real residualnorm_pgmres (pcavector rhat, uint k)
 Returns norm of current preconditioned residual vector. More...
 

Detailed Description

Iterative solvers of Krylov type.

Typedef Documentation

typedef void(* addeval_t) (field alpha, void *matrix, pcavector x, pavector y)

Matrix callback.

Used to evaluate the system matrix $A$ or its adjoint, i.e., to perform $y \gets y + \alpha A x$.

Functions like addeval_amatrix_avector, addevaltrans_amatrix_avector, addeval_hmatrix_avector, addevaltrans_hmatrix_avector, addeval_h2matrix_avector, addevaltrans_h2matrix_avector or addeval_sparsematrix_avector can be cast to addeval_t.

Parameters
alphaScaling factor $\alpha$.
matrixMatrix data describing $A$.
xSource vector $x$.
yTarget vector $y$.
typedef void(* mvm_t) (field alpha, bool trans, void *matrix, pcavector x, pavector y)

Matrix callback.

Used to evaluate the system matrix $A$ or its adjoint, i.e., to perform $y \gets y + \alpha A x$.

Compared to addeval_t, callbacks of this type allow us to evaluate both the matrix and its adjoint.

Functions like mvm_amatrix_avector, mvm_hmatrix_avector, mvm_h2matrix_avector, or mvm_sparsematrix_avector can be cast to mvm_t.

Parameters
alphaScaling factor $\alpha$.
transSet if $A^*$ is to be used instead of $A$.
matrixMatrix data describing $A$.
xSource vector $x$.
yTarget vector $y$.
typedef void(* prcd_t) (void *pdata, pavector r)

Preconditioner callback.

Used to apply a precondtioner to a vector, i.e., to perform $r \gets N r$.

Functions like lrsolve_amatrix_avector, cholsolve_amatrix_avector, ldltsolve_amatrix_avector, qrsolve_amatrix_avector, lrsolve_hmatrix_avector or cholsolve_hmatrix_avector can be cast to prcd_t.

Parameters
pdataPreconditioner data describing $N$.
rSource vector, will be overwritten by result.

Function Documentation

real evalfunctional_cg ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pcavector  x,
pcavector  r 
)

error information of a standard conjugate gradient method

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data (A)
bRight-hand side.
xApproximate solution.
rResidual $b-Ax$
Returns
$-<Ax,x>_2/2$
void finish_gmres ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

Completes or restarts the GMRES method.

Solves the least-squares problem $Q_{k+1}^* A Q_k \widehat{x} = Q_{k+1}^* r$ and performs the update $x \gets x + Q_k \widehat{x}$.

The function calls init_gmres to reset the iteration and prepare for a restart.

Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void finish_pgmres ( addeval_t  addeval,
void *  matrix,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

Completes or restarts the preconditioned GMRES method.

Solves the least-squares problem $Q_{k+1}^* N A Q_k \widehat{x} = Q_{k+1}^* N r$ and performs the update $x \gets x + Q_k \widehat{x}$.

The function calls init_pgmres to reset the iteration and prepare for a restart.

Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
prcdCallback function representing the preconditioner $N$.
pdataData for the prcd callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the preconditioned residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void init_bicg ( addeval_t  addeval,
addeval_t  addevaltrans,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  rt,
pavector  p,
pavector  pt,
pavector  a,
pavector  at 
)

Initialize a biconjugate gradient method.

Parameters
addevalCallback function name
addevaltransCallback function name
matrixuntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
rtAdjoint residual
pSearch direction
ptAdjoint search direction
aauxiliary vector
atauxiliary vector
void init_bicgstab ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  rt,
pavector  p,
pavector  a,
pavector  as 
)

Initialize a stabilized biconjugate gradient method.

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
rtAdjoint residual
pSearch direction
aauxiliary vector
asauxiliary vector
void init_cg ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  p,
pavector  a 
)

Initialize a standard conjugate gradient method to solve $A x = b$.

The matrix $A$ has to be self-adjoint and positive definite (or at least positive semidefinite).

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual $b-Ax$.
pSearch direction.
aAuxiliary vector.
void init_gmres ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

Initialize GMRES.

The parameters are prepared for solving $A x = b$ with the GMRES method.

The maximal dimension of the Krylov subspace is determined by the number of columns of qr: for a k-dimensional subspace, qr->cols==k+1 is required.

Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void init_pcg ( addeval_t  addeval,
void *  matrix,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
pavector  r,
pavector  q,
pavector  p,
pavector  a 
)

Initialize a preconditioned conjugate gradient method to solve $N^{1/2} A N^{1/2} \widehat{x} = N^{1/2} b$ with $x = N^{1/2} \widehat{x}$.

The matrix $A$ has to be self-adjoint and positive definite (or at least positive semidefinite). The matrix $N$ has to be self-adjoint and positive definite.

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data
prcdCallback function name
pdatauntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
qPreconditioned residual
pSearch direction
aauxiliary vector
void init_pgmres ( addeval_t  addeval,
void *  matrix,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

Initialize preconditioned GMRES.

The parameters are prepared for solving $N A x = N b$ with the GMRES method.

The maximal dimension of the Krylov subspace is determined by the number of columns of qr: for a k-dimensional subspace, qr->cols==k+1 is required.

Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
prcdCallback function representing the preconditioner $N$.
pdataData for the prcd callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the preconditioned residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void init_puzawa ( prcd_t  solve_A11,
void *  matrix_A11,
mvm_t  mvm_A21,
void *  matrix_A21,
prcd_t  prcd,
void *  pdata,
pcavector  b1,
pcavector  b2,
pavector  x1,
pavector  x2,
pavector  r2,
pavector  q2,
pavector  p2,
pavector  a1,
pavector  s2 
)

Initialize a preconditioned Uzawa iteration.

The preconditioned Uzawa iteration solves saddle point systems of the form

\[ \begin{pmatrix} A_{11} & A_{21}^*\\ A_{21} & \end{pmatrix} \begin{pmatrix} x_1\\ x_2 \end{pmatrix} = \begin{pmatrix} b_1\\ b_2 \end{pmatrix} \]

by applying the preconditioned conjugate gradient method to the Schur complement. The matrix $A_{11}$ has to be symmetric and positive definite. If $A_{21}$ is not surjective, $b_2$ will only be determined up to an element of the null space of $A_{21}^*$.

Parameters
solve_A11Callback for solving $A_{11} x_1 = b_1$
matrix_A11Data for solve_A11 callback
mvm_A21Callback for evaluating $A_{21} x_1$ or $A_{21}^* x_2$
matrix_A21Data for mvm_A21 callback
prcdCallback function name
pdatauntyped pointer to matrix data
b1Right-hand side vector $b_1$
b2Right-hand side vector $b_2$
x1Approximate solution vector $x_1$
x2Approximate solution vector $x_2$
r2Residual of the Schur complement system, may be useful for a stopping criterion
p2Search direction for Schur complement system
q2Auxiliary variable of the same dimension as $r2$
a1Auxiliary variable of the same dimension as $x_1$
s2Auxiliary variable of the same dimension as $x_2$
void init_uzawa ( prcd_t  solve_A11,
void *  matrix_A11,
mvm_t  mvm_A21,
void *  matrix_A21,
pcavector  b1,
pcavector  b2,
pavector  x1,
pavector  x2,
pavector  r2,
pavector  p2,
pavector  a1,
pavector  s2 
)

Initialize the standard Uzawa iteration.

The Uzawa iteration solves saddle point systems of the form

\[ \begin{pmatrix} A_{11} & A_{21}^*\\ A_{21} & \end{pmatrix} \begin{pmatrix} x_1\\ x_2 \end{pmatrix} = \begin{pmatrix} b_1\\ b_2 \end{pmatrix} \]

by applying the conjugate gradient method to the Schur complement. The matrix $A_{11}$ has to be symmetric and positive definite. If $A_{21}$ is not surjective, $b_2$ will only be determined up to an element of the null space of $A_{21}^*$.

Parameters
solve_A11Callback for solving $A_{11} x_1 = b_1$
matrix_A11Data for solve_A11 callback
mvm_A21Callback for evaluating $A_{21} x_1$ or $A_{21}^* x_2$
matrix_A21Data for mvm_A21 callback
b1Right-hand side vector $b_1$
b2Right-hand side vector $b_2$
x1Approximate solution vector $x_1$
x2Approximate solution vector $x_2$
r2Residual of the Schur complement system, may be useful for a stopping criterion
p2Search direction for Schur complement system
a1Auxiliary variable of the same dimension as $x_1$
s2Auxiliary variable of the same dimension as $x_2$
real norm2_matrix ( mvm_t  mvm,
void *  A,
uint  rows,
uint  cols 
)

Approximate the spectral norm $\|A\|_2$ of a matrix $A$.

The spectral norm is approximated by applying a few steps of the power iteration to the matrix $A^* A$ and computing the square root of the resulting eigenvalue approximation.

Parameters
mvmCallback function for evaluating A and its adjoint.
AMatrix $A$.
rowsNumber of rows of A.
colsNumber of columns of A.
Returns
Approximation of $\|A\|_2$.
real norm2diff_id_pre_matrix ( mvm_t  mvmA,
void *  A,
prcd_t  solveB,
prcd_t  solvetransB,
void *  B,
uint  rows,
uint  cols 
)

Approximate the spectral norm $\|I - B^{-1}A\|_2$. The matrix $B$ is given as a factorization and can be applied to some vector. Usually $B$ is an approximation to $A$ and therefore this functions measures the quality of some preconditioner for $A$.

The spectral norm is approximated by applying a few steps of the power iteration to the matrix $(I - B^{-1}A)^* (I - B^{-1}A)$ and computing the square root of the resulting eigenvalue approximation. $B$ is usually given as a LR decomposition or cholesky factorization of $A$.

Parameters
mvmACallback function for evaluating A and its adjoint.
AMatrix $A$.
solveBCallback function for solving a linear system with B.
solvetransBCallback function for solving a linear system with the adjoint of B.
BFactorized matrix $B$.
rowsNumber of rows of either A and B.
colsNumber of columns of either A and B.
Returns
Approximation of $\|I - B^{-1}A\|_2$.
real norm2diff_matrix ( mvm_t  mvmA,
void *  A,
mvm_t  mvmB,
void *  B,
uint  rows,
uint  cols 
)

Approximate the spectral norm $\|A-B\|_2$ of the difference of two matrices $A$ and $B$.

The spectral norm is approximated by applying a few steps of the power iteration to the matrix $(A-B)^* (A-B)$ and computing the square root of the resulting eigenvalue approximation.

Parameters
mvmACallback function for evaluating A and its adjoint.
AMatrix $A$.
mvmBCallback function for evaluating B and its adjoint.
BMatrix $B$.
rowsNumber of rows of either A and B.
colsNumber of columns of either A and B.
Returns
Approximation of $\|A-B\|_2$.
real norm2diff_pre_matrix ( mvm_t  mvmA,
void *  A,
prcd_t  evalB,
prcd_t  evaltransB,
void *  B,
uint  rows,
uint  cols 
)

Approximate the spectral norm $\|A-B\|_2$ of the difference of two matrices $A$ and $B$. The matrix $B$ is given as a factorization and can be applied to some vector.

The spectral norm is approximated by applying a few steps of the power iteration to the matrix $(A-B)^* (A-B)$ and computing the square root of the resulting eigenvalue approximation. $B$ is usually given as a LR decomposition or cholesky factorization of $A$.

Parameters
mvmACallback function for evaluating A and its adjoint.
AMatrix $A$.
evalBCallback function for evaluating B.
evaltransBCallback function for evaluating the adjoint of B.
BFactorized matrix $B$.
rowsNumber of rows of either A and B.
colsNumber of columns of either A and B.
Returns
Approximation of $\|A-B\|_2$.
real residualnorm_gmres ( pcavector  rhat,
uint  k 
)

Returns norm of current residual vector.

Parameters
rhatTransformed residual. The absolute value of rhat[k] is the Euclidean norm of the residual.
kCurrent dimension of the Krylov space.
Returns
Norm of the residual.
real residualnorm_pgmres ( pcavector  rhat,
uint  k 
)

Returns norm of current preconditioned residual vector.

Parameters
rhatTransformed residual. The absolute value of rhat[k] is the Euclidean norm of the preconditioned residual.
kCurrent dimension of the Krylov space.
Returns
Norm of the residual.
void step_bicg ( addeval_t  addeval,
addeval_t  addevaltrans,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  rt,
pavector  p,
pavector  pt,
pavector  a,
pavector  at 
)

One step a biconjugate gradient method.

Parameters
addevalCallback function name
addevaltransCallback function name
matrixuntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
rtAdjoint residual
pSearch direction
ptAdjoint search direction
aauxiliary vector
atauxiliary vector
void step_bicgstab ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  rt,
pavector  p,
pavector  a,
pavector  as 
)

One step a stabilized biconjugate gradient method.

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
rtAdjoint residual
pSearch direction
aauxiliary vector
asauxiliary vector
void step_cg ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  r,
pavector  p,
pavector  a 
)

One step of a standard conjugate gradient method.

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data (A)
bRight-hand side.
xApproximate solution.
rResidual b-Ax
pSearch direction
aauxiliary vector
void step_gmres ( addeval_t  addeval,
void *  matrix,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

One step of the GMRES method.

If *kk+1 >= qr->cols, there is no room for the next Arnoldi basis vector and the function returns immediately. It can be restarted using finish_gmres.

Otherwise a new vector is added to the Arnoldi basis and the matrix $Q_{k+1}^* A Q_k$ is updated.

Remarks
This function currently makes no use of b and does not update x. The current residual can be tracked via rhat[*kk]. Once it is sufficiently small, the improved solution x can be obtained by using finish_gmres.
Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void step_pcg ( addeval_t  addeval,
void *  matrix,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
pavector  r,
pavector  q,
pavector  p,
pavector  a 
)

One step of a preconditioned conjugate gradient method.

Parameters
addevalCallback function name
matrixuntyped pointer to matrix data
prcdCallback function name
pdatauntyped pointer to matrix data
bRight-hand side.
xApproximate solution.
rResidual b-Ax
qPreconditioned residual
pSearch direction
aauxiliary vector
void step_pgmres ( addeval_t  addeval,
void *  matrix,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
pavector  rhat,
pavector  q,
uint kk,
pamatrix  qr,
pavector  tau 
)

One step of the preconditioned GMRES method.

If *kk+1 >= qr->cols, there is no room for the next Arnoldi basis vector and the function returns immediately. It can be restarted using finish_gmres.

Otherwise a new vector is added to the Arnoldi basis and the matrix $Q_{k+1}^* N A Q_k$ is updated.

Remarks
This function currently makes no use of b and does not update x. The current preconditioned residual can be tracked via rhat[*kk]. Once it is sufficiently small, the improved solution x can be obtained by using finish_gmres.
Parameters
addevalCallback function representing the matrix $A$.
matrixData for the addeval callback.
prcdCallback function representing the preconditioner $N$.
pdataData for the prcd callback.
bRight-hand side vector $b$.
xInitial guess for the solution $x$, will eventually be replaced by an improved approximation.
rhatTransformed residual. The absolute value of rhat[*kk] is the Euclidean norm of the preconditioned residual.
qNext vector of the Krylov basis, constructed by Householder's elementary reflectors.
kkPointer to current dimension of the Krylov space.
qrRepresentation of the Arnoldi basis $Q_{k+1}$ and the transformed matrix $Q_{k+1}^* A Q_k$.
tauScaling factors of elementary reflectors, provided by qrdecomp_amatrix.
void step_puzawa ( prcd_t  solve_A11,
void *  matrix_A11,
mvm_t  mvm_A21,
void *  matrix_A21,
prcd_t  prcd,
void *  pdata,
pcavector  b1,
pcavector  b2,
pavector  x1,
pavector  x2,
pavector  r2,
pavector  q2,
pavector  p2,
pavector  a1,
pavector  s2 
)

Perform one step of the preconditioned Uzawa iteration.

Parameters
solve_A11Callback for solving $A_{11} x_1 = b_1$
matrix_A11Data for solve_A11 callback
mvm_A21Callback for evaluating $A_{21} x_1$ or $A_{21}^* x_2$
matrix_A21Data for mvm_A21 callback
prcdCallback function name
pdatauntyped pointer to matrix data
b1Right-hand side vector $b_1$
b2Right-hand side vector $b_2$
x1Approximate solution vector $x_1$
x2Approximate solution vector $x_2$
r2Residual of the Schur complement system, may be useful for a stopping criterion
q2Auxiliary variable of the same dimension as $r2$
p2Search direction for Schur complement system
a1Auxiliary variable of the same dimension as $x_1$
s2Auxiliary variable of the same dimension as $x_2$
void step_uzawa ( prcd_t  solve_A11,
void *  matrix_A11,
mvm_t  mvm_A21,
void *  matrix_A21,
pcavector  b1,
pcavector  b2,
pavector  x1,
pavector  x2,
pavector  r2,
pavector  p2,
pavector  a1,
pavector  s2 
)

Perform one step of the standard Uzawa iteration.

Parameters
solve_A11Callback for solving $A_{11} x_1 = b_1$
matrix_A11Data for solve_A11 callback
mvm_A21Callback for evaluating $A_{21} x_1$ or $A_{21}^* x_2$
matrix_A21Data for mvm_A21 callback
b1Right-hand side vector $b_1$
b2Right-hand side vector $b_2$
x1Approximate solution vector $x_1$
x2Approximate solution vector $x_2$
r2Residual of the Schur complement system, may be useful for a stopping criterion
p2Search direction for Schur complement system
a1Auxiliary variable of the same dimension as $x_1$
s2Auxiliary variable of the same dimension as $x_2$