OpenWareLaboratory
ComplexFloatArray Class Reference
Inheritance diagram for ComplexFloatArray:
Collaboration diagram for ComplexFloatArray:

Public Member Functions

void add (ComplexFloatArray operand2)
 In-place element-wise sum between complex arrays. More...
 
void add (ComplexFloatArray operand2, ComplexFloatArray destination)
 Element-wise sum between complex arrays. More...
 
void clear ()
 
void complexByComplexMultiplication (ComplexFloatArray operand2, ComplexFloatArray result)
 Complex by complex multiplication between arrays. More...
 
void complexByRealMultiplication (FloatArray operand2, ComplexFloatArray result)
 Complex by real multiplication between arrays. More...
 
void complexDotProduct (ComplexFloatArray operand2, ComplexFloat &result)
 Complex dot product between arrays. More...
 
 ComplexFloatArray ()
 
 ComplexFloatArray (ComplexFloat *data, size_t size)
 
void copyFrom (FloatArray real, FloatArray imag)
 Merge two channels of audio containing real and imaginary axis data into this array. More...
 
void copyFrom (SimpleArray< ComplexFloat > source)
 Copies the content of another array into this array. More...
 
void copyTo (FloatArray real, FloatArray imag)
 Split complex data into two channels of audio containing real and imaginary axis data. More...
 
void copyTo (SimpleArray< ComplexFloat > destination)
 Copies the content of this array to another array. More...
 
bool equals (const SimpleArray< ComplexFloat > &other) const
 Compares two arrays. More...
 
void fromFloat (FloatArray source)
 Copies real values from a FloatArray, sets imaginary values to 0. More...
 
void getComplexConjugateValues (ComplexFloatArray destination)
 The complex conjugate values of the element of the array. More...
 
ComplexFloatgetData ()
 Get the data stored in the Array. More...
 
ComplexFloat getElement (size_t index)
 Get a single value stored in the array. More...
 
void getImaginaryValues (FloatArray buf)
 Get the imaginary part of the elements of the array. More...
 
void getMagnitudeSquaredValues (FloatArray destination)
 The squared magnitudes of the elements of the array. More...
 
void getMagnitudeValues (FloatArray destination)
 The magnitudes of the elements of the array. More...
 
int getMaxMagnitudeIndex ()
 The index of the element with the maximum magnitude in the array. More...
 
float getMaxMagnitudeValue ()
 The value of the element with the maximum magnitude in the array. More...
 
void getPhaseValues (FloatArray destination)
 The phases of the elements of the array. More...
 
void getPolar (FloatArray magnitude, FloatArray phase)
 Get polar coordinates for all the elements in the array. More...
 
void getRealValues (FloatArray buf)
 Get the real part of the elements of the array. More...
 
size_t getSize () const
 
float im (const int i)
 Get the imaginary part of an element of the array. More...
 
void insert (SimpleArray< ComplexFloat > source, int destinationOffset, size_t len)
 Copies the content of an array into a subset of the array. More...
 
void insert (SimpleArray< ComplexFloat > source, int sourceOffset, int destinationOffset, size_t len)
 Copies the content of an array into a subset of the array. More...
 
bool isEmpty () const
 
float mag (const int i)
 Get the magnitude of an element of the array. More...
 
float mag2 (const int i)
 The magnitude squared of an element of the array. More...
 
void move (int fromIndex, int toIndex, size_t len)
 Copies values within an array. More...
 
 operator ComplexFloat * ()
 Casting operator to T*. More...
 
float re (const int i)
 Get the real part of an element of the array. More...
 
void scale (float factor)
 Array by scalar multiplication. More...
 
void setAll (ComplexFloat value)
 Set all the elements in the array. More...
 
void setAll (float value)
 Set all the elements in the array. More...
 
void setAll (float valueRe, float valueIm)
 Set all the elements in the array. More...
 
void setElement (size_t index, ComplexFloat value)
 Set a single value in the array. More...
 
void setMagnitude (FloatArray magnitude)
 Set the magnitude of the elements of the array, leaving the phase unchanged. More...
 
void setMagnitude (FloatArray magnitude, ComplexFloatArray destination)
 Set the magnitude of the elements of an array, using the phase from the current array. More...
 
