RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
svd.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
3  * 2020 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
28 #ifndef SVD_H_
29 #define SVD_H_
30 
31 #include "matrix.h"
32 
33 /* Define the cases of the Golub-Reinsch Algorithm */
34 
38 #define SVD_COMPUTE_NEGLIGIBLE_VALUES 1
39 
43 #define SVD_SPLIT_AT_NEGLIGIBLE_VALUES 2
44 
48 #define SVD_QR_STEP 3
49 
53 #define SVD_ORDER_ABSOLUTE_SING_VALUES 4
54 
74 void svd(uint8_t m, uint8_t n, matrix_t A[m][n],
75  uint8_t u_m, uint8_t u_n, matrix_t U[u_m][u_n],
76  matrix_t S[u_n][n], matrix_t V[n][n],
77  uint8_t sing_vec_length, matrix_t singl_values_vec[]);
78 
87 void svd_get_U_dim(uint8_t m, uint8_t n, matrix_dim_t *u_dim);
88 
97 void svd_get_S_dim(uint8_t m, uint8_t n, matrix_dim_t *s_dim);
98 
107 void svd_get_V_dim(uint8_t m, uint8_t n, matrix_dim_t *v_dim);
108 
118 uint8_t svd_get_single_values_num(uint8_t m, uint8_t n);
119 
133 void svd_get_reciproc_singular_values(uint8_t m, uint8_t n, uint8_t length,
134  matrix_t singl_values_arr[],
135  matrix_t recip_singl_values_arr[]
136  );
147 void svd_compute_print_U_S_V_s(uint8_t m, uint8_t n, matrix_t matrix_arr[m][n],
148  uint8_t i);
149 
150 #endif /* SVD_H_ */
svd_get_V_dim
void svd_get_V_dim(uint8_t m, uint8_t n, matrix_dim_t *v_dim)
Calculate the dimension of the matrix V.
Definition: svd.c:108
svd
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.
Definition: svd.c:119
svd_get_S_dim
void svd_get_S_dim(uint8_t m, uint8_t n, matrix_dim_t *s_dim)
Calculate the dimension of the matrix S.
Definition: svd.c:102
matrix.h
Matrix computations.
svd_compute_print_U_S_V_s
void svd_compute_print_U_S_V_s(uint8_t m, uint8_t n, matrix_t matrix_arr[m][n], uint8_t i)
Compute and print the SVD of a matrix.
Definition: svd.c:766
matrix_dim_t
A structure to define the row and column number of a matrix.
Definition: matrix.h:60
svd_get_single_values_num
uint8_t svd_get_single_values_num(uint8_t m, uint8_t n)
Calculate the number of the singular values.
Definition: svd.c:114
svd_get_reciproc_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.
Definition: svd.c:747
matrix_t
#define matrix_t
Define the data type of the matrix elements.
Definition: matrix.h:38
svd_get_U_dim
void svd_get_U_dim(uint8_t m, uint8_t n, matrix_dim_t *u_dim)
Calculate the dimension of the matrix U.
Definition: svd.c:96