RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
solve.h File Reference

Enables to solve systems of linear equations Ax = b for x. More...

#include "matrix.h"
#include "pseudo_inverse.h"

Go to the source code of this file.

Functions

int8_t solve (uint8_t m, uint8_t n, matrix_t A[][n], matrix_t b[m], matrix_t x_sol[n], enum ALGORITHM algo)
 Solve an (m $\times$ n) linear system Ax = b by using the Moore–Penrose, Householder, or the Givens algorithm. More...
 
int8_t solve_householder (uint8_t m, uint8_t n, matrix_t A[][n], matrix_t b[m], matrix_t x_sol[n])
 Solve an (m $\times$ n) linear system Ax = b, using the Householder algorithm. More...
 
int8_t solve_givens (uint8_t m, uint8_t n, matrix_t A[][n], matrix_t b[m], matrix_t x_sol[n])
 Solve an (m $\times$ n) linear system Ax = b, using the Givens algorithm. More...
 
int8_t solve_lu_decomp (uint8_t m, uint8_t n, matrix_t A[][n], matrix_t b[m], matrix_t x_sol[n])
 Solve an (m $\times$ n) linear system Ax = b, using the Gaussian Elimination with pivoting algorithm. More...
 

Detailed Description

Enables to solve systems of linear equations Ax = b for x.

The user can select various algorithm such as the Moore–Penrose inverse, the Givens or the Householder algorithm for the QR-decomposition. The user can also choose the Gaussian Elimination with pivoting algorithm to solve the systems of linear equations.

Author
Zakaria Kasmi zkasm.nosp@m.i@in.nosp@m.f.fu-.nosp@m.berl.nosp@m.in.de

Definition in file solve.h.

Function Documentation

◆ solve()

int8_t solve ( uint8_t  m,
uint8_t  n,
matrix_t  A[][n],
matrix_t  b[m],
matrix_t  x_sol[n],
enum ALGORITHM  algo 
)

Solve an (m $\times$ n) linear system Ax = b by using the Moore–Penrose, Householder, or the Givens algorithm.

Parameters
[in]mrow number of the matrix A.
[in]ncolumn number of the matrix A.
[in]A[][]pointer to the matrix A.
[in]b[]pointer to the vector b.
[out]x_sol[]pointer to the solution vector.
[in]algospecifies the algorithm to use (e.g. the Householder method).
Returns
1, if solving the linear equation system is successful.
-1, if solving the linear equation system is not successful.

Definition at line 35 of file solve.c.

References Gauss, Givens, Householder, matrix_mul_vec(), matrix_t, Moore_Penrose, moore_penrose_get_pinv(), solve_givens(), solve_householder(), and solve_lu_decomp().

Referenced by solve_big_matrix_test(), and solve_test().

◆ solve_givens()

int8_t solve_givens ( uint8_t  m,
uint8_t  n,
matrix_t  A[][n],
matrix_t  b[m],
matrix_t  x_sol[n] 
)

Solve an (m $\times$ n) linear system Ax = b, using the Givens algorithm.

Parameters
[in]mrow number of the matrix A.
[in]ncolumn number of the matrix A.
[in]A[][]pointer to the matrix A.
[in]b[]pointer to the vector b.
[out]x_sol[]pointer to the solution vector.
Returns
1, if solving the linear equation system is successful.
-1, if solving the linear equation system is not successful.
-1, if the linear system is not solvable.

Definition at line 102 of file solve.c.

References matrix_t, matrix_trans_mul_vec(), qr_common_backward_subst(), and qr_givens_decomp().

Referenced by solve().

◆ solve_householder()

int8_t solve_householder ( uint8_t  m,
uint8_t  n,
matrix_t  A[][n],
matrix_t  b[m],
matrix_t  x_sol[n] 
)

Solve an (m $\times$ n) linear system Ax = b, using the Householder algorithm.

Parameters
[in]mrow number of the matrix A.
[in]ncolumn number of the matrix A.
[in]A[][]pointer to the matrix A.
[in]b[]pointer to the vector b.
[out]x_sol[]pointer to the solution vector.
Returns
1, if solving the linear equation system is successful.
-1, if solving the linear equation system is not successful.

Definition at line 77 of file solve.c.

References matrix_t, matrix_trans_mul_vec(), qr_common_backward_subst(), and qr_householder_decomp().

Referenced by loc_levenberg_marquardt(), loc_levenberg_marquardt_correction(), opt_levenberg_marquardt(), opt_levenberg_marquardt_correction(), and solve().

◆ solve_lu_decomp()

int8_t solve_lu_decomp ( uint8_t  m,
uint8_t  n,
matrix_t  A[][n],
matrix_t  b[m],
matrix_t  x_sol[n] 
)

Solve an (m $\times$ n) linear system Ax = b, using the Gaussian Elimination with pivoting algorithm.

Parameters
[in]mrow number of the matrix A.
[in]ncolumn number of the matrix A.
[in]A[][]pointer to the matrix A.
[in]b[]pointer to the vector b.
[out]x_sol[]pointer to the solution vector.
Returns
1, if solving the linear equation system is successful.
-1, if solving the linear equation system is not successful.
-2, if the linear system is not solvable.

Definition at line 124 of file solve.c.

References lu_decomp(), matrix_get_inv_low_triang(), matrix_mul(), matrix_mul_vec(), matrix_t, and qr_common_backward_subst().

Referenced by solve().