void setMagnitude (FloatArray magnitude, int offset, size_t count)
 Set the magnitude of a range of elements of the array, leaving the phase unchanged. More...
 
void setMagnitude (FloatArray magnitude, int offset, size_t count, ComplexFloatArray destination)
 Set the magnitude of a range of the elements of an array, using the phases from the current array. More...
 
void setPhase (FloatArray phase)
 Set the phase of the elements of the array, leaving the magnitude unchanged. More...
 
void setPhase (FloatArray phase, ComplexFloatArray destination)
 Set the phase of the elements of an array, using the magnitude from the current array. More...
 
void setPhase (FloatArray phase, int offset, size_t count)
 Set the phase of a range of elements of the array, leaving the magnitude unchanged. More...
 
void setPhase (FloatArray phase, int offset, size_t count, ComplexFloatArray destination)
 Set the phase of a range of the elements of an array, using the magnitude from the current array. More...
 
void setPolar (FloatArray magnitude, FloatArray phase)
 Set all the elements in the array using polar coordinates. More...
 
void setPolar (FloatArray magnitude, FloatArray phase, int offset, size_t count)
 Set a range of elements in the array using polar coordinates. More...
 
ComplexFloatArray subArray (int offset, size_t length)
 A subset of the array. More...
 
void subtract (ComplexFloatArray operand2)
 In-place element-wise difference between complex arrays. More...
 
void subtract (ComplexFloatArray operand2, ComplexFloatArray destination)
 Element-wise difference between complex arrays. More...
 
void toFloat (FloatArray destination)
 Copies real and imaginary values of the ComplexFloatArray into a FloatArray. More...
 

Static Public Member Functions

static void copy (ComplexFloat *dst, ComplexFloat *src, size_t len)
 Optimised array copy for datatype T. More...
 
static ComplexFloatArray create (size_t size)
 Creates a new ComplexFloatArray. More...
 
static void destroy (ComplexFloatArray)
 Destroys a ComplexFloatArray created with the create() method. More...
 

Protected Attributes

ComplexFloatdata
 
size_t size
 

Detailed Description

Definition at line 205 of file ComplexFloatArray.h.

Constructor & Destructor Documentation

◆ ComplexFloatArray() [1/2]

ComplexFloatArray::ComplexFloatArray ( )
inline

Definition at line 207 of file ComplexFloatArray.h.

Referenced by subArray().

◆ ComplexFloatArray() [2/2]

ComplexFloatArray::ComplexFloatArray ( ComplexFloat data,
size_t  size 
)
inline

Definition at line 208 of file ComplexFloatArray.h.

Member Function Documentation

◆ add() [1/2]

void ComplexFloatArray::add ( ComplexFloatArray  operand2)

In-place element-wise sum between complex arrays.

Adds each element of operand2 to the corresponding element in the array.

Parameters
operand2second operand for the sum

Definition at line 113 of file ComplexFloatArray.cpp.

References add().

◆ add() [2/2]

void ComplexFloatArray::add ( ComplexFloatArray  operand2,
ComplexFloatArray  destination 
)

Element-wise sum between complex arrays.

Sets each element in destination to the complex sum of the corresponding element of the array and operand2

Parameters
[in]operand2second operand for the sum
[out]destinationthe destination array

Definition at line 101 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getData(), SimpleArray< ComplexFloat >::getData(), ComplexFloat::im, im(), ComplexFloat::re, re(), SimpleArray< ComplexFloat >::size, and SimpleArray< T >::size.

Referenced by add().

◆ clear()

void ComplexFloatArray::clear ( )
inline

Definition at line 229 of file ComplexFloatArray.h.

References setAll().

Referenced by create().

◆ complexByComplexMultiplication()

void ComplexFloatArray::complexByComplexMultiplication ( ComplexFloatArray  operand2,
ComplexFloatArray  result 
)

Complex by complex multiplication between arrays.

Parameters
[in]operand2The second operand of the multiplication
[out]resultThe array where the result of the multiplication is stored
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 85 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< T >::getData(), SimpleArray< ComplexFloat >::getData(), SimpleArray< ComplexFloat >::size, and SimpleArray< T >::size.

◆ complexByRealMultiplication()

