1 /* ----------------------------------------------------------------------
2 * Project: CMSIS DSP Library
3 * Title: arm_cmplx_conj_f32.c
4 * Description: Floating-point complex conjugate
6 * $Date: 27. January 2017
9 * Target Processor: Cortex-M cores
10 * -------------------------------------------------------------------- */
12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
14 * SPDX-License-Identifier: Apache-2.0
16 * Licensed under the Apache License, Version 2.0 (the License); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
20 * www.apache.org/licenses/LICENSE-2.0
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
32 * @ingroup groupCmplxMath
36 * @defgroup cmplx_conj Complex Conjugate
38 * Conjugates the elements of a complex data vector.
40 * The <code>pSrc</code> points to the source data and
41 * <code>pDst</code> points to the where the result should be written.
42 * <code>numSamples</code> specifies the number of complex samples
43 * and the data in each array is stored in an interleaved fashion
44 * (real, imag, real, imag, ...).
45 * Each array has a total of <code>2*numSamples</code> values.
46 * The underlying algorithm is used:
49 * for(n=0; n<numSamples; n++) {
50 * pDst[(2*n)+0)] = pSrc[(2*n)+0]; // real part
51 * pDst[(2*n)+1)] = -pSrc[(2*n)+1]; // imag part
55 * There are separate functions for floating-point, Q15, and Q31 data types.
59 * @addtogroup cmplx_conj
64 * @brief Floating-point complex conjugate.
65 * @param *pSrc points to the input vector
66 * @param *pDst points to the output vector
67 * @param numSamples number of complex samples in each vector
71 void arm_cmplx_conj_f32(
76 uint32_t blkCnt
; /* loop counter */
78 #if defined (ARM_MATH_DSP)
80 /* Run the below code for Cortex-M4 and Cortex-M3 */
81 float32_t inR1
, inR2
, inR3
, inR4
;
82 float32_t inI1
, inI2
, inI3
, inI4
;
85 blkCnt
= numSamples
>> 2U;
87 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
88 ** a second loop below computes the remaining 1 to 3 samples. */
91 /* C[0]+jC[1] = A[0]+ j (-1) A[1] */
92 /* Calculate Complex Conjugate and then store the results in the destination buffer. */
93 /* read real input samples */
95 /* store real samples to destination */
104 /* read imaginary input samples */
108 /* conjugate input */
111 /* read imaginary input samples */
114 /* conjugate input */
117 /* read imaginary input samples */
120 /* conjugate input */
123 /* store imaginary samples to destination */
127 /* conjugate input */
130 /* store imaginary samples to destination */
133 /* increment source pointer by 8 to process next sampels */
136 /* store imaginary sample to destination */
139 /* increment destination pointer by 8 to store next samples */
142 /* Decrement the loop counter */
146 /* If the numSamples is not a multiple of 4, compute any remaining output samples here.
147 ** No loop unrolling is used. */
148 blkCnt
= numSamples
% 0x4U
;
152 /* Run the below code for Cortex-M0 */
155 #endif /* #if defined (ARM_MATH_DSP) */
159 /* realOut + j (imagOut) = realIn + j (-1) imagIn */
160 /* Calculate Complex Conjugate and then store the results in the destination buffer. */
164 /* Decrement the loop counter */
170 * @} end of cmplx_conj group