9 int16_t in[2] = {
re,
im};
10 arm_cmplx_mag_q15(in, &out, 1);
38 arm_cmplx_mag_q15((int16_t*)&(
data[i]), &result,1);
48 arm_cmplx_mag_q15((int16_t*)
data, (int16_t*)destination,
size);
52 for(
size_t i=0; i<
size; i++){
53 destination[i]=
mag(i);
62 arm_cmplx_mag_squared_q15((int16_t*)&(
data[i]), &result, 1);
65 arm_shift_q15((int16_t*)&result, 2, (int16_t*)&result, 1);
77 arm_cmplx_mag_squared_q15((int16_t*)
data, (int16_t*)destination,
size);
80 arm_shift_q15((int16_t*)destination, 2, (int16_t*)destination,
83 for(
size_t i=0; i<
size; i++){
84 destination[i]=
mag2(i);
93 arm_cmplx_dot_prod_q15 ( (int16_t*)
data, (int16_t*)operand2,
size, &(result.
re), &(result.
im) );
95 int16_t *pSrcA=(int16_t*)
data;
96 int16_t *pSrcB=(int16_t*)operand2;
99 for(
size_t n=0; n<
size; n++) {
100 realResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+0] - pSrcA[(2*n)+1]*pSrcB[(2*n)+1];
101 imagResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+1] + pSrcA[(2*n)+1]*pSrcB[(2*n)+0];
103 result.
re=realResult;
104 result.
im=imagResult;
115 int16_t* pSrcA = (int16_t*)
data;
116 int16_t* pSrcB = (int16_t*)operand2.
getData();
117 int16_t* pDst = (int16_t*)result.
getData();
118 for(
size_t n=0; n<
size; n++) {
119 pDst[(2*n)+0] =
Q15_MUL_Q15(pSrcA[(2*n)+0], pSrcB[(2*n)+0]) -
121 pDst[(2*n)+1] =
Q15_MUL_Q15(pSrcA[(2*n)+0], pSrcB[(2*n)+1]) +
130 arm_fill_q15(value, (int16_t*)
data,
size *2 );
140 for(
size_t n=0; n<
size; n++){
154 arm_add_q15((int16_t*)
data, (int16_t*)operand2.
data, (int16_t*)destination.
data,
size*2);
156 for(
size_t n=0; n<
size; n++){
157 destination[n].
re =
data[n].
re + operand2[n].
re;
158 destination[n].
im =
data[n].
im + operand2[n].
im;
int16_t mag(const int i)
The magnitude of an element of the array.
int16_t im(const int i)
The imaginary part of an element of the array.
void add(ComplexShortArray operand2, ComplexShortArray destination)
Element-wise sum between complex arrays.
void complexByComplexMultiplication(ComplexShortArray operand2, ComplexShortArray result)
Complex by complex multiplication between arrays.
static ComplexShortArray create(unsigned int size)
Creates a new ComplexShortArray.
void complexDotProduct(ComplexShortArray operand2, ComplexShort &result)
Complex dot product between arrays.
void getMagnitudeSquaredValues(ShortArray destination)
The squared magnitudes of the elements of the array.
int16_t mag2(const int i)
The magnitude squared of an element of the array.
static void destroy(ComplexShortArray)
Destroys a ComplexShortArray created with the create() method.
void getMagnitudeValues(ShortArray destination)
The magnitudes of the elements of the array.
int16_t re(const int i)
The real part of an element of the array.
void setAll(ComplexShort value)
Set all the elements in the array.
This class contains useful methods for manipulating arrays of int16_ts.
void shift(int shiftValue)
Bitshift the array values, saturating.
ComplexShort * getData()
Get the data stored in the Array.
#define Q15_MUL_Q15(a, b)
A structure defining a fixed point complex number as two members of type int16_t.
void setPolar(int16_t magnitude, int16_t phase)
Set magnitude and phase of the complex number.
int16_t re
The real part of the complex number.
int16_t getMagnitude()
Get the magnitude of the complex number.
int16_t getPhase()
Get the phase of the complex number.
int16_t im
The imaginary part of the complex number.