void ComplexFloatArray::complexByRealMultiplication ( FloatArray  operand2,
ComplexFloatArray  result 
)

Complex by real multiplication between arrays.

Parameters
[in]operand2The second operand of the multiplication
[out]resultThe array where the result of the multiplication is stored
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 148 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< T >::getData(), SimpleArray< ComplexFloat >::getData(), SimpleArray< T >::getSize(), and SimpleArray< ComplexFloat >::size.

◆ complexDotProduct()

void ComplexFloatArray::complexDotProduct ( ComplexFloatArray  operand2,
ComplexFloat result 
)

Complex dot product between arrays.

Parameters
[in]operand2The second operand of the dot product
[out]resultThe array where the result of the dot product is stored
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 67 of file ComplexFloatArray.cpp.

References SimpleArray< T >::getData(), SimpleArray< ComplexFloat >::getData(), ComplexFloat::im, ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

◆ copy()

static void SimpleArray< ComplexFloat >::copy ( ComplexFloat dst,
ComplexFloat src,
size_t  len 
)
inlinestaticinherited

Optimised array copy for datatype T.

Copy four at a time to minimise loop overheads and allow SIMD optimisations. This performs well on external RAM but is slower on internal memory compared to memcpy.

Definition at line 134 of file SimpleArray.h.

◆ copyFrom() [1/2]

void ComplexFloatArray::copyFrom ( FloatArray  real,
FloatArray  imag 
)

Merge two channels of audio containing real and imaginary axis data into this array.

Parameters
[in]realReal axis data
[in]imagImaginary axis data

Definition at line 316 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, and SimpleArray< ComplexFloat >::getSize().

Referenced by ComplexFourierTransform::fft(), and ComplexFourierTransform::ifft().

◆ copyFrom() [2/2]

void SimpleArray< ComplexFloat >::copyFrom ( SimpleArray< ComplexFloat source)
inlineinherited

Copies the content of another array into this array.

This array needs to be at least as big as the other array.

Parameters
[in]sourcethe source array

Definition at line 86 of file SimpleArray.h.

◆ copyTo() [1/2]

void ComplexFloatArray::copyTo ( FloatArray  real,
FloatArray  imag 
)

Split complex data into two channels of audio containing real and imaginary axis data.

Parameters
[in]realReal axis data
[in]imagImaginary axis data

Definition at line 322 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, SimpleArray< ComplexFloat >::getSize(), ComplexFloat::im, and ComplexFloat::re.

◆ copyTo() [2/2]

void SimpleArray< ComplexFloat >::copyTo ( SimpleArray< ComplexFloat destination)
inlineinherited

Copies the content of this array to another array.

The other array needs to be at least as big as this array.

Parameters
[out]destinationthe destination array

Definition at line 76 of file SimpleArray.h.

◆ create()

ComplexFloatArray ComplexFloatArray::create ( size_t  size)
static

Creates a new ComplexFloatArray.

Allocates size*sizeof(float) bytes of memory and returns a ComplexFloatArray that points to it.

Parameters
sizeThe size of the new ComplexFloatArray.
Returns
A ComplexFloatArray which data point to the newly allocated memory and size is initialized to the proper value.
Remarks
A ComplexFloatArray created with this method has to be destroyed invoking the ComplexFloatArray::destroy() method.

Definition at line 306 of file ComplexFloatArray.cpp.

References clear(), and SimpleArray< ComplexFloat >::size.

Referenced by FourierPitchDetector::init(), ComplexFourierTransform::init(), and FastFourierTransform::init().

◆ destroy()

void ComplexFloatArray::destroy ( ComplexFloatArray  array)
static

Destroys a ComplexFloatArray created with the create() method.

Parameters
arrayThe ComplexFloatArray to be destroyed.
Remarks
The ComplexFloatArray object passed as an argument should not be used again after invoking this method.
A ComplexFloatArray object that has not been created by the ComplexFloatArray::create() method might cause an exception if passed as an argument to this method.

Definition at line 312 of file ComplexFloatArray.cpp.

References SimpleArray< T >::data.

Referenced by ComplexFourierTransform::~ComplexFourierTransform(), FastFourierTransform::~FastFourierTransform(), and FourierPitchDetector::~FourierPitchDetector().

◆ equals()

