1 /****************************************************************************** 2 * @file statistics_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 _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 Entropy 155 * 156 * @param[in] pSrcA Array of input values. 157 * @param[in] blockSize Number of samples in the input array. 158 * @return Entropy -Sum(p ln p) 159 * 160 */ 161 162 163 float16_t arm_entropy_f16(const float16_t * pSrcA,uint32_t blockSize); 164 165 float16_t arm_logsumexp_f16(const float16_t *in, uint32_t blockSize); 166 167 /** 168 * @brief Dot product with log arithmetic 169 * 170 * Vectors are containing the log of the samples 171 * 172 * @param[in] pSrcA points to the first input vector 173 * @param[in] pSrcB points to the second input vector 174 * @param[in] blockSize number of samples in each vector 175 * @param[in] pTmpBuffer temporary buffer of length blockSize 176 * @return The log of the dot product . 177 * 178 */ 179 180 181 float16_t arm_logsumexp_dot_prod_f16(const float16_t * pSrcA, 182 const float16_t * pSrcB, 183 uint32_t blockSize, 184 float16_t *pTmpBuffer); 185 186 /** 187 * @brief Kullback-Leibler 188 * 189 * @param[in] pSrcA Pointer to an array of input values for probability distribution A. 190 * @param[in] pSrcB Pointer to an array of input values for probability distribution B. 191 * @param[in] blockSize Number of samples in the input array. 192 * @return Kullback-Leibler Divergence D(A || B) 193 * 194 */ 195 float16_t arm_kullback_leibler_f16(const float16_t * pSrcA 196 ,const float16_t * pSrcB 197 ,uint32_t blockSize); 198 199 /** 200 @brief Maximum value of a floating-point vector. 201 @param[in] pSrc points to the input vector 202 @param[in] blockSize number of samples in input vector 203 @param[out] pResult maximum value returned here 204 @return none 205 */ 206 void arm_max_no_idx_f16( 207 const float16_t *pSrc, 208 uint32_t blockSize, 209 float16_t *pResult); 210 211 212 213 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/ 214 #ifdef __cplusplus 215 } 216 #endif 217 218 #endif /* ifndef _STATISTICS_FUNCTIONS_F16_H_ */ 219