GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
solvers_krylov.c File Reference
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/gmath.h>
#include <grass/glocale.h>
Include dependency graph for solvers_krylov.c:

Go to the source code of this file.

Macros

#define G_MATH_ROWSCALE_L2_NORM_PRECONDITION   1
 
#define G_MATH_ROWSCALE_L1_NORM_PRECONDITION   2
 
#define G_MATH_DIAGONAL_PRECONDITION   3
 

Functions

int G_math_solver_pcg (double **A, double *x, double *b, int rows, int maxit, double err, int prec)
 The iterative preconditioned conjugate gradients solver for symmetric positive definite matrices. More...
 
int G_math_solver_sparse_pcg (G_math_spvector **Asp, double *x, double *b, int rows, int maxit, double err, int prec)
 The iterative preconditioned conjugate gradients solver for sparse symmetric positive definite matrices. More...
 
int G_math_solver_cg (double **A, double *x, double *b, int rows, int maxit, double err)
 The iterative conjugate gradients solver for symmetric positive definite matrices. More...
 
int G_math_solver_sparse_cg (G_math_spvector **Asp, double *x, double *b, int rows, int maxit, double err)
 The iterative conjugate gradients solver for sparse symmetric positive definite matrices. More...
 
int G_math_solver_bicgstab (double **A, double *x, double *b, int rows, int maxit, double err)
 The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices. More...
 
int G_math_solver_sparse_bicgstab (G_math_spvector **Asp, double *x, double *b, int rows, int maxit, double err)
 The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices. More...
 

Macro Definition Documentation

#define G_MATH_DIAGONAL_PRECONDITION   3

Definition at line 29 of file solvers_krylov.c.

#define G_MATH_ROWSCALE_L1_NORM_PRECONDITION   2

Definition at line 28 of file solvers_krylov.c.

#define G_MATH_ROWSCALE_L2_NORM_PRECONDITION   1

Definition at line 27 of file solvers_krylov.c.

Function Documentation

int G_math_solver_bicgstab ( double **  A,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err 
)

The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices.

This iterative solver works with regular quadratic matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
A(double **) – the matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criterias
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 466 of file solvers_krylov.c.

References NULL.

int G_math_solver_cg ( double **  A,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err 
)

The iterative conjugate gradients solver for symmetric positive definite matrices.

This iterative solver works with symmetric positive definite regular quadratic matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
A(double **) – the matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criteria
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 274 of file solvers_krylov.c.

References NULL.

int G_math_solver_pcg ( double **  A,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err,
int  prec 
)

The iterative preconditioned conjugate gradients solver for symmetric positive definite matrices.

This iterative solver works with symmetric positive definite regular quadratic matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
A(double **) – the matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criteria
prec(int) – the preconditioner which shoudl be used 1,2 or 3
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 64 of file solvers_krylov.c.

References NULL.

int G_math_solver_sparse_bicgstab ( G_math_spvector **  Asp,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err 
)

The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices.

This iterative solver works with sparse matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
Asp(G_math_spvector **) – the sparse matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criterias
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 493 of file solvers_krylov.c.

References NULL.

int G_math_solver_sparse_cg ( G_math_spvector **  Asp,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err 
)

The iterative conjugate gradients solver for sparse symmetric positive definite matrices.

This iterative solver works with symmetric positive definite sparse matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
Asp(G_math_spvector **) – the sparse matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criterias
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 301 of file solvers_krylov.c.

References NULL.

int G_math_solver_sparse_pcg ( G_math_spvector **  Asp,
double *  x,
double *  b,
int  rows,
int  maxit,
double  err,
int  prec 
)

The iterative preconditioned conjugate gradients solver for sparse symmetric positive definite matrices.

This iterative solver works with symmetric positive definite sparse matrices.

This solver solves the linear equation system: A x = b

The parameter maxit specifies the maximum number of iterations. If the maximum is reached, the solver will abort the calculation and writes the current result into the vector x. The parameter err defines the error break criteria for the solver.

Parameters
Asp(G_math_spvector **) – the sparse matrix
x(double *) – the value vector
b(double *) – the right hand side
rows(int)
maxit(int) – the maximum number of iterations
err(double) – defines the error break criteria
prec(int) – the preconditioner which shoudl be used 1,2 or 3
Returns
(int) – 1 - success, 2 - not finisehd but success, 0 - matrix singular, -1 - could not solve the les

Definition at line 93 of file solvers_krylov.c.

References NULL.