1 /******************************************************************************
2 * @file fast_math_functions_f16.h
3 * @brief Public header file for CMSIS DSP Library
4 * @version V1.9.0
5 * @date 23 April 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 @return none
81 */
82 void arm_vlog_f16(
83 const float16_t * pSrc,
84 float16_t * pDst,
85 uint32_t blockSize);
86
87 /**
88 @brief Floating-point vector of exp values.
89 @param[in] pSrc points to the input vector
90 @param[out] pDst points to the output vector
91 @param[in] blockSize number of samples in each vector
92 @return none
93 */
94 void arm_vexp_f16(
95 const float16_t * pSrc,
96 float16_t * pDst,
97 uint32_t blockSize);
98
99 /**
100 @brief Floating-point vector of inverse values.
101 @param[in] pSrc points to the input vector
102 @param[out] pDst points to the output vector
103 @param[in] blockSize number of samples in each vector
104 @return none
105 */
106 void arm_vinverse_f16(
107 const float16_t * pSrc,
108 float16_t * pDst,
109 uint32_t blockSize);
110
111 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* ifndef _FAST_MATH_FUNCTIONS_F16_H_ */
117