|
RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
|
Go to the documentation of this file.
32 puts(
"############ Test Vector Algebra ###############");
33 vector_t a[5] = { 0.0975, 0.2785, 0.5469, 0.9575, 0.9649 };
34 vector_t b[5] = { 0.1576, 0.9706, 0.9572, 0.4854, 0.8003 };
36 vector_t d[5] = { 0.1576, 0.9706, 0.9572, 0.4854, 0.8003 };
41 printf(
"c = a + b = ");
46 printf(
"c = a - b = ");
51 printf(
"c = a * b = ");
56 printf(
"mean(a) = %.4f\n", mean);
59 printf(
"norm2(a) = %.4f\n", norm2);
62 printf(
"squ_norm2(b) = %.4f\n", squ_norm2);
65 printf(
"scal(a) = %.4f\n", scal);
68 printf(
"sum(a) = %.4f\n", sum);
71 printf(
"euc_dist(a,b) = %.4f\n", euc_dist);
74 puts(
"vectors are equal !!");
77 puts(
"vectors are not equal !!");
vector_t vector_get_norm2(uint8_t length, vector_t arr[])
Compute the 2-norm norm of a vector.
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.
vector_t vector_get_euclidean_distance(uint8_t length, vector_t vec1[], vector_t vec2[])
Compute the Euclidean distance between two vectors.
vector_t vector_get_scalar_product(uint8_t n, vector_t vec1[n], vector_t vec2[n])
Compute the dot product of two vectors.
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_clear(uint8_t size, vector_t arr[])
Clear all the elements of the vector.
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.
bool vector_is_equal(uint16_t length, vector_t vec_1[], vector_t vec_2[])
Determine the equality of two vectors.
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_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_sum(uint8_t length, vector_t arr[])
Compute the sum of the elements of a vector.
vector_t vector_get_mean_value(uint8_t length, vector_t arr[])
Compute the average or mean value of a vector.
void vector_test(void)
Examples of vector operations.
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.