|
RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
|
Go to the documentation of this file.
33 double min_lamda,
double eps, uint8_t max_it_num,
35 void (*get_non_lin_sys)(
vector_t x_arr[],
37 void (*get_jacobian)(
vector_t x_arr[],
44 double damped_norm_prev_x;
53 while ((damped_norm_x >= eps) && (iter_num < max_it_num)) {
55 get_delta_x(f_length, n, prev_x_arr, get_non_lin_sys,
56 get_jacobian, delta_x);
62 lamda_c = 1 - lamda / 4;
65 get_non_lin_sys, get_jacobian);
70 while (damped_norm_x > (lamda_c * damped_norm_prev_x)) {
72 if (lamda >= min_lamda) {
84 get_non_lin_sys, get_jacobian);
88 if (lamda <= min_lamda) {
97 get_non_lin_sys, get_jacobian);
105 void (*get_non_lin_sys)(
vector_t x_arr[],
110 double damp_norm = 0.0;
113 get_delta_x(m, n, x_arr, get_non_lin_sys, get_jacobian, delta_x_arr);
130 get_jacobian(x_arr, J);
134 get_non_lin_sys(x_arr, f_vec);
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.
vector_t vector_get_norm2(uint8_t length, vector_t arr[])
Compute the 2-norm norm of a vector.
void matrix_mul_vec(uint8_t m, uint8_t n, matrix_t matrix[m][n], matrix_t vec[n], matrix_t dst_arr[m])
Compute the multiplication of a matrix with a column vector.
void get_delta_x(uint8_t m, uint8_t n, vector_t x_arr[], void(*get_non_lin_sys)(vector_t x_arr[], vector_t f_vec[]), void(*get_jacobian)(vector_t x_arr[], matrix_t J[][n]), vector_t delta_x_arr[])
Compute the correction vector the damped Newton–Raphson algorithm.
#define vector_t
Define the data type of the vector elements.
uint8_t damped_newton_raphson(uint8_t f_length, uint8_t n, vector_t x0_arr[], double min_lamda, double eps, uint8_t max_it_num, vector_t est_x_arr[], void(*get_non_lin_sys)(vector_t x_arr[], vector_t f_vec[]), void(*get_jacobian)(vector_t x_arr[], matrix_t J[][n]))
Implements the damped Newton–Raphson algorithm.
void vector_in_place_scalar_mul(uint8_t size, vector_t a_vec[size], vector_t scl)
Compute the product of a vector with a real number.
Implement the damped Newton–Raphson algorithm.
Moore–Penrose algorithm to compute the pseudo-inverse of a matrix.
double get_damped_norm(uint8_t m, uint8_t n, vector_t x_arr[], void(*get_non_lin_sys)(vector_t x_arr[], vector_t f_vec[]), void(*get_jacobian)(vector_t x_arr[], matrix_t J[][n]))
Compute the norm of the damped Newton–Raphson algorithm.
void vector_copy(uint8_t size, vector_t src_arr[], vector_t dest_arr[])
Copy the elements of the source vector to the destination vector.
#define matrix_t
Define the data type of the matrix elements.
void vector_add(uint8_t size, vector_t a_vec[size], vector_t b_vec[size], vector_t a_plus_b_vec[size])
Compute the addition of two vectors.
void vector_scalar_mul(uint8_t size, vector_t src_vec[size], vector_t scl, vector_t dest_vec[])
Compute the product of a vector with a real number.