bool SimpleArray< ComplexFloat >::equals ( const SimpleArray< ComplexFloat > &  other) const
inlineinherited

Compares two arrays.

Performs an element-wise comparison of the values contained in the arrays.

Parameters
otherthe array to compare against.
Returns
true if the arrays have the same size and the value of each of the elements of the one match the value of the corresponding element of the other, or false otherwise.

Definition at line 61 of file SimpleArray.h.

◆ fromFloat()

void ComplexFloatArray::fromFloat ( FloatArray  source)

Copies real values from a FloatArray, sets imaginary values to 0.

Parameters
[in]sourceThe source array

Definition at line 218 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getSize(), ComplexFloat::im, ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

◆ getComplexConjugateValues()

void ComplexFloatArray::getComplexConjugateValues ( ComplexFloatArray  destination)

The complex conjugate values of the element of the array.

Parameters
[out]destinationThe array where the complex conjugate values will be stored.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 133 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< T >::getData(), SimpleArray< ComplexFloat >::getData(), SimpleArray< T >::getSize(), and SimpleArray< ComplexFloat >::size.

◆ getData()

ComplexFloat * SimpleArray< ComplexFloat >::getData ( )
inlineinherited

Get the data stored in the Array.

Returns
a T* pointer to the data stored in the Array

Definition at line 27 of file SimpleArray.h.

◆ getElement()

ComplexFloat SimpleArray< ComplexFloat >::getElement ( size_t  index)
inlineinherited

Get a single value stored in the array.

Returns
the value stored at index
Parameters
index

Definition at line 43 of file SimpleArray.h.

◆ getImaginaryValues()

void ComplexFloatArray::getImaginaryValues ( FloatArray  buf)

Get the imaginary part of the elements of the array.

Parameters
[out]bufThe array where the imaginary part will be stored.

Definition at line 200 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::im, and SimpleArray< ComplexFloat >::size.

◆ getMagnitudeSquaredValues()

void ComplexFloatArray::getMagnitudeSquaredValues ( FloatArray  destination)

The squared magnitudes of the elements of the array.

Faster than getMagnitudeValues().

Parameters
[out]destinationThe array where the magnitude squared values will be stored.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 40 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getSize(), mag2(), and SimpleArray< ComplexFloat >::size.

Referenced by FourierPitchDetector::computeFrequency().

◆ getMagnitudeValues()

void ComplexFloatArray::getMagnitudeValues ( FloatArray  destination)

The magnitudes of the elements of the array.

Parameters
[out]destinationThe array where the magnitude values will be stored.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 16 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, mag(), and SimpleArray< ComplexFloat >::size.

◆ getMaxMagnitudeIndex()

int ComplexFloatArray::getMaxMagnitudeIndex ( )

The index of the element with the maximum magnitude in the array.

Returns
The index of the element with the maximum magnitude in the array.

Definition at line 164 of file ComplexFloatArray.cpp.

References mag2(), and SimpleArray< ComplexFloat >::size.

◆ getMaxMagnitudeValue()

float ComplexFloatArray::getMaxMagnitudeValue ( )

The value of the element with the maximum magnitude in the array.

Returns
The maximum magnitude value in the array.

Definition at line 182 of file ComplexFloatArray.cpp.

References mag(), mag2(), and SimpleArray< ComplexFloat >::size.

◆ getPhaseValues()

void ComplexFloatArray::getPhaseValues ( FloatArray  destination)

The phases of the elements of the array.

Parameters
[out]destinationThe array where the phase values will be stored.

Definition at line 61 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getSize(), and SimpleArray< ComplexFloat >::size.

◆ getPolar()

void ComplexFloatArray::getPolar ( FloatArray  magnitude,
FloatArray  phase 
)

Get polar coordinates for all the elements in the array.

Parameters
[out]magnitudeAn array containing the magnitudes.
[out]phaseAn array containing the phases.

Definition at line 52 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, ComplexFloat::getMagnitude(), ComplexFloat::getPhase(), SimpleArray< T >::getSize(), and SimpleArray< ComplexFloat >::size.

◆ getRealValues()

void ComplexFloatArray::getRealValues ( FloatArray  buf)

Get the real part of the elements of the array.

