1 /******************************************************************************
2 * @file fast_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 _FAST_MATH_FUNCTIONS_F16_H_
28 #define _FAST_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 /* For sqrt_f32 */
37 #include "dsp/fast_math_functions.h"
38
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43
44 #if defined(ARM_FLOAT16_SUPPORTED)
45
46 /**
47 * @addtogroup SQRT
48 * @{
49 */
50
51 /**
52 @brief Floating-point square root function.
53 @param[in] in input value
54 @param[out] pOut square root of input value
55 @return execution status
56 - \ref ARM_MATH_SUCCESS : input value is positive
57 - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
58 */
arm_sqrt_f16(float16_t in,float16_t * pOut)59 __STATIC_FORCEINLINE arm_status arm_sqrt_f16(
60 float16_t in,
61 float16_t * pOut)
62 {
63 float32_t r;
64 arm_status status;
65 status=arm_sqrt_f32((float32_t)in,&r);
66 *pOut=(float16_t)r;
67 return(status);
68 }
69
70
71 /**
72 @} end of SQRT group
73 */
74
75 /**
76 @brief Floating-point vector of log values.
77 @param[in] pSrc points to the input vector
78 @param[out] pDst points to the output vector
79 @param[in] blockSize number of samples in each vector
80 */
81 void arm_vlog_f16(
82 const float16_t * pSrc,
83 float16_t * pDst,
84 uint32_t blockSize);
85
86 /**
87 @brief Floating-point vector of exp values.
88 @param[in] pSrc points to the input vector
89 @param[out] pDst points to the output vector
90 @param[in] blockSize number of samples in each vector
91 */
92 void arm_vexp_f16(
93 const float16_t * pSrc,
94 float16_t * pDst,
95 uint32_t blockSize);
96
97 /**
98 @brief Floating-point vector of inverse values.
99 @param[in] pSrc points to the input vector
100 @param[out] pDst points to the output vector
101 @param[in] blockSize number of samples in each vector
102 */
103 void arm_vinverse_f16(
104 const float16_t * pSrc,
105 float16_t * pDst,
106 uint32_t blockSize);
107
108 /**
109 @brief Arc tangent in radian of y/x using sign of x and y to determine right quadrant.
110 @param[in] y y coordinate
111 @param[in] x x coordinate
112 @param[out] result Result
113 @return error status.
114 */
115 arm_status arm_atan2_f16(float16_t y,float16_t x,float16_t *result);
116
117 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif /* ifndef _FAST_MATH_FUNCTIONS_F16_H_ */
123