set_matrix_zero#

Sets all elements of the matrix to zero.

void uz_matrix_set_zero(uz_matrix_t *const A)#

Set all elements of the matrix A to zero.

Parameters:
  • A – Matrix object, has to be ready.

Example#

 1#ifdef TEST
 2
 3#include "unity.h"
 4#include "test_assert_with_exception.h"
 5#include "uz_matrix.h"
 6#include "uz_matrix_init_helper.h"
 7
 8void setUp(void)
 9{
10}
11
12void tearDown(void)
13{
14}
15
16void test_uz_matrix_set_matrix_to_zero(void){
17    uint32_t rows=2;
18    uint32_t columns=2;
19    float A_data[4]={1,2,3,4};
20    uz_matrix_t* A=init_array_test_helper(A_data,UZ_MATRIX_SIZE(A_data),rows, columns );
21    uz_matrix_set_zero(A);
22    TEST_ASSERT_EQUAL_FLOAT(0,uz_matrix_get_element_zero_based(A,0,0));
23    TEST_ASSERT_EQUAL_FLOAT(0,uz_matrix_get_element_zero_based(A,0,1));
24    TEST_ASSERT_EQUAL_FLOAT(0,uz_matrix_get_element_zero_based(A,1,0));
25    TEST_ASSERT_EQUAL_FLOAT(0,uz_matrix_get_element_zero_based(A,0,1));
26
27}
28
29#endif // TEST