Parameters
[out]bufThe array where the real part will be stored.

Definition at line 194 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

◆ getSize()

size_t SimpleArray< ComplexFloat >::getSize ( ) const
inlineinherited

Definition at line 31 of file SimpleArray.h.

◆ im()

float ComplexFloatArray::im ( const int  i)
inline

Get the imaginary part of an element of the array.

Parameters
iThe index of the element
Returns
The imaginary part of the element

Definition at line 225 of file ComplexFloatArray.h.

References SimpleArray< ComplexFloat >::data, and ComplexFloat::im.

Referenced by add(), FastFourierTransform::fft(), QuadratureSineOscillator::generate(), FeedbackQuadratureSineOscillator::generate(), ComplexFeedbackQuadratureSineOscillator::generate(), mag2(), and subtract().

◆ insert() [1/2]

void SimpleArray< ComplexFloat >::insert ( SimpleArray< ComplexFloat source,
int  destinationOffset,
size_t  len 
)
inlineinherited

Copies the content of an array into a subset of the array.

Copies len elements from source to destinationOffset in the current array.

Parameters
[in]sourcethe source array
[in]destinationOffsetthe offset into the destination array
[in]lenthe number of samples to copy

Definition at line 99 of file SimpleArray.h.

◆ insert() [2/2]

void SimpleArray< ComplexFloat >::insert ( SimpleArray< ComplexFloat source,
int  sourceOffset,
int  destinationOffset,
size_t  len 
)
inlineinherited

Copies the content of an array into a subset of the array.

Copies len elements starting from sourceOffset of source to destinationOffset in the current array.

Parameters
[in]sourcethe source array
[in]sourceOffsetthe offset into the source array
[in]destinationOffsetthe offset into the destination array
[in]lenthe number of samples to copy

Definition at line 111 of file SimpleArray.h.

◆ isEmpty()

bool SimpleArray< ComplexFloat >::isEmpty ( ) const
inlineinherited

Definition at line 35 of file SimpleArray.h.

◆ mag()

float ComplexFloatArray::mag ( const int  i)

Get the magnitude of an element of the array.

Parameters
iThe index of the element
Returns
The magnitude of the element
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 5 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, and mag2().

Referenced by getMagnitudeValues(), and getMaxMagnitudeValue().

◆ mag2()

float ComplexFloatArray::mag2 ( const int  i)

The magnitude squared of an element of the array.

Faster than mag().

Parameters
iThe index of the element
Returns
The magnitude squared of the element
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 27 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::im, im(), ComplexFloat::re, and re().

Referenced by getMagnitudeSquaredValues(), getMaxMagnitudeIndex(), getMaxMagnitudeValue(), and mag().

◆ move()

void SimpleArray< ComplexFloat >::move ( int  fromIndex,
int  toIndex,
size_t  len 
)
inlineinherited

Copies values within an array.

Copies length values starting from index fromIndex to locations starting with index toIndex

Parameters
[in]fromIndexthe first element to copy
[in]toIndexthe destination of the first element
[in]lenthe number of elements to copy

Definition at line 124 of file SimpleArray.h.

◆ operator ComplexFloat *()

SimpleArray< ComplexFloat >::operator ComplexFloat * ( )
inlineinherited

Casting operator to T*.

Returns
a T* pointer to the data stored in the Array

Definition at line 157 of file SimpleArray.h.

◆ re()

float ComplexFloatArray::re ( const int  i)
inline

Get the real part of an element of the array.


Parameters
iThe index of the element
Returns
The real part of the element

Definition at line 216 of file ComplexFloatArray.h.

References SimpleArray< ComplexFloat >::data, and ComplexFloat::re.

Referenced by add(), FastFourierTransform::fft(), QuadratureSineOscillator::generate(), FeedbackQuadratureSineOscillator::generate(), ComplexFeedbackQuadratureSineOscillator::generate(), FastFourierTransform::ifft(), mag2(), and subtract().

◆ scale()

void ComplexFloatArray::scale ( float  factor)

Array by scalar multiplication.

Parameters
factorThe value by which all the elements of the array are multiplied.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 206 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::im, ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

Referenced by ComplexFourierTransform::ifft().

◆ setAll() [1/3]

void ComplexFloatArray::setAll ( ComplexFloat  value)

