1 /******************************************************************************
2  * @file     basic_math_functions_f16.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 BASIC_MATH_FUNCTIONS_F16_H_
28 #define BASIC_MATH_FUNCTIONS_F16_H_
29 
30 #include "arm_math_types_f16.h"
31 #include "arm_math_memory.h"
32 
33 #include "dsp/none.h"
34 #include "dsp/utils.h"
35 
36 #ifdef   __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 #if defined(ARM_FLOAT16_SUPPORTED)
42 
43 
44   /**
45    * @brief Floating-point vector addition.
46    * @param[in]  pSrcA      points to the first input vector
47    * @param[in]  pSrcB      points to the second input vector
48    * @param[out] pDst       points to the output vector
49    * @param[in]  blockSize  number of samples in each vector
50    */
51   void arm_add_f16(
52   const float16_t * pSrcA,
53   const float16_t * pSrcB,
54         float16_t * pDst,
55         uint32_t blockSize);
56 
57   /**
58    * @brief Floating-point vector subtraction.
59    * @param[in]  pSrcA      points to the first input vector
60    * @param[in]  pSrcB      points to the second input vector
61    * @param[out] pDst       points to the output vector
62    * @param[in]  blockSize  number of samples in each vector
63    */
64   void arm_sub_f16(
65   const float16_t * pSrcA,
66   const float16_t * pSrcB,
67         float16_t * pDst,
68         uint32_t blockSize);
69 
70     /**
71    * @brief Multiplies a floating-point vector by a scalar.
72    * @param[in]  pSrc       points to the input vector
73    * @param[in]  scale      scale factor to be applied
74    * @param[out] pDst       points to the output vector
75    * @param[in]  blockSize  number of samples in the vector
76    */
77   void arm_scale_f16(
78   const float16_t * pSrc,
79         float16_t scale,
80         float16_t * pDst,
81         uint32_t blockSize);
82 
83     /**
84    * @brief Floating-point vector absolute value.
85    * @param[in]  pSrc       points to the input buffer
86    * @param[out] pDst       points to the output buffer
87    * @param[in]  blockSize  number of samples in each vector
88    */
89   void arm_abs_f16(
90   const float16_t * pSrc,
91         float16_t * pDst,
92         uint32_t blockSize);
93 
94 
95   /**
96    * @brief  Adds a constant offset to a floating-point vector.
97    * @param[in]  pSrc       points to the input vector
98    * @param[in]  offset     is the offset to be added
99    * @param[out] pDst       points to the output vector
100    * @param[in]  blockSize  number of samples in the vector
101    */
102   void arm_offset_f16(
103   const float16_t * pSrc,
104         float16_t offset,
105         float16_t * pDst,
106         uint32_t blockSize);
107 
108   /**
109    * @brief Dot product of floating-point vectors.
110    * @param[in]  pSrcA      points to the first input vector
111    * @param[in]  pSrcB      points to the second input vector
112    * @param[in]  blockSize  number of samples in each vector
113    * @param[out] result     output result returned here
114    */
115   void arm_dot_prod_f16(
116   const float16_t * pSrcA,
117   const float16_t * pSrcB,
118         uint32_t blockSize,
119         float16_t * result);
120 
121   /**
122    * @brief Floating-point vector multiplication.
123    * @param[in]  pSrcA      points to the first input vector
124    * @param[in]  pSrcB      points to the second input vector
125    * @param[out] pDst       points to the output vector
126    * @param[in]  blockSize  number of samples in each vector
127    */
128   void arm_mult_f16(
129   const float16_t * pSrcA,
130   const float16_t * pSrcB,
131         float16_t * pDst,
132         uint32_t blockSize);
133 
134   /**
135    * @brief  Negates the elements of a floating-point vector.
136    * @param[in]  pSrc       points to the input vector
137    * @param[out] pDst       points to the output vector
138    * @param[in]  blockSize  number of samples in the vector
139    */
140   void arm_negate_f16(
141   const float16_t * pSrc,
142         float16_t * pDst,
143         uint32_t blockSize);
144 
145   /**
146   @brief         Elementwise floating-point clipping
147   @param[in]     pSrc          points to input values
148   @param[out]    pDst          points to output clipped values
149   @param[in]     low           lower bound
150   @param[in]     high          higher bound
151   @param[in]     numSamples    number of samples to clip
152  */
153 void arm_clip_f16(const float16_t * pSrc,
154   float16_t * pDst,
155   float16_t low,
156   float16_t high,
157   uint32_t numSamples);
158 
159 #endif /* defined(ARM_FLOAT16_SUPPORTED)*/
160 
161 #ifdef   __cplusplus
162 }
163 #endif
164 
165 #endif /* ifndef _BASIC_MATH_FUNCTIONS_F16_H_ */
166