complex_math_functions.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /******************************************************************************
  2. * @file complex_math_functions.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.9.0
  5. * @date 20. July 2020
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #ifndef _COMPLEX_MATH_FUNCTIONS_H_
  25. #define _COMPLEX_MATH_FUNCTIONS_H_
  26. #include "arm_math_types.h"
  27. #include "arm_math_memory.h"
  28. #include "dsp/none.h"
  29. #include "dsp/utils.h"
  30. #include "dsp/fast_math_functions.h"
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. /**
  36. * @defgroup groupCmplxMath Complex Math Functions
  37. * This set of functions operates on complex data vectors.
  38. * The data in the complex arrays is stored in an interleaved fashion
  39. * (real, imag, real, imag, ...).
  40. * In the API functions, the number of samples in a complex array refers
  41. * to the number of complex values; the array contains twice this number of
  42. * real values.
  43. */
  44. /**
  45. * @brief Floating-point complex conjugate.
  46. * @param[in] pSrc points to the input vector
  47. * @param[out] pDst points to the output vector
  48. * @param[in] numSamples number of complex samples in each vector
  49. */
  50. void arm_cmplx_conj_f32(
  51. const float32_t * pSrc,
  52. float32_t * pDst,
  53. uint32_t numSamples);
  54. /**
  55. * @brief Q31 complex conjugate.
  56. * @param[in] pSrc points to the input vector
  57. * @param[out] pDst points to the output vector
  58. * @param[in] numSamples number of complex samples in each vector
  59. */
  60. void arm_cmplx_conj_q31(
  61. const q31_t * pSrc,
  62. q31_t * pDst,
  63. uint32_t numSamples);
  64. /**
  65. * @brief Q15 complex conjugate.
  66. * @param[in] pSrc points to the input vector
  67. * @param[out] pDst points to the output vector
  68. * @param[in] numSamples number of complex samples in each vector
  69. */
  70. void arm_cmplx_conj_q15(
  71. const q15_t * pSrc,
  72. q15_t * pDst,
  73. uint32_t numSamples);
  74. /**
  75. * @brief Floating-point complex magnitude squared
  76. * @param[in] pSrc points to the complex input vector
  77. * @param[out] pDst points to the real output vector
  78. * @param[in] numSamples number of complex samples in the input vector
  79. */
  80. void arm_cmplx_mag_squared_f32(
  81. const float32_t * pSrc,
  82. float32_t * pDst,
  83. uint32_t numSamples);
  84. /**
  85. * @brief Q31 complex magnitude squared
  86. * @param[in] pSrc points to the complex input vector
  87. * @param[out] pDst points to the real output vector
  88. * @param[in] numSamples number of complex samples in the input vector
  89. */
  90. void arm_cmplx_mag_squared_q31(
  91. const q31_t * pSrc,
  92. q31_t * pDst,
  93. uint32_t numSamples);
  94. /**
  95. * @brief Q15 complex magnitude squared
  96. * @param[in] pSrc points to the complex input vector
  97. * @param[out] pDst points to the real output vector
  98. * @param[in] numSamples number of complex samples in the input vector
  99. */
  100. void arm_cmplx_mag_squared_q15(
  101. const q15_t * pSrc,
  102. q15_t * pDst,
  103. uint32_t numSamples);
  104. /**
  105. * @brief Floating-point complex magnitude
  106. * @param[in] pSrc points to the complex input vector
  107. * @param[out] pDst points to the real output vector
  108. * @param[in] numSamples number of complex samples in the input vector
  109. */
  110. void arm_cmplx_mag_f32(
  111. const float32_t * pSrc,
  112. float32_t * pDst,
  113. uint32_t numSamples);
  114. /**
  115. * @brief Q31 complex magnitude
  116. * @param[in] pSrc points to the complex input vector
  117. * @param[out] pDst points to the real output vector
  118. * @param[in] numSamples number of complex samples in the input vector
  119. */
  120. void arm_cmplx_mag_q31(
  121. const q31_t * pSrc,
  122. q31_t * pDst,
  123. uint32_t numSamples);
  124. /**
  125. * @brief Q15 complex magnitude
  126. * @param[in] pSrc points to the complex input vector
  127. * @param[out] pDst points to the real output vector
  128. * @param[in] numSamples number of complex samples in the input vector
  129. */
  130. void arm_cmplx_mag_q15(
  131. const q15_t * pSrc,
  132. q15_t * pDst,
  133. uint32_t numSamples);
  134. /**
  135. * @brief Q15 complex dot product
  136. * @param[in] pSrcA points to the first input vector
  137. * @param[in] pSrcB points to the second input vector
  138. * @param[in] numSamples number of complex samples in each vector
  139. * @param[out] realResult real part of the result returned here
  140. * @param[out] imagResult imaginary part of the result returned here
  141. */
  142. void arm_cmplx_dot_prod_q15(
  143. const q15_t * pSrcA,
  144. const q15_t * pSrcB,
  145. uint32_t numSamples,
  146. q31_t * realResult,
  147. q31_t * imagResult);
  148. /**
  149. * @brief Q31 complex dot product
  150. * @param[in] pSrcA points to the first input vector
  151. * @param[in] pSrcB points to the second input vector
  152. * @param[in] numSamples number of complex samples in each vector
  153. * @param[out] realResult real part of the result returned here
  154. * @param[out] imagResult imaginary part of the result returned here
  155. */
  156. void arm_cmplx_dot_prod_q31(
  157. const q31_t * pSrcA,
  158. const q31_t * pSrcB,
  159. uint32_t numSamples,
  160. q63_t * realResult,
  161. q63_t * imagResult);
  162. /**
  163. * @brief Floating-point complex dot product
  164. * @param[in] pSrcA points to the first input vector
  165. * @param[in] pSrcB points to the second input vector
  166. * @param[in] numSamples number of complex samples in each vector
  167. * @param[out] realResult real part of the result returned here
  168. * @param[out] imagResult imaginary part of the result returned here
  169. */
  170. void arm_cmplx_dot_prod_f32(
  171. const float32_t * pSrcA,
  172. const float32_t * pSrcB,
  173. uint32_t numSamples,
  174. float32_t * realResult,
  175. float32_t * imagResult);
  176. /**
  177. * @brief Q15 complex-by-real multiplication
  178. * @param[in] pSrcCmplx points to the complex input vector
  179. * @param[in] pSrcReal points to the real input vector
  180. * @param[out] pCmplxDst points to the complex output vector
  181. * @param[in] numSamples number of samples in each vector
  182. */
  183. void arm_cmplx_mult_real_q15(
  184. const q15_t * pSrcCmplx,
  185. const q15_t * pSrcReal,
  186. q15_t * pCmplxDst,
  187. uint32_t numSamples);
  188. /**
  189. * @brief Q31 complex-by-real multiplication
  190. * @param[in] pSrcCmplx points to the complex input vector
  191. * @param[in] pSrcReal points to the real input vector
  192. * @param[out] pCmplxDst points to the complex output vector
  193. * @param[in] numSamples number of samples in each vector
  194. */
  195. void arm_cmplx_mult_real_q31(
  196. const q31_t * pSrcCmplx,
  197. const q31_t * pSrcReal,
  198. q31_t * pCmplxDst,
  199. uint32_t numSamples);
  200. /**
  201. * @brief Floating-point complex-by-real multiplication
  202. * @param[in] pSrcCmplx points to the complex input vector
  203. * @param[in] pSrcReal points to the real input vector
  204. * @param[out] pCmplxDst points to the complex output vector
  205. * @param[in] numSamples number of samples in each vector
  206. */
  207. void arm_cmplx_mult_real_f32(
  208. const float32_t * pSrcCmplx,
  209. const float32_t * pSrcReal,
  210. float32_t * pCmplxDst,
  211. uint32_t numSamples);
  212. /**
  213. * @brief Q15 complex-by-complex multiplication
  214. * @param[in] pSrcA points to the first input vector
  215. * @param[in] pSrcB points to the second input vector
  216. * @param[out] pDst points to the output vector
  217. * @param[in] numSamples number of complex samples in each vector
  218. */
  219. void arm_cmplx_mult_cmplx_q15(
  220. const q15_t * pSrcA,
  221. const q15_t * pSrcB,
  222. q15_t * pDst,
  223. uint32_t numSamples);
  224. /**
  225. * @brief Q31 complex-by-complex multiplication
  226. * @param[in] pSrcA points to the first input vector
  227. * @param[in] pSrcB points to the second input vector
  228. * @param[out] pDst points to the output vector
  229. * @param[in] numSamples number of complex samples in each vector
  230. */
  231. void arm_cmplx_mult_cmplx_q31(
  232. const q31_t * pSrcA,
  233. const q31_t * pSrcB,
  234. q31_t * pDst,
  235. uint32_t numSamples);
  236. /**
  237. * @brief Floating-point complex-by-complex multiplication
  238. * @param[in] pSrcA points to the first input vector
  239. * @param[in] pSrcB points to the second input vector
  240. * @param[out] pDst points to the output vector
  241. * @param[in] numSamples number of complex samples in each vector
  242. */
  243. void arm_cmplx_mult_cmplx_f32(
  244. const float32_t * pSrcA,
  245. const float32_t * pSrcB,
  246. float32_t * pDst,
  247. uint32_t numSamples);
  248. #ifdef __cplusplus
  249. }
  250. #endif
  251. #endif /* ifndef _COMPLEX_MATH_FUNCTIONS_H_ */