Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | #include "jtest.h" |
2 | #include "matrix_test_data.h" |
||
3 | #include "arr_desc.h" |
||
4 | #include "arm_math.h" /* FUTs */ |
||
5 | #include "ref.h" /* Reference Functions */ |
||
6 | #include "test_templates.h" |
||
7 | #include "matrix_templates.h" |
||
8 | #include "type_abbrev.h" |
||
9 | |||
10 | /* This is for the two fixed point cases */ |
||
11 | #define JTEST_ARM_MAT_SCALE_TEST(suffix,type) \ |
||
12 | JTEST_DEFINE_TEST(arm_mat_scale_##suffix##_test, arm_mat_scale_##suffix) \ |
||
13 | { \ |
||
14 | uint32_t i,j; \ |
||
15 | \ |
||
16 | TEMPLATE_DO_ARR_DESC( \ |
||
17 | mat_idx, arm_matrix_instance_##suffix *, \ |
||
18 | mat_ptr, matrix_##suffix##_b_inputs \ |
||
19 | , \ |
||
20 | MATRIX_TEST_CONFIG_SAMESIZE_OUTPUT( \ |
||
21 | arm_matrix_instance_##suffix *, mat_ptr); \ |
||
22 | \ |
||
23 | for(i=0;i<MATRIX_MAX_COEFFS_LEN;i++) \ |
||
24 | { \ |
||
25 | for(j=0;j<MATRIX_MAX_SHIFTS_LEN;j++) \ |
||
26 | { \ |
||
27 | JTEST_DUMP_STRF("Matrix Dimensions: %dx%d\n", \ |
||
28 | (int)mat_ptr->numRows, \ |
||
29 | (int)mat_ptr->numCols); \ |
||
30 | \ |
||
31 | JTEST_COUNT_CYCLES( \ |
||
32 | arm_mat_scale_##suffix(mat_ptr, \ |
||
33 | matrix_##suffix##_scale_values[i], \ |
||
34 | matrix_shift_values[j], \ |
||
35 | (arm_matrix_instance_##suffix*) &matrix_output_fut)); \ |
||
36 | \ |
||
37 | ref_mat_scale_##suffix(mat_ptr, \ |
||
38 | matrix_##suffix##_scale_values[i], \ |
||
39 | matrix_shift_values[j], \ |
||
40 | (arm_matrix_instance_##suffix*) &matrix_output_ref); \ |
||
41 | \ |
||
42 | MATRIX_SNR_COMPARE_INTERFACE(arm_matrix_instance_##suffix, \ |
||
43 | type); \ |
||
44 | } \ |
||
45 | }); \ |
||
46 | \ |
||
47 | return JTEST_TEST_PASSED; \ |
||
48 | } |
||
49 | |||
50 | JTEST_DEFINE_TEST(arm_mat_scale_f32_test, arm_mat_scale_f32) |
||
51 | { |
||
52 | uint32_t i; |
||
53 | |||
54 | TEMPLATE_DO_ARR_DESC( |
||
55 | mat_idx, arm_matrix_instance_f32 *, mat_ptr, matrix_f32_b_inputs |
||
56 | , |
||
57 | MATRIX_TEST_CONFIG_SAMESIZE_OUTPUT(arm_matrix_instance_f32 *, mat_ptr); |
||
58 | |||
59 | for(i=0;i<MATRIX_MAX_COEFFS_LEN;i++) |
||
60 | { |
||
61 | JTEST_DUMP_STRF("Matrix Dimensions: %dx%d\n", |
||
62 | (int)mat_ptr->numRows, |
||
63 | (int)mat_ptr->numCols); |
||
64 | JTEST_COUNT_CYCLES(arm_mat_scale_f32(mat_ptr, matrix_f32_scale_values[i], &matrix_output_fut)); |
||
65 | |||
66 | ref_mat_scale_f32(mat_ptr, matrix_f32_scale_values[i], &matrix_output_ref); |
||
67 | |||
68 | MATRIX_SNR_COMPARE_INTERFACE(arm_matrix_instance_f32, |
||
69 | float32_t); |
||
70 | }); |
||
71 | |||
72 | return JTEST_TEST_PASSED; |
||
73 | } |
||
74 | |||
75 | JTEST_ARM_MAT_SCALE_TEST(q31,q31_t); |
||
76 | JTEST_ARM_MAT_SCALE_TEST(q15,q15_t); |
||
77 | |||
78 | /*--------------------------------------------------------------------------------*/ |
||
79 | /* Collect all tests in a group. */ |
||
80 | /*--------------------------------------------------------------------------------*/ |
||
81 | |||
82 | JTEST_DEFINE_GROUP(mat_scale_tests) |
||
83 | { |
||
84 | /* |
||
85 | To skip a test, comment it out. |
||
86 | */ |
||
87 | JTEST_TEST_CALL(arm_mat_scale_f32_test); |
||
88 | JTEST_TEST_CALL(arm_mat_scale_q31_test); |
||
89 | JTEST_TEST_CALL(arm_mat_scale_q15_test); |
||
90 | } |