RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
moore_penrose_pseudo_inverse.c File Reference

Moore–Penrose algorithm to compute the pseudo-inverse of a rectangular matrix. More...

#include <stdbool.h>
#include <stdio.h>
#include "moore_penrose_pseudo_inverse.h"
#include "matrix.h"
#include "svd.h"

Go to the source code of this file.

Functions

int8_t moore_penrose_get_pinv (uint8_t m, uint8_t n, matrix_t A[m][n], matrix_t pinv_A[n][m])
 Calculate the Moore–Penrose inverse of a rectangular matrix. More...
 
void moore_penrose_pinv_compute_print (uint8_t m, uint8_t n, matrix_t matrix[m][n], uint8_t i)
 Compute and print the Moore–Penrose inverse of a matrix. More...
 

Detailed Description

Moore–Penrose algorithm to compute the pseudo-inverse of a rectangular matrix.

The computation of the pseudo-inverse is based on the Singular Value Decomposition (SVD).

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

Definition in file moore_penrose_pseudo_inverse.c.

Function Documentation

◆ moore_penrose_get_pinv()

int8_t moore_penrose_get_pinv ( uint8_t  m,
uint8_t  n,
matrix_t  A[m][n],
matrix_t  pinv_A[n][m] 
)

Calculate the Moore–Penrose inverse of a rectangular matrix.

The computation of the Moore–Penrose inverse is based on the Golub–Kahan–Reinsch SVD algorithm.

Parameters
[in]mrow number of the matrix to inverse.
[in]ncolumn number of the matrix to inverse.
[in]A[][]pointer to the matrix A.
[out]pinv_A[][]pointer to the pseudo-inverse matrix.
Returns
1, if the computation of the Moore-Penrose inverse is successful.
-1, if the maximal, allowed column or row number is exceeded.
-2, if the matrix is underdetermined (m<n).
-3, if the rank of the matrix is equal to 0.

Definition at line 38 of file moore_penrose_pseudo_inverse.c.

References matrix_dim_t::col_num, matrix_t, matrix_transpose(), matrix_dim_t::row_num, svd_get_single_values_num(), and svd_get_U_dim().

Referenced by get_delta_x(), get_PDOP(), loc_gauss_newton(), modified_gauss_newton(), moore_penrose_pinv_compute_print(), newton_raphson(), solve(), trilateration2(), and trilateration_get_particular_solution().

◆ moore_penrose_pinv_compute_print()

void moore_penrose_pinv_compute_print ( uint8_t  m,
uint8_t  n,
matrix_t  matrix[m][n],
uint8_t  i 
)

Compute and print the Moore–Penrose inverse of a matrix.

Parameters
[in]mrow number of the matrix.
[in]ncolumn number of the matrix.
[in]matrix[][]pointer to the matrix.
[in]ilabel.

Definition at line 167 of file moore_penrose_pseudo_inverse.c.

References matrix_flex_print(), matrix_t, and moore_penrose_get_pinv().

Referenced by moore_penrose_pinv_test().