1 /******************************************************************************
2  * @file     basic_math_functions.h
3  * @brief    Public header file for CMSIS DSP Library
4  * @version  V1.10.0
5  * @date     08 July 2021
6  * Target Processor: Cortex-M and Cortex-A cores
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 
27 #ifndef _DEBUG_FUNCTIONS_H_
28 #define _DEBUG_FUNCTIONS_H_
29 
30 #include "arm_math_types.h"
31 #include "arm_math_memory.h"
32 
33 #include "dsp/none.h"
34 #include "dsp/utils.h"
35 
36 #include "dsp/matrix_functions.h"
37 #include "dsp/matrix_functions_f16.h"
38 
39 #include <stdio.h>
40 
41 #ifdef   __cplusplus
42 extern "C"
43 {
44 #endif
45 
46 #if defined(ARM_FLOAT16_SUPPORTED)
47 #define PROW_f16(S,NB)            \
48 {                                 \
49     printf("{%f",(double)(S)[0]);   \
50     for(unsigned int i=1;i<(NB) ;i++)       \
51     {                             \
52        printf(",%f",(double)(S)[i]);\
53     }                             \
54     printf("}");                  \
55 };
56 
57 #define PV_f16(S,V,NB)\
58 {                     \
59     printf("%s=",(S));  \
60     PROW_f16((V),(NB));   \
61     printf(";\n");    \
62 };
63 
64 #define PM_f16(S,M)                                       \
65 {                                                         \
66     printf("%s={",(S));                                     \
67     for(unsigned int row=0;row<(M)->numRows;row++)                   \
68     {                                                     \
69         if (row != 0)                                     \
70         {                                                 \
71             printf("\n,");                                \
72         }                                                 \
73         PROW_f16((M)->pData + row * (M)->numCols, (M)->numCols);\
74     }                                                     \
75     printf("};\n");                                       \
76 }
77 
78 #endif
79 
80 #define PROW_f32(S,NB)            \
81 {                                 \
82     printf("{%f",(double)(S)[0]);   \
83     for(unsigned int i=1;i<(NB) ;i++)       \
84     {                             \
85        printf(",%f",(double)(S)[i]);\
86     }                             \
87     printf("}");                  \
88 };
89 
90 #define PV_f32(S,V,NB)\
91 {                     \
92     printf("%s=",(S));  \
93     PROW_f32((V),(NB));   \
94     printf(";\n");    \
95 };
96 
97 #define PM_f32(S,M)                                       \
98 {                                                         \
99     printf("%s={",(S));                                     \
100     for(unsigned int row=0;row<(M)->numRows;row++)                   \
101     {                                                     \
102         if (row != 0)                                     \
103         {                                                 \
104             printf("\n,");                                \
105         }                                                 \
106         PROW_f32((M)->pData + row * (M)->numCols, (M)->numCols);\
107     }                                                     \
108     printf("};\n");                                       \
109 }
110 
111 #define PROW_f64(S,NB)            \
112 {                                 \
113     printf("{%.20g",(double)(S)[0]);   \
114     for(unsigned int i=1;i<(NB) ;i++)       \
115     {                             \
116        printf(",%.20g",(double)(S)[i]);\
117     }                             \
118     printf("}");                  \
119 };
120 
121 #define PV_f64(S,V,NB) \
122 {                      \
123     printf("%s=",(S)); \
124     PROW_f64((V),(NB));\
125     printf(";\n");     \
126 };
127 
128 #define PM_f64(S,M)                                       \
129 {                                                         \
130     printf("%s={",(S));                                     \
131     for(unsigned int row=0;row<(M)->numRows;row++)                   \
132     {                                                     \
133         if (row != 0)                                     \
134         {                                                 \
135             printf("\n,");                                \
136         }                                                 \
137         PROW_f64((M)->pData + row * (M)->numCols, (M)->numCols);\
138     }                                                     \
139     printf("};\n");                                       \
140 }
141 
142 #ifdef   __cplusplus
143 }
144 #endif
145 
146 #endif /* ifndef _DEBUG_FUNCTIONS_H_ */
147