statistics_functions_f16.h 8.3 KB

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