GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "grass/gis.h"
#include "grass/glocale.h"
#include "grass/gmath.h"
Go to the source code of this file.
Macros | |
#define | TINY 1.0e-20 |
#define | COMP_PIVOT 100 |
Functions | |
int | G_math_solver_gauss (double **A, double *x, double *b, int rows) |
The gauss elimination solver for quardatic matrices. More... | |
int | G_math_solver_lu (double **A, double *x, double *b, int rows) |
The LU solver for quardatic matrices. More... | |
int | G_math_solver_cholesky (double **A, double *x, double *b, int bandwith, int rows) |
The choleksy decomposition solver for quardatic, symmetric positiv definite matrices. More... | |
void | G_math_gauss_elimination (double **A, double *b, int rows) |
Gauss elimination. More... | |
void | G_math_lu_decomposition (double **A, double *b, int rows) |
lu decomposition More... | |
int | G_math_cholesky_decomposition (double **A, int rows, int bandwith) |
cholesky decomposition for symmetric, positiv definite matrices with bandwith optimization More... | |
void | G_math_backward_solving (double **A, double *x, double *b, int rows) |
backward solving More... | |
void | G_math_forward_solving (double **A, double *x, double *b, int rows) |
forward solving More... | |
int | G_math_pivot_create (double **A, double *b, int rows, int start) |
Optimize the structure of the linear equation system with a common pivoting strategy. More... | |
#define COMP_PIVOT 100 |
Definition at line 28 of file solvers_direct.c.
#define TINY 1.0e-20 |
Definition at line 27 of file solvers_direct.c.
Referenced by G_math_pivot_create().
void G_math_backward_solving | ( | double ** | A, |
double * | x, | ||
double * | b, | ||
int | rows | ||
) |
backward solving
A | double ** |
x | double * |
b | double * |
rows | int |
Definition at line 296 of file solvers_direct.c.
Referenced by G_math_solver_cholesky(), G_math_solver_gauss(), and G_math_solver_lu().
cholesky decomposition for symmetric, positiv definite matrices with bandwith optimization
The provided matrix will be overwritten with the lower and upper triangle matrix A = LL^T
A | double ** |
rows | int |
bandwith | int – the bandwith of the matrix (0 > bandwith <= cols) |
Definition at line 227 of file solvers_direct.c.
References G_warning().
Referenced by G_math_solver_cholesky().
void G_math_forward_solving | ( | double ** | A, |
double * | x, | ||
double * | b, | ||
int | rows | ||
) |
forward solving
A | double ** |
x | double * |
b | double * |
rows | int |
Definition at line 320 of file solvers_direct.c.
Referenced by G_math_solver_cholesky(), and G_math_solver_lu().
void G_math_gauss_elimination | ( | double ** | A, |
double * | b, | ||
int | rows | ||
) |
Gauss elimination.
To run this solver efficiently, no pivoting is supported. The matrix will be overwritten with the decomposite form
A | double ** |
b | double * |
rows | int |
Definition at line 155 of file solvers_direct.c.
Referenced by G_math_solver_gauss().
void G_math_lu_decomposition | ( | double ** | A, |
double * | b, | ||
int | rows | ||
) |
lu decomposition
To run this solver efficiently, no pivoting is supported. The matrix will be overwritten with the decomposite form
A | double ** |
b | double * – this vector is needed if its part of the linear equation system, otherwise set it to NULL |
rows | int |
Definition at line 192 of file solvers_direct.c.
Referenced by G_math_solver_lu().
Optimize the structure of the linear equation system with a common pivoting strategy.
Create a optimized linear equation system for direct solvers: gauss and lu decomposition.
The rows are permuted based on the pivot elements.
This algorithm will modify the provided linear equation system and should only be used with the gauss elimination and lu decomposition solver.
A | double ** - a quadratic matrix |
b | double * - the right hand vector, if not available set it to NULL |
rows | int |
start | int – the row |
Definition at line 357 of file solvers_direct.c.
References G_alloc_vector(), G_debug(), G_free_vector(), G_math_d_copy(), G_warning(), max, NULL, num, dialogs::s, and TINY.
The choleksy decomposition solver for quardatic, symmetric positiv definite matrices.
This solver does not support sparse matrices The matrix A will be overwritten. The result is written to the vector x
A | double ** |
x | double * |
b | double * rows int |
Definition at line 126 of file solvers_direct.c.
References G_math_backward_solving(), G_math_cholesky_decomposition(), G_math_forward_solving(), G_message(), and G_warning().
The gauss elimination solver for quardatic matrices.
This solver does not support sparse matrices The matrix A will be overwritten. The result is written to the vector x
A | double ** |
x | double * |
b | double * rows int |
Definition at line 43 of file solvers_direct.c.
References G_math_backward_solving(), G_math_gauss_elimination(), and G_message().
The LU solver for quardatic matrices.
This solver does not support sparse matrices The matrix A will be overwritten. The result is written to the vector x in the G_math_les structure
A | double ** |
x | double * |
b | double * rows int |
Definition at line 67 of file solvers_direct.c.
References G_alloc_vector(), G_free(), G_math_backward_solving(), G_math_forward_solving(), G_math_lu_decomposition(), and G_message().