| RcdMathLib_doc
    Open Source Library  for Linear and Non-linear Algebra | 
 
 
 
Go to the documentation of this file.
   34     memset(arr, 0, 
sizeof(
vector_t) * n);
 
   39     memcpy(dest_arr, src_arr, size * 
sizeof(
vector_t));
 
   47     for (; i < length; i++) {
 
   48         square_norm += arr[i] * arr[i];
 
   51     return sqrt(square_norm);
 
   59     for (; i < length; i++) {
 
   60         square_norm += arr[i] * arr[i];
 
   71     for (i = 0; i < length; i++) {
 
   83     for (i = 0; i < length; i++) {
 
   99     for (i = 0; i < size; i++) {
 
  100         a_minus_b[i] = a_vec[i] - b_vec[i];
 
  109     for (i = 0; i < size; i++) {
 
  110         a_plus_b_vec[i] = a_vec[i] + b_vec[i];
 
  119     for (i = 0; i < size; i++) {
 
  120         a_mul_b_vec[i] = a_vec[i] * b_vec[i];
 
  126     for (
int i = 0; i < n; i++) {
 
  127         square_vec[i] = vec[i] * vec[i];
 
  136     for (i = 0; i < size; i++) {
 
  137         a_vec[i] = scl * a_vec[i];
 
  146     for (i = 0; i < size; i++) {
 
  147         dest_vec[i] = scl * src_vec[i];
 
  156         for (i = 0; i < size; i++) {
 
  157             a_vec[i] = a_vec[i] / scl;
 
  181     for (uint8_t i = 1; i < length; i++) {
 
  195     for (
int i = 0; i < n; i++) {
 
  196         r = r + (vec1[i] * vec2[i]);
 
  205     for (uint16_t i = 0; i < length; i++) {
 
  206         if (vec_1[i] != vec_2[i]) {
 
  215                              vector_t sorted_vector[n], uint8_t index_vector[n])
 
  218     for (
int i = 0; i < k; i++) {
 
  219         for (
int j = 0; j < n; j++) {
 
  220             if (unsorted_vector[j] == sorted_vector[i]) {
 
  238     for (uint8_t i = 0; i < k; i++) {
 
  239         dst_vec[i] = src_vec[index_vec[i]];
 
  246     for (uint32_t i = 0; i < length; i++) {
 
  247         if (vec_1[i] != vec_2[i]) {
 
  260     for (i = 0; i < length; i++) {
 
  261         printf(
"%5.4f", arr[i]);
 
  262         if (i < length - 1) {
 
  274     for (i = 0; i < length; i++) {
 
  275         printf(
"%u", arr[i]);
 
  276         if (i < length - 1) {
 
  288     char format_str_buff[13];
 
  290     sprintf(format_str_buff, 
"%%%u.%uf", before_dot, after_dot);
 
  292     for (i = 0; i < length; i++) {
 
  295         if (i < length - 1) {
 
  
 
vector_t vector_get_norm2(uint8_t length, vector_t arr[])
Compute the 2-norm norm of a vector.
vector_t vector_get_scalar_product(uint8_t n, vector_t vec1[n], vector_t vec2[n])
Compute the dot product of two vectors.
void vector_flex_print(uint32_t length, vector_t arr[], uint8_t before_dot, uint8_t after_dot)
Display the values of the vector's elements.
bool vector_is_equal(uint16_t length, vector_t vec_1[], vector_t vec_2[])
Determine the equality of two vectors.
void vector_clear(uint8_t n, vector_t arr[])
Clear all the elements of the vector.
void vector_print(uint32_t length, vector_t arr[])
Display the values of the vector's elements.
void vector_get_index_vector(uint8_t k, uint8_t n, vector_t unsorted_vector[n], vector_t sorted_vector[n], uint8_t index_vector[n])
Determine the index of the vector elements before sorting.
vector_t vector_get_square_norm2(uint8_t length, vector_t arr[])
Compute the squared 2-norm norm of a vector .
#define vector_t
Define the data type of the vector elements.
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.
Utilities for linear algebra.
void vector_sub(uint8_t size, vector_t a_vec[], vector_t b_vec[], vector_t a_minus_b[])
Compute the subtraction of two vectors.
vector_t vector_get_max_and_index(uint8_t length, vector_t vec[], uint8_t *index)
Compute the maximal value and its index of a vector.
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.
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.
void vector_get_elements(vector_t src_vec[], uint8_t k, uint8_t index_vec[], vector_t dst_vec[])
Get the elements of the vector by an index vector.
void utils_printf(char *format_str,...)
Print by using variable format string as well as argument lists.
void vector_scalar_div(uint8_t size, vector_t a_vec[size], vector_t scl)
Compute the division of a vector with a real number.
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.
vector_t vector_get_residual(uint8_t length, vector_t a_vec[], vector_t b_vec[])
Compute the residual of two vectors.
vector_t vector_get_mean_value(uint8_t length, vector_t arr[])
Compute the average or mean value of a vector.
void vector_print_u8_array(uint32_t length, uint8_t arr[])
Display the values of the vector's elements of type uint8_t.
void vector_mul(uint8_t size, vector_t a_vec[size], vector_t b_vec[size], vector_t a_mul_b_vec[size])
Compute the multiplication of two vectors.
void vector_square(uint8_t n, vector_t vec[n], vector_t square_vec[n])
Compute the square of a vector.
vector_t vector_get_sum(uint8_t length, vector_t arr[])
Compute the sum of the elements of a vector.
bool vector_uint32_is_equal(uint32_t length, uint32_t vec_1[], uint32_t vec_2[])
Determine the equality of two vectors of type uint32_t.
vector_t vector_get_euclidean_distance(uint8_t length, vector_t vec1[], vector_t vec2[])
Compute the Euclidean distance between two vectors.