9 arm_cmplx_mag_f32((
float*)&(
data[i]), &result,1);
11 result=sqrtf(
mag2(i));
19 arm_cmplx_mag_f32((
float*)
data, (
float*)destination,
size);
21 for(
size_t i=0; i<
size; i++){
22 destination[i]=
mag(i);
31 arm_cmplx_mag_squared_f32((
float*)&(
data[i]), &result, 1);
44 arm_cmplx_mag_squared_f32((
float*)
data, (
float*)destination,
size);
46 for(
size_t i=0; i<
size; i++){
47 destination[i]=
mag2(i);
55 for(
size_t i=0; i<
size; i++){
63 for(
size_t i=0; i<
size; i++)
64 destination[i] =
data[i].getPhase();
70 arm_cmplx_dot_prod_f32 ( (
float*)
getData(), (
float*)operand2.
getData(),
size, &(result.
re), &(result.
im) );
73 float *pSrcB=(
float*)operand2.
getData();
76 for(
size_t n=0; n<
size; n++) {
77 realResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+0] - pSrcA[(2*n)+1]*pSrcB[(2*n)+1];
78 imagResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+1] + pSrcA[(2*n)+1]*pSrcB[(2*n)+0];
92 float *pSrcB=(
float*)operand2.
getData();
93 float *pDst=(
float*)result.
getData();
94 for(
size_t n=0; n<
size; n++) {
95 pDst[(2*n)+0] = pSrcA[(2*n)+0] * pSrcB[(2*n)+0] - pSrcA[(2*n)+1] * pSrcB[(2*n)+1];
96 pDst[(2*n)+1] = pSrcA[(2*n)+0] * pSrcB[(2*n)+1] + pSrcA[(2*n)+1] * pSrcB[(2*n)+0];
106 for(
size_t n=0; n<
size; n++){
107 destination[n].
re =
data[n].
re + operand2[n].
re;
108 destination[n].
im =
data[n].
im + operand2[n].
im;
114 add(operand2, *
this);
122 for(
size_t n=0; n<
size; n++){
123 destination[n].
re =
data[n].
re - operand2[n].
re;
124 destination[n].
im =
data[n].
im - operand2[n].
im;
140 float *pDst=(
float *)destination.
getData();
141 for(
size_t n=0; n<
size; n++) {
142 pDst[(2*n)+0] = pSrc[(2*n)+0];
143 pDst[(2*n)+1] = -pSrc[(2*n)+1];
154 float *pSrcCmplx=(
float*)
getData();
155 float *pSrcReal=(
float*)operand2.
getData();
156 float *pCmplxDst=(
float*)result.
getData();
157 for(
size_t n=0; n<
size; n++) {
158 pCmplxDst[(2*n)+0] = pSrcCmplx[(2*n)+0] * pSrcReal[n];
159 pCmplxDst[(2*n)+1] = pSrcCmplx[(2*n)+1] * pSrcReal[n];
167 for(
size_t n=0; n<
size; n++){
168 float magnitude=
mag2(n);
169 if(magnitude>maxMag){
178 ASSERT(
size >= offset+length,
"Array too small");
184 for(
size_t n=0; n<
size; n++){
190 maxMag=sqrtf(maxMag);
195 for(
size_t n=0; n<
size; n++){
201 for(
size_t n=0; n<
size; n++){
209 arm_scale_f32((
float*)
data, factor, (
float*)
data,
size*2);
211 for(
size_t n=0; n<
size; n++){
220 for(
size_t n=0; n<
size; n++){
229 for(
size_t n=0; n<
size; n++){
230 destination[n] =
data[n].
re;
238 arm_fill_f32(value, (
float *)
data,
size *2 );
248 for(
size_t n=0; n<
size; n++){
265 for(
size_t n=offset; n<count+offset; n++){
274 for(
size_t n=offset; n<count+offset; n++){
283 for(
size_t n=offset; n<count+offset; n++){
301 for(
size_t n=offset; n<count+offset; n++){
317 for (
size_t i = 0; i <
getSize(); i++) {
323 for (
size_t i = 0; i <
getSize(); i++) {
void getPhaseValues(FloatArray destination)
The phases of the elements of the array.
float im(const int i)
Get the imaginary part of an element of the array.
void getImaginaryValues(FloatArray buf)
Get the imaginary part of the elements of the array.
void getComplexConjugateValues(ComplexFloatArray destination)
The complex conjugate values of the element of the array.
void setPolar(FloatArray magnitude, FloatArray phase)
Set all the elements in the array using polar coordinates.
void setPhase(FloatArray phase)
Set the phase of the elements of the array, leaving the magnitude unchanged.
void getMagnitudeSquaredValues(FloatArray destination)
The squared magnitudes of the elements of the array.
void getRealValues(FloatArray buf)
Get the real part of the elements of the array.
void add(ComplexFloatArray operand2, ComplexFloatArray destination)
Element-wise sum between complex arrays.
static void destroy(ComplexFloatArray)
Destroys a ComplexFloatArray created with the create() method.
void setMagnitude(FloatArray magnitude)
Set the magnitude of the elements of the array, leaving the phase unchanged.
void complexDotProduct(ComplexFloatArray operand2, ComplexFloat &result)
Complex dot product between arrays.
ComplexFloatArray subArray(int offset, size_t length)
A subset of the array.
void copyTo(FloatArray real, FloatArray imag)
Split complex data into two channels of audio containing real and imaginary axis data.
void complexByComplexMultiplication(ComplexFloatArray operand2, ComplexFloatArray result)
Complex by complex multiplication between arrays.
void getPolar(FloatArray magnitude, FloatArray phase)
Get polar coordinates for all the elements in the array.
void getMagnitudeValues(FloatArray destination)
The magnitudes of the elements of the array.
void setAll(ComplexFloat value)
Set all the elements in the array.
float mag2(const int i)
The magnitude squared of an element of the array.
void scale(float factor)
Array by scalar multiplication.
static ComplexFloatArray create(size_t size)
Creates a new ComplexFloatArray.
int getMaxMagnitudeIndex()
The index of the element with the maximum magnitude in the array.
void copyFrom(FloatArray real, FloatArray imag)
Merge two channels of audio containing real and imaginary axis data into this array.
float re(const int i)
Get the real part of an element of the array.
float getMaxMagnitudeValue()
The value of the element with the maximum magnitude in the array.
void subtract(ComplexFloatArray operand2, ComplexFloatArray destination)
Element-wise difference between complex arrays.
float mag(const int i)
Get the magnitude of an element of the array.
void toFloat(FloatArray destination)
Copies real and imaginary values of the ComplexFloatArray into a FloatArray.
void complexByRealMultiplication(FloatArray operand2, ComplexFloatArray result)
Complex by real multiplication between arrays.
void fromFloat(FloatArray source)
Copies real values from a FloatArray, sets imaginary values to 0.
This class contains useful methods for manipulating arrays of floats.
ComplexFloat * getData()
Get the data stored in the Array.
#define ASSERT(cond, msg)
A structure defining a floating point complex number as two members of type float.
float im
The imaginary part of the complex number.
float re
The real part of the complex number.
float getMagnitude() const
Get the magnitude of the complex number.
float getPhase() const
Get the phase of the complex number.
void setPhase(float phase)
Set the phase of the complex number.
void setPolar(float magnitude, float phase)
Set magnitude and phase of the complex number.