statistics_functions_f16.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /******************************************************************************
  2. * @file statistics_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. #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. */
  164. float16_t arm_entropy_f16(const float16_t * pSrcA,uint32_t blockSize);
  165. float16_t arm_logsumexp_f16(const float16_t *in, uint32_t blockSize);
  166. /**
  167. * @brief Dot product with log arithmetic
  168. *
  169. * Vectors are containing the log of the samples
  170. *
  171. * @param[in] pSrcA points to the first input vector
  172. * @param[in] pSrcB points to the second input vector
  173. * @param[in] blockSize number of samples in each vector
  174. * @param[in] pTmpBuffer temporary buffer of length blockSize
  175. * @return The log of the dot product .
  176. *
  177. */
  178. float16_t arm_logsumexp_dot_prod_f16(const float16_t * pSrcA,
  179. const float16_t * pSrcB,
  180. uint32_t blockSize,
  181. float16_t *pTmpBuffer);
  182. /**
  183. * @brief Kullback-Leibler
  184. *
  185. * @param[in] pSrcA Pointer to an array of input values for probability distribution A.
  186. * @param[in] pSrcB Pointer to an array of input values for probability distribution B.
  187. * @param[in] blockSize Number of samples in the input array.
  188. * @return Kullback-Leibler Divergence D(A || B)
  189. *
  190. */
  191. float16_t arm_kullback_leibler_f16(const float16_t * pSrcA
  192. ,const float16_t * pSrcB
  193. ,uint32_t blockSize);
  194. /**
  195. @brief Maximum value of a floating-point vector.
  196. @param[in] pSrc points to the input vector
  197. @param[in] blockSize number of samples in input vector
  198. @param[out] pResult maximum value returned here
  199. @return none
  200. */
  201. void arm_max_no_idx_f16(
  202. const float16_t *pSrc,
  203. uint32_t blockSize,
  204. float16_t *pResult);
  205. /**
  206. @brief Minimum value of a floating-point vector.
  207. @param[in] pSrc points to the input vector
  208. @param[in] blockSize number of samples in input vector
  209. @param[out] pResult minimum value returned here
  210. @return none
  211. */
  212. void arm_min_no_idx_f16(
  213. const float16_t *pSrc,
  214. uint32_t blockSize,
  215. float16_t *pResult);
  216. /**
  217. @brief Mean square error between two half precision float vectors.
  218. @param[in] pSrcA points to the first input vector
  219. @param[in] pSrcB points to the second input vector
  220. @param[in] blockSize number of samples in input vector
  221. @param[out] pResult mean square error
  222. @return none
  223. */
  224. void arm_mse_f16(
  225. const float16_t * pSrcA,
  226. const float16_t * pSrcB,
  227. uint32_t blockSize,
  228. float16_t * pResult);
  229. #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
  230. #ifdef __cplusplus
  231. }
  232. #endif
  233. #endif /* ifndef _STATISTICS_FUNCTIONS_F16_H_ */