Set all the elements in the array.

Parameters
[in]valueAll the elements are set to this value.

Definition at line 247 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::im, ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

Referenced by clear(), and setAll().

◆ setAll() [2/3]

void ComplexFloatArray::setAll ( float  value)

Set all the elements in the array.

Parameters
[in]valueThe real and imaginary parts of all the elements in the array are set to this value.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 235 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, ComplexFloat::im, ComplexFloat::re, setAll(), and SimpleArray< ComplexFloat >::size.

◆ setAll() [3/3]

void ComplexFloatArray::setAll ( float  valueRe,
float  valueIm 
)

Set all the elements in the array.

Parameters
[in]valueReThe real part of every element of the the array will be set to this value.
[in]valueImThe imaginary pary of rvery element of the the array will be set to this value.

Definition at line 254 of file ComplexFloatArray.cpp.

References ComplexFloat::im, ComplexFloat::re, and setAll().

◆ setElement()

void SimpleArray< ComplexFloat >::setElement ( size_t  index,
ComplexFloat  value 
)
inlineinherited

Set a single value in the array.

Definition at line 50 of file SimpleArray.h.

◆ setMagnitude() [1/4]

void ComplexFloatArray::setMagnitude ( FloatArray  magnitude)

Set the magnitude of the elements of the array, leaving the phase unchanged.

Parameters
[in]magnitudeAn array containing the magnitudes.

Definition at line 287 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::size.

Referenced by setMagnitude().

◆ setMagnitude() [2/4]

void ComplexFloatArray::setMagnitude ( FloatArray  magnitude,
ComplexFloatArray  destination 
)

Set the magnitude of the elements of an array, using the phase from the current array.

Parameters
[in]magnitudeAn array containing the magnitudes.
[out]destinationThe destination array.

Definition at line 293 of file ComplexFloatArray.cpp.

References setMagnitude(), and SimpleArray< ComplexFloat >::size.

◆ setMagnitude() [3/4]

void ComplexFloatArray::setMagnitude ( FloatArray  magnitude,
int  offset,
size_t  count 
)

Set the magnitude of a range of elements of the array, leaving the phase unchanged.

Parameters
[in]magnitudeAn array containing the magnitudes.
[in]offsetFirst element to set
[in]countNumber of elements to set

Definition at line 290 of file ComplexFloatArray.cpp.

References setMagnitude().

◆ setMagnitude() [4/4]

void ComplexFloatArray::setMagnitude ( FloatArray  magnitude,
int  offset,
size_t  count,
ComplexFloatArray  destination 
)

Set the magnitude of a range of the elements of an array, using the phases from the current array.

The offset and count specified apply to both the source and destination arrays. Elements of the destination array outside this range will not be affected.

Parameters
[in]magnitudeAn array containing the magnitudes.
[in]offsetFirst element to set
[in]countNumber of elements to set
[out]destinationThe destination array.

Definition at line 296 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::getData(), SimpleArray< T >::getData(), SimpleArray< T >::getSize(), SimpleArray< ComplexFloat >::getSize(), and ComplexFloat::setPolar().

◆ setPhase() [1/4]

void ComplexFloatArray::setPhase ( FloatArray  phase)

Set the phase of the elements of the array, leaving the magnitude unchanged.

Parameters
[in]phaseAn array containing the phases.

Definition at line 270 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::size.

Referenced by setPhase().

◆ setPhase() [2/4]

void ComplexFloatArray::setPhase ( FloatArray  phase,
ComplexFloatArray  destination 
)

Set the phase of the elements of an array, using the magnitude from the current array.

Parameters
[in]phaseAn array containing the phases.
[out]destinationThe destination array.

Definition at line 278 of file ComplexFloatArray.cpp.

References setPhase(), and SimpleArray< ComplexFloat >::size.

◆ setPhase() [3/4]

void ComplexFloatArray::setPhase ( FloatArray  phase,
int  offset,
size_t  count 
)

Set the phase of a range of elements of the array, leaving the magnitude unchanged.

Parameters
[in]phaseAn array containing the phases.
[in]offsetFirst element to set
[in]countNumber of elements to set

Definition at line 273 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, and ComplexFloat::setPhase().

