grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

solvers_direct.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_direct.c:

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 bandwidth, 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 bandwidth)
 cholesky decomposition for symmetric, positiv definite matrices with bandwidth optimization More...
 
void G_math_backward_substitution (double **A, double *x, double *b, int rows)
 backward substitution More...
 
void G_math_forward_substitution (double **A, double *x, double *b, int rows)
 forward substitution More...
 

Macro Definition Documentation

◆ COMP_PIVOT

#define COMP_PIVOT   100

Definition at line 28 of file solvers_direct.c.

◆ TINY

#define TINY   1.0e-20

MODULE: Grass numerical math interface AUTHOR(S): Soeren Gebbert, Berlin (GER) Dec 2006 soerengebbert <at> googlemail <dot> com

PURPOSE: linear equation system solvers part of the gmath library

COPYRIGHT: (C) 2010 by the GRASS Development Team

          This program is free software under the GNU General Public
          License (>=v2). Read the file COPYING that comes with GRASS
          for details.

Definition at line 27 of file solvers_direct.c.

Function Documentation

◆ G_math_backward_substitution()

void G_math_backward_substitution ( double **  A,
double *  x,
double *  b,
int  rows 
)

backward substitution

Parameters
Adouble **
xdouble *
bdouble *
rowsint
Returns
void

Definition at line 289 of file solvers_direct.c.

References A, b, and x.

Referenced by G_math_solver_cholesky(), G_math_solver_gauss(), and G_math_solver_lu().

◆ G_math_cholesky_decomposition()

int G_math_cholesky_decomposition ( double **  A,
int  rows,
int  bandwidth 
)

cholesky decomposition for symmetric, positiv definite matrices with bandwidth optimization

The provided matrix will be overwritten with the lower and upper triangle matrix A = LL^T

Parameters
Adouble **
rowsint
bandwidthint – the bandwidth of the matrix (0 > bandwidth <= cols)
Returns
void

Definition at line 220 of file solvers_direct.c.

References A, and G_warning().

Referenced by G_math_solver_cholesky().

◆ G_math_forward_substitution()

void G_math_forward_substitution ( double **  A,
double *  x,
double *  b,
int  rows 
)

forward substitution

Parameters
Adouble **
xdouble *
bdouble *
rowsint
Returns
void

Definition at line 313 of file solvers_direct.c.

References A, b, and x.

Referenced by G_math_solver_cholesky(), and G_math_solver_lu().

◆ G_math_gauss_elimination()

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

Parameters
Adouble **
bdouble *
rowsint
Returns
void

Definition at line 156 of file solvers_direct.c.

References A, and b.

Referenced by G_math_solver_gauss().

◆ G_math_lu_decomposition()

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

Parameters
Adouble **
bdouble * – this vector is needed if its part of the linear equation system, otherwise set it to NULL
rowsint
Returns
void

Definition at line 189 of file solvers_direct.c.

References A.

Referenced by G_math_solver_lu().

◆ G_math_solver_cholesky()

int G_math_solver_cholesky ( double **  A,
double *  x,
double *  b,
int  bandwidth,
int  rows 
)

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

Parameters
Adouble **
xdouble *
bdouble *
bandwidthint – the bandwidth of the band matrix, if unsure set to rows
rowsint
Returns
int – 1 success

Definition at line 127 of file solvers_direct.c.

References _, A, b, G_math_backward_substitution(), G_math_cholesky_decomposition(), G_math_forward_substitution(), G_message(), G_warning(), and x.

◆ G_math_solver_gauss()

int G_math_solver_gauss ( double **  A,
double *  x,
double *  b,
int  rows 
)

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

Parameters
Adouble **
xdouble *
bdouble *
rowsint
Returns
int – 1 success

Definition at line 43 of file solvers_direct.c.

References _, A, b, G_math_backward_substitution(), G_math_gauss_elimination(), G_message(), and x.

◆ G_math_solver_lu()

int G_math_solver_lu ( double **  A,
double *  x,
double *  b,
int  rows 
)

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

Parameters
Adouble **
xdouble *
bdouble *
rowsint
Returns
int – 1 success

Definition at line 67 of file solvers_direct.c.

References _, A, b, c, G_alloc_vector(), G_free(), G_math_backward_substitution(), G_math_forward_substitution(), G_math_lu_decomposition(), G_message(), and x.