H2Lib  3.0
Functions
krylovsolvers

Convenience functions for solving linear systems by Krylov methods. More...

Functions

uint solve_cg_avector (void *A, addeval_t addeval_A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method and a general matrix type A. More...
 
uint solve_cg_amatrix_avector (pcamatrix A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method. More...
 
uint solve_cg_sparsematrix_avector (pcsparsematrix A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method. More...
 
uint solve_cg_hmatrix_avector (pchmatrix A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method. More...
 
uint solve_cg_h2matrix_avector (pch2matrix A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method. More...
 
uint solve_cg_dh2matrix_avector (pcdh2matrix A, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method. More...
 
uint solve_pcg_avector (void *A, addeval_t addeval_A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_pcg_amatrix_avector (pcamatrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_pcg_sparsematrix_avector (pcsparsematrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_pcg_hmatrix_avector (pchmatrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_pcg_h2matrix_avector (pch2matrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_pcg_dh2matrix_avector (pcdh2matrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter)
 Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method. More...
 
uint solve_gmres_avector (void *A, addeval_t addeval_A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_gmres_amatrix_avector (pcamatrix A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_gmres_sparsematrix_avector (pcsparsematrix A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_gmres_hmatrix_avector (pchmatrix A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_gmres_h2matrix_avector (pch2matrix A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_gmres_dh2matrix_avector (pcdh2matrix A, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the generalized minimal residual method. More...
 
uint solve_pgmres_avector (void *A, addeval_t addeval_A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 
uint solve_pgmres_amatrix_avector (pcamatrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 
uint solve_pgmres_sparsematrix_avector (pcsparsematrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 
uint solve_pgmres_hmatrix_avector (pchmatrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 
uint solve_pgmres_h2matrix_avector (pch2matrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 
uint solve_pgmres_dh2matrix_avector (pcdh2matrix A, prcd_t prcd, void *pdata, pcavector b, pavector x, real eps, uint maxiter, uint kmax)
 Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method. More...
 

Detailed Description

Convenience functions for solving linear systems by Krylov methods.

Function Documentation

uint solve_cg_amatrix_avector ( pcamatrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_cg_avector ( void *  A,
addeval_t  addeval_A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method and a general matrix type A.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
addeval_AGeneral callback function for evaluation of a matrix A.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_cg_dh2matrix_avector ( pcdh2matrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_cg_h2matrix_avector ( pch2matrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_cg_hmatrix_avector ( pchmatrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_cg_sparsematrix_avector ( pcsparsematrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_gmres_amatrix_avector ( pcamatrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_gmres_avector ( void *  A,
addeval_t  addeval_A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
addeval_AGeneral callback function for evaluation of a matrix A.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_gmres_dh2matrix_avector ( pcdh2matrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_gmres_h2matrix_avector ( pch2matrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_gmres_hmatrix_avector ( pchmatrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_gmres_sparsematrix_avector ( pcsparsematrix  A,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pcg_amatrix_avector ( pcamatrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pcg_avector ( void *  A,
addeval_t  addeval_A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
addeval_AGeneral callback function for evaluation of a matrix A.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pcg_dh2matrix_avector ( pcdh2matrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pcg_h2matrix_avector ( pch2matrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pcg_hmatrix_avector ( pchmatrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pcg_sparsematrix_avector ( pcsparsematrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter 
)

Solve a self-adjoint positive definite system $Ax=b$ with the preconditioned conjugate gradient method.

Parameters
ASystem matrix, has to be self-adjoint and positive definite.
prcdCallback function for preconditioner.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|Ax-b\|_2 \leq \epsilon \|b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
Returns
Number of iterations.
uint solve_pgmres_amatrix_avector ( pcamatrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pgmres_avector ( void *  A,
addeval_t  addeval_A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
addeval_AGeneral callback function for evaluation of a matrix A.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pgmres_dh2matrix_avector ( pcdh2matrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pgmres_h2matrix_avector ( pch2matrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pgmres_hmatrix_avector ( pchmatrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.
uint solve_pgmres_sparsematrix_avector ( pcsparsematrix  A,
prcd_t  prcd,
void *  pdata,
pcavector  b,
pavector  x,
real  eps,
uint  maxiter,
uint  kmax 
)

Solve a linear system $Ax=b$ with the preconditioned generalized minimal residual method.

Parameters
ASystem matrix, should be invertible.
prcdCallback function for preconditioner $N$.
pdataData for prcd callback function.
bRight-hand side vector.
xInitial guess, will be overwritten by approximate solution.
epsRelative accuracy $\epsilon$, the method stops if $\|N(Ax-b)\|_2 \leq \epsilon \|N b\|_2$.
maxiterMaximal number of iterations. maxiter=0 means that the number of iterations is not bounded.
kmaxMaximal dimension of Krylov subspace.
Returns
Number of iterations.