◆ setPhase() [4/4]

void ComplexFloatArray::setPhase ( FloatArray  phase,
int  offset,
size_t  count,
ComplexFloatArray  destination 
)

Set the phase of a range of the elements of an array, using the magnitude from the current array.

The offset and count specified apply to both the source and destination arrays. Elements of the destination array outside this range will not be affected.

Parameters
[in]phaseAn array containing the phases.
[in]offsetFirst element to set
[in]countNumber of elements to set
[out]destinationThe destination array.

Definition at line 281 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::getData(), SimpleArray< T >::getData(), SimpleArray< T >::getSize(), and ComplexFloat::setPolar().

◆ setPolar() [1/2]

void ComplexFloatArray::setPolar ( FloatArray  magnitude,
FloatArray  phase 
)

Set all the elements in the array using polar coordinates.

Parameters
[in]magnitudeAn array containing the magnitudes.
[in]phaseAn array containing the phases.

Definition at line 261 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::size.

◆ setPolar() [2/2]

void ComplexFloatArray::setPolar ( FloatArray  magnitude,
FloatArray  phase,
int  offset,
size_t  count 
)

Set a range of elements in the array using polar coordinates.

Parameters
[in]magnitudeAn array containing the magnitudes.
[in]phaseAn array containing the phases.
[in]offsetFirst element to set
[in]countNumber of elements to set

Definition at line 264 of file ComplexFloatArray.cpp.

References SimpleArray< ComplexFloat >::data, and ComplexFloat::setPolar().

◆ subArray()

ComplexFloatArray ComplexFloatArray::subArray ( int  offset,
size_t  length 
)

A subset of the array.

Returns an array that points to subset of the memory used by the original array.

Parameters
[in]offsetthe first element of the subset.
[in]lengththe number of elments in the new ComplexFloatArray.
Returns
the newly created ComplexFloatArray.
Remarks
no memory is allocated by this method. The memory is still shared with the original array. The memory should not be de-allocated elsewhere (e.g.: by calling ComplexFloatArray::destroy() on the original ComplexFloatArray) as long as the ComplexFloatArray returned by this method is still in use.
Calling ComplexFloatArray::destroy() on a ComplexFloatArray instance created with this method might cause an exception.

Definition at line 177 of file ComplexFloatArray.cpp.

References ASSERT, ComplexFloatArray(), SimpleArray< ComplexFloat >::data, and SimpleArray< ComplexFloat >::size.

Referenced by FourierPitchDetector::computeFrequency().

◆ subtract() [1/2]

void ComplexFloatArray::subtract ( ComplexFloatArray  operand2)

In-place element-wise difference between complex arrays.

Sutracts each element of operand2 from the corresponding element in the array.

Parameters
operand2second operand for the sum

Definition at line 129 of file ComplexFloatArray.cpp.

References subtract().

◆ subtract() [2/2]

void ComplexFloatArray::subtract ( ComplexFloatArray  operand2,
ComplexFloatArray  destination 
)

Element-wise difference between complex arrays.

Sets each element in destination to the complex difference between the corresponding element of the array and operand2

Parameters
[in]operand2second operand for the subtraction
[out]destinationthe destination array

Definition at line 117 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getData(), ComplexFloat::im, im(), ComplexFloat::re, re(), SimpleArray< ComplexFloat >::size, and SimpleArray< T >::size.

Referenced by subtract().

◆ toFloat()

void ComplexFloatArray::toFloat ( FloatArray  destination)

Copies real and imaginary values of the ComplexFloatArray into a FloatArray.

Parameters
[out]destinationThe destination array
Remarks
The size of the FloatArray must be twice the size of the ComplexFloatArray.

Definition at line 227 of file ComplexFloatArray.cpp.

References ASSERT, SimpleArray< ComplexFloat >::data, SimpleArray< T >::getSize(), ComplexFloat::re, and SimpleArray< ComplexFloat >::size.

Field Documentation

◆ data

ComplexFloat * SimpleArray< ComplexFloat >::data
protectedinherited

Definition at line 16 of file SimpleArray.h.

◆ size

size_t SimpleArray< ComplexFloat >::size
protectedinherited

Definition at line 17 of file SimpleArray.h.


The documentation for this class was generated from the following files: