OpenWareLaboratory
|
Public Member Functions | |
void | add (ComplexShortArray operand2) |
In-place element-wise sum between complex arrays. More... | |
void | add (ComplexShortArray operand2, ComplexShortArray destination) |
Element-wise sum between complex arrays. More... | |
void | clear () |
void | complexByComplexMultiplication (ComplexShortArray operand2, ComplexShortArray result) |
Complex by complex multiplication between arrays. More... | |
void | complexByRealMultiplication (ShortArray operand2, ComplexShortArray result) |
Complex by real multiplication between arrays. More... | |
void | complexDotProduct (ComplexShortArray operand2, ComplexShort &result) |
Complex dot product between arrays. More... | |
ComplexShortArray () | |
ComplexShortArray (ComplexShort *data, size_t size) | |
void | copyFrom (SimpleArray< ComplexShort > source) |
Copies the content of another array into this array. More... | |
void | copyTo (SimpleArray< ComplexShort > destination) |
Copies the content of this array to another array. More... | |
bool | equals (const SimpleArray< ComplexShort > &other) const |
Compares two arrays. More... | |
void | getComplexConjugateValues (ComplexShortArray destination) |
The complex conjugate values of the element of the array. More... | |
ComplexShort * | getData () |
Get the data stored in the Array. More... | |
ComplexShort | getElement (size_t index) |
Get a single value stored in the array. More... | |
void | getImaginaryValues (ShortArray buf) |
Get the imaginary part of the elements of the array. More... | |
void | getMagnitudeSquaredValues (ShortArray destination) |
The squared magnitudes of the elements of the array. More... | |
void | getMagnitudeValues (ShortArray destination) |
The magnitudes of the elements of the array. More... | |
unsigned int | getMaxMagnitudeIndex () |
The index of the element with the maximum magnitude in the array. More... | |
int16_t | getMaxMagnitudeValue () |
The value of the element with the maximum magnitude in the array. More... | |
void | getRealValues (ShortArray buf) |
Get the real part of the elements of the array. More... | |
size_t | getSize () const |
int16_t | im (const int i) |
The imaginary part of an element of the array. More... | |
void | insert (SimpleArray< ComplexShort > source, int destinationOffset, size_t len) |
Copies the content of an array into a subset of the array. More... | |
void | insert (SimpleArray< ComplexShort > source, int sourceOffset, int destinationOffset, size_t len) |
Copies the content of an array into a subset of the array. More... | |
bool | isEmpty () const |
int16_t | mag (const int i) |
The magnitude of an element of the array. More... | |
int16_t | 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 ComplexShort * () | |
Casting operator to T*. More... | |
int16_t | re (const int i) |
The real part of an element of the array. More... | |
void | scale (int16_t factor) |
Array by scalar multiplication. More... | |
void | setAll (ComplexShort value) |
Set all the elements in the array. More... | |
void | setAll (int16_t value) |
Set all the elements in the array. More... | |
void | setAll (int16_t valueRe, int16_t valueIm) |
Set all the elements in the array. More... | |
void | setElement (size_t index, ComplexShort value) |
Set a single value in the array. More... | |
void | setMagnitude (ShortArray magnitude) |
Set the magnitude of the elements of the array, leaving the phase unchanged. More... | |
void | setMagnitude (ShortArray magnitude, ComplexShortArray destination) |
Set the magnitude of the elements of an array, using the phase from the current array. More... | |
void | setMagnitude (ShortArray magnitude, int offset, int count) |
Set the magnitude of a range of elements of the array, leaving the phase unchanged. More... | |
void | setMagnitude (ShortArray magnitude, int offset, int count, ComplexShortArray destination) |
Set the magnitude of a range of the elements of an array, using the phases from the current array. More... | |
void | setPhase (ShortArray phase) |
Set the phase of the elements of the array, leaving the magnitude unchanged. More... | |
void | setPhase (ShortArray phase, ComplexShortArray destination) |
Set the phase of the elements of an array, using the magnitude from the current array. More... | |
void | setPhase (ShortArray phase, int offset, int count) |
Set the phase of a range of elements of the array, leaving the magnitude unchanged. More... | |
void | setPhase (ShortArray phase, int offset, int count, ComplexShortArray destination) |
Set the phase of a range of the elements of an array, using the magnitude from the current array. More... | |
void | setPolar (ShortArray magnitude, ShortArray phase) |
Set all the elements in the array using polar coordinates. More... | |
void | setPolar (ShortArray magnitude, ShortArray phase, int offset, int count) |
Set a range of elements in the array using polar coordinates. More... | |
ComplexShortArray | subArray (unsigned int offset, unsigned int length) |
A subset of the array. More... | |
void | subtract (ComplexShortArray operand2) |
In-place element-wise difference between complex arrays. More... | |
void | subtract (ComplexShortArray operand2, ComplexShortArray destination) |
Element-wise difference between complex arrays. More... | |
Static Public Member Functions | |
static void | copy (ComplexShort *dst, ComplexShort *src, size_t len) |
Optimised array copy for datatype T. More... | |
static ComplexShortArray | create (unsigned int size) |
Creates a new ComplexShortArray. More... | |
static void | destroy (ComplexShortArray) |
Destroys a ComplexShortArray created with the create() method. More... | |
Protected Attributes | |
ComplexShort * | data |
size_t | size |
Definition at line 70 of file ComplexShortArray.h.
|
inline |
Definition at line 72 of file ComplexShortArray.h.
|
inline |
Definition at line 73 of file ComplexShortArray.h.
void ComplexShortArray::add | ( | ComplexShortArray | operand2 | ) |
In-place element-wise sum between complex arrays.
Adds each element of operand2 to the corresponding element in the array.
operand2 | second operand for the sum |
void ComplexShortArray::add | ( | ComplexShortArray | operand2, |
ComplexShortArray | 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
[in] | operand2 | second operand for the sum |
[out] | destination | the destination array |
Definition at line 151 of file ComplexShortArray.cpp.
References SimpleArray< T >::data, SimpleArray< ComplexShort >::data, ComplexShort::im, im(), ComplexShort::re, re(), and SimpleArray< ComplexShort >::size.
|
inline |
void ComplexShortArray::complexByComplexMultiplication | ( | ComplexShortArray | operand2, |
ComplexShortArray | result | ||
) |
Complex by complex multiplication between arrays.
[in] | operand2 | The second operand of the multiplication |
[out] | result | The array where the result of the multiplication is stored |
Definition at line 109 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, SimpleArray< T >::getData(), SimpleArray< ComplexShort >::getData(), Q15_MUL_Q15, and SimpleArray< ComplexShort >::size.
void ComplexShortArray::complexByRealMultiplication | ( | ShortArray | operand2, |
ComplexShortArray | result | ||
) |
Complex by real multiplication between arrays.
[in] | operand2 | The second operand of the multiplication |
[out] | result | The array where the result of the multiplication is stored |
void ComplexShortArray::complexDotProduct | ( | ComplexShortArray | operand2, |
ComplexShort & | result | ||
) |
Complex dot product between arrays.
[in] | operand2 | The second operand of the dot product |
[out] | result | The array where the result of the dot product is stored |
|
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.
|
inlineinherited |
Copies the content of another array into this array.
This array needs to be at least as big as the other array.
[in] | source | the source array |
Definition at line 86 of file SimpleArray.h.
|
inlineinherited |
Copies the content of this array to another array.
The other array needs to be at least as big as this array.
[out] | destination | the destination array |
Definition at line 76 of file SimpleArray.h.
|
static |
Creates a new ComplexShortArray.
Allocates size*sizeof(int16_t) bytes of memory and returns a ComplexShortArray that points to it.
size | The size of the new ComplexShortArray. |
size
is initialized to the proper value. Definition at line 163 of file ComplexShortArray.cpp.
References clear(), and SimpleArray< ComplexShort >::size.
Referenced by ShortFastFourierTransform::init().
|
static |
Destroys a ComplexShortArray created with the create() method.
array | The ComplexShortArray to be destroyed. |
Definition at line 169 of file ComplexShortArray.cpp.
References SimpleArray< T >::data.
Referenced by ShortFastFourierTransform::~ShortFastFourierTransform().
|
inlineinherited |
Compares two arrays.
Performs an element-wise comparison of the values contained in the arrays.
other | the array to compare against. |
Definition at line 61 of file SimpleArray.h.
void ComplexShortArray::getComplexConjugateValues | ( | ComplexShortArray | destination | ) |
The complex conjugate values of the element of the array.
[out] | destination | The array where the complex conjugate values will be stored. |
|
inlineinherited |
Get the data stored in the Array.
Definition at line 27 of file SimpleArray.h.
|
inlineinherited |
Get a single value stored in the array.
index |
Definition at line 43 of file SimpleArray.h.
void ComplexShortArray::getImaginaryValues | ( | ShortArray | buf | ) |
Get the imaginary part of the elements of the array.
[out] | buf | The array where the imaginary part will be stored. |
void ComplexShortArray::getMagnitudeSquaredValues | ( | ShortArray | destination | ) |
The squared magnitudes of the elements of the array.
[out] | destination | The array where the magnitude squared values will be stored. |
Definition at line 74 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, SimpleArray< T >::getSize(), mag2(), and SimpleArray< ComplexShort >::size.
void ComplexShortArray::getMagnitudeValues | ( | ShortArray | destination | ) |
The magnitudes of the elements of the array.
[out] | destination | The array where the magnitude values will be stored. |
Definition at line 45 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, mag(), ShortArray::shift(), and SimpleArray< ComplexShort >::size.
unsigned int ComplexShortArray::getMaxMagnitudeIndex | ( | ) |
The index of the element with the maximum magnitude in the array.
int16_t ComplexShortArray::getMaxMagnitudeValue | ( | ) |
The value of the element with the maximum magnitude in the array.
void ComplexShortArray::getRealValues | ( | ShortArray | buf | ) |
Get the real part of the elements of the array.
[out] | buf | The array where the real part will be stored. |
|
inlineinherited |
Definition at line 31 of file SimpleArray.h.
|
inline |
The imaginary part of an element of the array.
i | The index of the element |
Definition at line 91 of file ComplexShortArray.h.
References SimpleArray< ComplexShort >::data, and ComplexShort::im.
Referenced by add(), ShortFastFourierTransform::fft(), and mag2().
|
inlineinherited |
Copies the content of an array into a subset of the array.
Copies len elements from source to destinationOffset in the current array.
[in] | source | the source array |
[in] | destinationOffset | the offset into the destination array |
[in] | len | the number of samples to copy |
Definition at line 99 of file SimpleArray.h.
|
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.
[in] | source | the source array |
[in] | sourceOffset | the offset into the source array |
[in] | destinationOffset | the offset into the destination array |
[in] | len | the number of samples to copy |
Definition at line 111 of file SimpleArray.h.
|
inlineinherited |
Definition at line 35 of file SimpleArray.h.
int16_t ComplexShortArray::mag | ( | const int | i | ) |
The magnitude of an element of the array.
i | The index of the element |
Definition at line 34 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, FLOAT_TO_Q15, mag2(), and Q15_TO_FLOAT.
Referenced by getMagnitudeValues().
int16_t ComplexShortArray::mag2 | ( | const int | i | ) |
The magnitude squared of an element of the array.
i | The index of the element |
Definition at line 58 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, FLOAT_TO_Q15, im(), Q15_TO_FLOAT, and re().
Referenced by getMagnitudeSquaredValues(), and mag().
|
inlineinherited |
Copies values within an array.
Copies length values starting from index fromIndex to locations starting with index toIndex
[in] | fromIndex | the first element to copy |
[in] | toIndex | the destination of the first element |
[in] | len | the number of elements to copy |
Definition at line 124 of file SimpleArray.h.
|
inlineinherited |
Casting operator to T*.
Definition at line 157 of file SimpleArray.h.
|
inline |
The real part of an element of the array.
i | The index of the element |
Definition at line 82 of file ComplexShortArray.h.
References SimpleArray< ComplexShort >::data, and ComplexShort::re.
Referenced by add(), ShortFastFourierTransform::fft(), ShortFastFourierTransform::ifft(), and mag2().
void ComplexShortArray::scale | ( | int16_t | factor | ) |
Array by scalar multiplication.
factor | The value by which all the elements of the array are multiplied. |
void ComplexShortArray::setAll | ( | ComplexShort | value | ) |
Set all the elements in the array.
[in] | value | All the elements are set to this value. |
Definition at line 139 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, ComplexShort::im, ComplexShort::re, and SimpleArray< ComplexShort >::size.
void ComplexShortArray::setAll | ( | int16_t | value | ) |
Set all the elements in the array.
[in] | value | The real and imaginary parts of all the elements in the array are set to this value. |
Definition at line 127 of file ComplexShortArray.cpp.
References SimpleArray< ComplexShort >::data, ComplexShort::im, ComplexShort::re, setAll(), and SimpleArray< ComplexShort >::size.
void ComplexShortArray::setAll | ( | int16_t | valueRe, |
int16_t | valueIm | ||
) |
Set all the elements in the array.
[in] | valueRe | The real part of every element of the the array will be set to this value. |
[in] | valueIm | The imaginary pary of rvery element of the the array will be set to this value. |
Definition at line 146 of file ComplexShortArray.cpp.
References setAll().
|
inlineinherited |
Set a single value in the array.
Definition at line 50 of file SimpleArray.h.
void ComplexShortArray::setMagnitude | ( | ShortArray | magnitude | ) |
Set the magnitude of the elements of the array, leaving the phase unchanged.
[in] | magnitude | An array containing the magnitudes. |
void ComplexShortArray::setMagnitude | ( | ShortArray | magnitude, |
ComplexShortArray | destination | ||
) |
Set the magnitude of the elements of an array, using the phase from the current array.
[in] | magnitude | An array containing the magnitudes. |
[out] | destination | The destination array. |
void ComplexShortArray::setMagnitude | ( | ShortArray | magnitude, |
int | offset, | ||
int | count | ||
) |
Set the magnitude of a range of elements of the array, leaving the phase unchanged.
[in] | magnitude | An array containing the magnitudes. |
[in] | offset | First element to set |
[in] | count | Number of elements to set |
void ComplexShortArray::setMagnitude | ( | ShortArray | magnitude, |
int | offset, | ||
int | count, | ||
ComplexShortArray | 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.
[in] | magnitude | An array containing the magnitudes. |
[in] | offset | First element to set |
[in] | count | Number of elements to set |
[out] | destination | The destination array. |
void ComplexShortArray::setPhase | ( | ShortArray | phase | ) |
Set the phase of the elements of the array, leaving the magnitude unchanged.
[in] | phase | An array containing the phases. |
void ComplexShortArray::setPhase | ( | ShortArray | phase, |
ComplexShortArray | destination | ||
) |
Set the phase of the elements of an array, using the magnitude from the current array.
[in] | phase | An array containing the phases. |
[out] | destination | The destination array. |
void ComplexShortArray::setPhase | ( | ShortArray | phase, |
int | offset, | ||
int | count | ||
) |
Set the phase of a range of elements of the array, leaving the magnitude unchanged.
[in] | phase | An array containing the phases. |
[in] | offset | First element to set |
[in] | count | Number of elements to set |
void ComplexShortArray::setPhase | ( | ShortArray | phase, |
int | offset, | ||
int | count, | ||
ComplexShortArray | 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.
[in] | phase | An array containing the phases. |
[in] | offset | First element to set |
[in] | count | Number of elements to set |
[out] | destination | The destination array. |
void ComplexShortArray::setPolar | ( | ShortArray | magnitude, |
ShortArray | phase | ||
) |
Set all the elements in the array using polar coordinates.
[in] | magnitude | An array containing the magnitudes. |
[in] | phase | An array containing the phases. |
void ComplexShortArray::setPolar | ( | ShortArray | magnitude, |
ShortArray | phase, | ||
int | offset, | ||
int | count | ||
) |
Set a range of elements in the array using polar coordinates.
[in] | magnitude | An array containing the magnitudes. |
[in] | phase | An array containing the phases. |
[in] | offset | First element to set |
[in] | count | Number of elements to set |
ComplexShortArray ComplexShortArray::subArray | ( | unsigned int | offset, |
unsigned int | length | ||
) |
A subset of the array.
Returns an array that points to subset of the memory used by the original array.
[in] | offset | the first element of the subset. |
[in] | length | the number of elments in the new ComplexShortArray. |
void ComplexShortArray::subtract | ( | ComplexShortArray | operand2 | ) |
In-place element-wise difference between complex arrays.
Sutracts each element of operand2 from the corresponding element in the array.
operand2 | second operand for the sum |
void ComplexShortArray::subtract | ( | ComplexShortArray | operand2, |
ComplexShortArray | 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
[in] | operand2 | second operand for the subtraction |
[out] | destination | the destination array |
|
protectedinherited |
Definition at line 16 of file SimpleArray.h.
|
protectedinherited |
Definition at line 17 of file SimpleArray.h.