1 /****************************************************************************** 2 * @file statistics_functions_f16.h 3 * @brief Public header file for CMSIS DSP Library 4 * @version V1.10.1 5 * @date 14 July 2022 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 _STATISTICS_FUNCTIONS_F16_H_ 28 #define _STATISTICS_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 #include "dsp/basic_math_functions_f16.h" 37 #include "dsp/fast_math_functions_f16.h" 38 39 #ifdef __cplusplus 40 extern "C" 41 { 42 #endif 43 44 #if defined(ARM_FLOAT16_SUPPORTED) 45 46 /** 47 * @brief Sum of the squares of the elements of a floating-point vector. 48 * @param[in] pSrc is input pointer 49 * @param[in] blockSize is the number of samples to process 50 * @param[out] pResult is output value. 51 */ 52 void arm_power_f16( 53 const float16_t * pSrc, 54 uint32_t blockSize, 55 float16_t * pResult); 56 57 /** 58 * @brief Mean value of a floating-point vector. 59 * @param[in] pSrc is input pointer 60 * @param[in] blockSize is the number of samples to process 61 * @param[out] pResult is output value. 62 */ 63 void arm_mean_f16( 64 const float16_t * pSrc, 65 uint32_t blockSize, 66 float16_t * pResult); 67 68 /** 69 * @brief Variance of the elements of a floating-point vector. 70 * @param[in] pSrc is input pointer 71 * @param[in] blockSize is the number of samples to process 72 * @param[out] pResult is output value. 73 */ 74 void arm_var_f16( 75 const float16_t * pSrc, 76 uint32_t blockSize, 77 float16_t * pResult); 78 79 /** 80 * @brief Root Mean Square of the elements of a floating-point vector. 81 * @param[in] pSrc is input pointer 82 * @param[in] blockSize is the number of samples to process 83 * @param[out] pResult is output value. 84 */ 85 void arm_rms_f16( 86 const float16_t * pSrc, 87 uint32_t blockSize, 88 float16_t * pResult); 89 90 /** 91 * @brief Standard deviation of the elements of a floating-point vector. 92 * @param[in] pSrc is input pointer 93 * @param[in] blockSize is the number of samples to process 94 * @param[out] pResult is output value. 95 */ 96 void arm_std_f16( 97 const float16_t * pSrc, 98 uint32_t blockSize, 99 float16_t * pResult); 100 101 /** 102 * @brief Minimum value of a floating-point vector. 103 * @param[in] pSrc is input pointer 104 * @param[in] blockSize is the number of samples to process 105 * @param[out] pResult is output pointer 106 * @param[out] pIndex is the array index of the minimum value in the input buffer. 107 */ 108 void arm_min_f16( 109 const float16_t * pSrc, 110 uint32_t blockSize, 111 float16_t * pResult, 112 uint32_t * pIndex); 113 114 /** 115 * @brief Minimum value of absolute values of a floating-point vector. 116 * @param[in] pSrc is input pointer 117 * @param[in] blockSize is the number of samples to process 118 * @param[out] pResult is output pointer 119 * @param[out] pIndex is the array index of the minimum value in the input buffer. 120 */ 121 void arm_absmin_f16( 122 const float16_t * pSrc, 123 uint32_t blockSize, 124 float16_t * pResult, 125 uint32_t * pIndex); 126 127 /** 128 * @brief Maximum value of a floating-point vector. 129 * @param[in] pSrc points to the input buffer 130 * @param[in] blockSize length of the input vector 131 * @param[out] pResult maximum value returned here 132 * @param[out] pIndex index of maximum value returned here 133 */ 134 void arm_max_f16( 135 const float16_t * pSrc, 136 uint32_t blockSize, 137 float16_t * pResult, 138 uint32_t * pIndex); 139 140 /** 141 * @brief Maximum value of absolute values of a floating-point vector. 142 * @param[in] pSrc points to the input buffer 143 * @param[in] blockSize length of the input vector 144 * @param[out] pResult maximum value returned here 145 * @param[out] pIndex index of maximum value returned here 146 */ 147 void arm_absmax_f16( 148 const float16_t * pSrc, 149 uint32_t blockSize, 150 float16_t * pResult, 151 uint32_t * pIndex); 152 153 /** 154 * @brief Minimum value of absolute values of a floating-point vector. 155 * @param[in] pSrc is input pointer 156 * @param[in] blockSize is the number of samples to process 157 * @param[out] pResult is output pointer 158 */ 159 void arm_absmin_no_idx_f16( 160 const float16_t * pSrc, 161 uint32_t blockSize, 162 float16_t * pResult); 163 164 /** 165 * @brief Maximum value of a floating-point vector. 166 * @param[in] pSrc points to the input buffer 167 * @param[in] blockSize length of the input vector 168 * @param[out] pResult maximum value returned here 169 */ 170 void arm_absmax_no_idx_f16( 171 const float16_t * pSrc, 172 uint32_t blockSize, 173 float16_t * pResult); 174 175 176 /** 177 * @brief Entropy 178 * 179 * @param[in] pSrcA Array of input values. 180 * @param[in] blockSize Number of samples in the input array. 181 * @return Entropy -Sum(p ln p) 182 * 183 */ 184 185 186 float16_t arm_entropy_f16(const float16_t * pSrcA,uint32_t blockSize); 187 188 float16_t arm_logsumexp_f16(const float16_t *in, uint32_t blockSize); 189 190 /** 191 * @brief Dot product with log arithmetic 192 * 193 * Vectors are containing the log of the samples 194 * 195 * @param[in] pSrcA points to the first input vector 196 * @param[in] pSrcB points to the second input vector 197 * @param[in] blockSize number of samples in each vector 198 * @param[in] pTmpBuffer temporary buffer of length blockSize 199 * @return The log of the dot product . 200 * 201 */ 202 203 204 float16_t arm_logsumexp_dot_prod_f16(const float16_t * pSrcA, 205 const float16_t * pSrcB, 206 uint32_t blockSize, 207 float16_t *pTmpBuffer); 208 209 /** 210 * @brief Kullback-Leibler 211 * 212 * @param[in] pSrcA Pointer to an array of input values for probability distribution A. 213 * @param[in] pSrcB Pointer to an array of input values for probability distribution B. 214 * @param[in] blockSize Number of samples in the input array. 215 * @return Kullback-Leibler Divergence D(A || B) 216 * 217 */ 218 float16_t arm_kullback_leibler_f16(const float16_t * pSrcA 219 ,const float16_t * pSrcB 220 ,uint32_t blockSize); 221 222 /** 223 @brief Maximum value of a floating-point vector. 224 @param[in] pSrc points to the input vector 225 @param[in] blockSize number of samples in input vector 226 @param[out] pResult maximum value returned here 227 @return none 228 */ 229 void arm_max_no_idx_f16( 230 const float16_t *pSrc, 231 uint32_t blockSize, 232 float16_t *pResult); 233 234 /** 235 @brief Minimum value of a floating-point vector. 236 @param[in] pSrc points to the input vector 237 @param[in] blockSize number of samples in input vector 238 @param[out] pResult minimum value returned here 239 @return none 240 */ 241 void arm_min_no_idx_f16( 242 const float16_t *pSrc, 243 uint32_t blockSize, 244 float16_t *pResult); 245 246 /** 247 @brief Mean square error between two half precision float vectors. 248 @param[in] pSrcA points to the first input vector 249 @param[in] pSrcB points to the second input vector 250 @param[in] blockSize number of samples in input vector 251 @param[out] pResult mean square error 252 @return none 253 */ 254 255 void arm_mse_f16( 256 const float16_t * pSrcA, 257 const float16_t * pSrcB, 258 uint32_t blockSize, 259 float16_t * pResult); 260 261 262 /** 263 * @brief Sum value of a floating-point vector. 264 * @param[in] pSrc is input pointer 265 * @param[in] blockSize is the number of samples to process 266 * @param[out] pResult is output value. 267 */ 268 void arm_accumulate_f16( 269 const float16_t * pSrc, 270 uint32_t blockSize, 271 float16_t * pResult); 272 273 274 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/ 275 #ifdef __cplusplus 276 } 277 #endif 278 279 #endif /* ifndef _STATISTICS_FUNCTIONS_F16_H_ */ 280