|
RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
|
Go to the documentation of this file.
31 static int32_t min(int32_t a, int32_t b);
32 static int8_t moore_penrose_pinv(uint8_t m, uint8_t n,
matrix_t A[m][n],
33 uint8_t u_m, uint8_t u_n,
matrix_t U[u_m][u_n],
51 matrix_t trans_A_pinv[trans_n][trans_m];
62 answer = moore_penrose_pinv(trans_m, trans_n, trans_A,
64 s_length, s, trans_A_pinv);
76 answer = moore_penrose_pinv(m, n, A,
101 static int8_t moore_penrose_pinv(uint8_t m, uint8_t n,
matrix_t A[m][n],
102 uint8_t u_m, uint8_t u_n,
matrix_t U[u_m][u_n],
111 uint8_t i, j, k, col_min;
116 "The maximal, allowed number of the rows and columns is %d\n",
123 puts(
"Please, give the transposed matrix");
135 puts(
"The minimum rank-value of a matrix is one");
141 col_min = min(n, u_dim.
col_num);
145 for (i = 0; i < n; i++) {
146 for (j = 0; j < u_dim.
row_num; j++) {
147 for (k = 0; k < col_min; k++) {
148 pinv_A[i][j] += V[i][k] * rec_s[k] * U[j][k];
157 static int32_t min(int32_t a, int32_t b)
173 printf(
"pinv%d = ", i);
#define MAX_ROW_NUM
The maximal row number allowed.
#define MOORE_PENROSE_INVALID_RANK_VALUE
Invalid rank value of a matrix.
void matrix_clear(uint8_t m, uint8_t n, matrix_t matrix[m][n])
Clear all the elements of the vector.
uint8_t row_num
the row number
void svd(uint8_t m, uint8_t n, matrix_t A[m][n], uint8_t u_m, uint8_t u_n, matrix_t U[u_m][u_n], matrix_t S[u_n][n], matrix_t V[n][n], uint8_t sing_vec_length, matrix_t singl_values_vec[])
Compute the Singular-Value Decomposition (SVD) of a matrix.
#define MAX_COL_NUM
The maximal column number allowed.
void matrix_transpose(uint8_t m, uint8_t n, matrix_t src_matrix[m][n], matrix_t dest_matrix[n][m])
Computes the transpose of a matrix.
#define MOORE_PENROSE_PSEUDO_GIVE_MATRIX_TRANSPOSE
The transposed matrix should be delivered.
#define MOORE_PENROSE_PSEUDO_COMP_SUCCESS
The Moore–Penrose inverse is successfully completed.
uint8_t matrix_get_rank(uint8_t m, uint8_t n, matrix_t singl_values_arr[], uint8_t length)
Compute the rank of a matrix.
void matrix_flex_print(uint8_t m, uint8_t n, matrix_t matrix[m][n], uint8_t before_dec, uint8_t after_dec)
Display the values of the matrix elements.
Moore–Penrose algorithm to compute the pseudo-inverse of a matrix.
A structure to define the row and column number of a matrix.
Algorithm for the Singular Value Decomposition (SVD).
uint8_t svd_get_single_values_num(uint8_t m, uint8_t n)
Calculate the number of the singular values.
void svd_get_reciproc_singular_values(uint8_t m, uint8_t n, uint8_t length, matrix_t singl_values_arr[], matrix_t recip_singl_values_arr[])
Compute the reciprocal singular values.
#define matrix_t
Define the data type of the matrix elements.
#define MOORE_PENROSE_PSEUDO_MAX_ALLOW_ROW_COL_EXCEEED
The maximal row number allowed is exceeded.
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.
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.
void svd_get_U_dim(uint8_t m, uint8_t n, matrix_dim_t *u_dim)
Calculate the dimension of the matrix U.
uint8_t col_num
the column number