1 /****************************************************************************** 2 * @file complex_math_functions.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 _COMPLEX_MATH_FUNCTIONS_H_ 28 #define _COMPLEX_MATH_FUNCTIONS_H_ 29 30 #include "arm_math_types.h" 31 #include "arm_math_memory.h" 32 33 #include "dsp/none.h" 34 #include "dsp/utils.h" 35 #include "dsp/fast_math_functions.h" 36 37 #ifdef __cplusplus 38 extern "C" 39 { 40 #endif 41 42 /** 43 * @defgroup groupCmplxMath Complex Math Functions 44 * This set of functions operates on complex data vectors. 45 * The data in the complex arrays is stored in an interleaved fashion 46 * (real, imag, real, imag, ...). 47 * In the API functions, the number of samples in a complex array refers 48 * to the number of complex values; the array contains twice this number of 49 * real values. 50 */ 51 52 /** 53 * @brief Floating-point complex conjugate. 54 * @param[in] pSrc points to the input vector 55 * @param[out] pDst points to the output vector 56 * @param[in] numSamples number of complex samples in each vector 57 */ 58 void arm_cmplx_conj_f32( 59 const float32_t * pSrc, 60 float32_t * pDst, 61 uint32_t numSamples); 62 63 /** 64 * @brief Q31 complex conjugate. 65 * @param[in] pSrc points to the input vector 66 * @param[out] pDst points to the output vector 67 * @param[in] numSamples number of complex samples in each vector 68 */ 69 void arm_cmplx_conj_q31( 70 const q31_t * pSrc, 71 q31_t * pDst, 72 uint32_t numSamples); 73 74 75 /** 76 * @brief Q15 complex conjugate. 77 * @param[in] pSrc points to the input vector 78 * @param[out] pDst points to the output vector 79 * @param[in] numSamples number of complex samples in each vector 80 */ 81 void arm_cmplx_conj_q15( 82 const q15_t * pSrc, 83 q15_t * pDst, 84 uint32_t numSamples); 85 86 87 /** 88 * @brief Floating-point complex magnitude squared 89 * @param[in] pSrc points to the complex input vector 90 * @param[out] pDst points to the real output vector 91 * @param[in] numSamples number of complex samples in the input vector 92 */ 93 void arm_cmplx_mag_squared_f32( 94 const float32_t * pSrc, 95 float32_t * pDst, 96 uint32_t numSamples); 97 98 99 /** 100 * @brief Q31 complex magnitude squared 101 * @param[in] pSrc points to the complex input vector 102 * @param[out] pDst points to the real output vector 103 * @param[in] numSamples number of complex samples in the input vector 104 */ 105 void arm_cmplx_mag_squared_q31( 106 const q31_t * pSrc, 107 q31_t * pDst, 108 uint32_t numSamples); 109 110 111 /** 112 * @brief Q15 complex magnitude squared 113 * @param[in] pSrc points to the complex input vector 114 * @param[out] pDst points to the real output vector 115 * @param[in] numSamples number of complex samples in the input vector 116 */ 117 void arm_cmplx_mag_squared_q15( 118 const q15_t * pSrc, 119 q15_t * pDst, 120 uint32_t numSamples); 121 122 123 /** 124 * @brief Floating-point complex magnitude 125 * @param[in] pSrc points to the complex input vector 126 * @param[out] pDst points to the real output vector 127 * @param[in] numSamples number of complex samples in the input vector 128 */ 129 void arm_cmplx_mag_f32( 130 const float32_t * pSrc, 131 float32_t * pDst, 132 uint32_t numSamples); 133 134 135 /** 136 * @brief Q31 complex magnitude 137 * @param[in] pSrc points to the complex input vector 138 * @param[out] pDst points to the real output vector 139 * @param[in] numSamples number of complex samples in the input vector 140 */ 141 void arm_cmplx_mag_q31( 142 const q31_t * pSrc, 143 q31_t * pDst, 144 uint32_t numSamples); 145 146 147 /** 148 * @brief Q15 complex magnitude 149 * @param[in] pSrc points to the complex input vector 150 * @param[out] pDst points to the real output vector 151 * @param[in] numSamples number of complex samples in the input vector 152 */ 153 void arm_cmplx_mag_q15( 154 const q15_t * pSrc, 155 q15_t * pDst, 156 uint32_t numSamples); 157 158 159 /** 160 * @brief Q15 complex dot product 161 * @param[in] pSrcA points to the first input vector 162 * @param[in] pSrcB points to the second input vector 163 * @param[in] numSamples number of complex samples in each vector 164 * @param[out] realResult real part of the result returned here 165 * @param[out] imagResult imaginary part of the result returned here 166 */ 167 void arm_cmplx_dot_prod_q15( 168 const q15_t * pSrcA, 169 const q15_t * pSrcB, 170 uint32_t numSamples, 171 q31_t * realResult, 172 q31_t * imagResult); 173 174 175 /** 176 * @brief Q31 complex dot product 177 * @param[in] pSrcA points to the first input vector 178 * @param[in] pSrcB points to the second input vector 179 * @param[in] numSamples number of complex samples in each vector 180 * @param[out] realResult real part of the result returned here 181 * @param[out] imagResult imaginary part of the result returned here 182 */ 183 void arm_cmplx_dot_prod_q31( 184 const q31_t * pSrcA, 185 const q31_t * pSrcB, 186 uint32_t numSamples, 187 q63_t * realResult, 188 q63_t * imagResult); 189 190 191 /** 192 * @brief Floating-point complex dot product 193 * @param[in] pSrcA points to the first input vector 194 * @param[in] pSrcB points to the second input vector 195 * @param[in] numSamples number of complex samples in each vector 196 * @param[out] realResult real part of the result returned here 197 * @param[out] imagResult imaginary part of the result returned here 198 */ 199 void arm_cmplx_dot_prod_f32( 200 const float32_t * pSrcA, 201 const float32_t * pSrcB, 202 uint32_t numSamples, 203 float32_t * realResult, 204 float32_t * imagResult); 205 206 207 /** 208 * @brief Q15 complex-by-real multiplication 209 * @param[in] pSrcCmplx points to the complex input vector 210 * @param[in] pSrcReal points to the real input vector 211 * @param[out] pCmplxDst points to the complex output vector 212 * @param[in] numSamples number of samples in each vector 213 */ 214 void arm_cmplx_mult_real_q15( 215 const q15_t * pSrcCmplx, 216 const q15_t * pSrcReal, 217 q15_t * pCmplxDst, 218 uint32_t numSamples); 219 220 221 /** 222 * @brief Q31 complex-by-real multiplication 223 * @param[in] pSrcCmplx points to the complex input vector 224 * @param[in] pSrcReal points to the real input vector 225 * @param[out] pCmplxDst points to the complex output vector 226 * @param[in] numSamples number of samples in each vector 227 */ 228 void arm_cmplx_mult_real_q31( 229 const q31_t * pSrcCmplx, 230 const q31_t * pSrcReal, 231 q31_t * pCmplxDst, 232 uint32_t numSamples); 233 234 235 /** 236 * @brief Floating-point complex-by-real multiplication 237 * @param[in] pSrcCmplx points to the complex input vector 238 * @param[in] pSrcReal points to the real input vector 239 * @param[out] pCmplxDst points to the complex output vector 240 * @param[in] numSamples number of samples in each vector 241 */ 242 void arm_cmplx_mult_real_f32( 243 const float32_t * pSrcCmplx, 244 const float32_t * pSrcReal, 245 float32_t * pCmplxDst, 246 uint32_t numSamples); 247 248 /** 249 * @brief Q15 complex-by-complex multiplication 250 * @param[in] pSrcA points to the first input vector 251 * @param[in] pSrcB points to the second input vector 252 * @param[out] pDst points to the output vector 253 * @param[in] numSamples number of complex samples in each vector 254 */ 255 void arm_cmplx_mult_cmplx_q15( 256 const q15_t * pSrcA, 257 const q15_t * pSrcB, 258 q15_t * pDst, 259 uint32_t numSamples); 260 261 262 /** 263 * @brief Q31 complex-by-complex multiplication 264 * @param[in] pSrcA points to the first input vector 265 * @param[in] pSrcB points to the second input vector 266 * @param[out] pDst points to the output vector 267 * @param[in] numSamples number of complex samples in each vector 268 */ 269 void arm_cmplx_mult_cmplx_q31( 270 const q31_t * pSrcA, 271 const q31_t * pSrcB, 272 q31_t * pDst, 273 uint32_t numSamples); 274 275 276 /** 277 * @brief Floating-point complex-by-complex multiplication 278 * @param[in] pSrcA points to the first input vector 279 * @param[in] pSrcB points to the second input vector 280 * @param[out] pDst points to the output vector 281 * @param[in] numSamples number of complex samples in each vector 282 */ 283 void arm_cmplx_mult_cmplx_f32( 284 const float32_t * pSrcA, 285 const float32_t * pSrcB, 286 float32_t * pDst, 287 uint32_t numSamples); 288 289 290 291 #ifdef __cplusplus 292 } 293 #endif 294 295 #endif /* ifndef _COMPLEX_MATH_FUNCTIONS_H_ */ 296