OpenWareLaboratory
ShortArray Class Reference

This class contains useful methods for manipulating arrays of int16_ts. More...

Inheritance diagram for ShortArray:
Collaboration diagram for ShortArray:

Public Member Functions

void add (int16_t scalar)
 Array-scalar sum. More...
 
void add (ShortArray operand2)
 Element-wise sum between arrays. More...
 
void add (ShortArray operand2, ShortArray destination)
 Element-wise sum between arrays. More...
 
void clear ()
 Clear the array. More...
 
void clip (int16_t min, int16_t max)
 Clips the elements in the array in the range [min, max]. More...
 
void clip (int16_t range)
 Clips the elements in the array in the range [-**range**, range]. More...
 
void convolve (ShortArray operand2, ShortArray destination)
 Convolution between arrays. More...
 
void convolve (ShortArray operand2, ShortArray destination, int offset, size_t samples)
 Partial convolution between arrays. More...
 
void copyFrom (SimpleArray< int16_t > source)
 Copies the content of another array into this array. More...
 
void copyTo (SimpleArray< int16_t > destination)
 Copies the content of this array to another array. More...
 
void correlate (ShortArray operand2, ShortArray destination)
 Correlation between arrays. More...
 
void correlateInitialized (ShortArray operand2, ShortArray destination)
 Correlation between arrays. More...
 
bool equals (const SimpleArray< int16_t > &other) const
 Compares two arrays. More...
 
void fromFloat (FloatArray source)
 Copies the content of a FloatArray into a ShortArray, converting the float elements to fixed-point 1.15. More...
 
int16_t * getData ()
 Get the data stored in the Array. More...
 
int16_t getDb ()
 
int16_t getElement (size_t index)
 Get a single value stored in the array. More...
 
float getFloatValue (uint32_t n)
 Returns an element of the array converted to float. More...
 
void getMax (int16_t *value, int *index)
 Get the maximum value in the array and its index. More...
 
int getMaxIndex ()
 Get the index of the maximum value in the array. More...
 
int16_t getMaxValue ()
 Get the maximum value in the array. More...
 
int16_t getMean ()
 Mean of the array. More...
 
void getMin (int16_t *value, int *index)
 Get the minimum value in the array and its index. More...
 
int getMinIndex ()
 Get the index of the minimum value in the array. More...
 
int16_t getMinValue ()
 Get the minimum value in the array. More...
 
int64_t getPower ()
 Power of the array. More...
 
int16_t getRms ()
 Root mean square value of the array. More...
 
size_t getSize () const
 
int16_t getStandardDeviation ()
 Standard deviation of the array. More...
 
int16_t getVariance ()
 Variance of the array. More...
 
void insert (ShortArray source, int destinationOffset, size_t samples)
 Copies the content of an array into a subset of the array. More...
 
void insert (ShortArray source, int sourceOffset, int destinationOffset, size_t samples)
 Copies the content of an array into a subset of the array. More...
 
void insert (SimpleArray< int16_t > source, int destinationOffset, size_t len)
 Copies the content of an array into a subset of the array. More...
 
void insert (SimpleArray< int16_t > source, int sourceOffset, int destinationOffset, size_t len)
 Copies the content of an array into a subset of the array. More...
 
bool isEmpty () const
 
void move (int fromIndex, int toIndex, size_t length)
 Copies values within an array. More...
 
void multiply (int16_t scalar)
 Array-scalar multiplication. More...
 
void multiply (ShortArray operand2)
 Element-wise multiplication between arrays. More...
 
void multiply (ShortArray operand2, ShortArray destination)
 Element-wise multiplication between arrays. More...
 
void negate ()
 Negate the array. More...
 
void negate (ShortArray &destination)
 Negate the array. More...
 
void noise ()
 Random values Fills the array with random values in the range [-1, 1) More...
 
void noise (int16_t min, int16_t max)
 Random values in range. More...
 
 operator int16_t * ()
 Casting operator to T*. More...
 
void reciprocal ()
 Reciprocal of the array. More...
 
void reciprocal (ShortArray &destination)
 Reciprocal of the array. More...
 
void rectify ()
 Absolute value of the array. More...
 
void rectify (ShortArray &destination)
 Absolute value of the array. More...
 
void reverse ()
 Reverse the array. More...
 
void reverse (ShortArray &destination)
 Reverse the array Copies the elements of the array in reversed order into destination. More...
 
void setAll (int16_t value)
 Set all the values in the array. More...
 
void setElement (size_t index, int16_t value)
 Set a single value in the array. More...
 
void setFloatValue (uint32_t n, float value)
 Converts a float to int16 and stores it. More...
 
void shift (int shiftValue)
 Bitshift the array values, saturating. More...
 
 ShortArray ()
 
 ShortArray (int16_t *data, size_t size)
 
ShortArray subArray (int offset, size_t length)
 A subset of the array. More...
 
void subtract (int16_t scalar)
 Array-scalar subtraction. More...
 
void subtract (ShortArray operand2)
 Element-wise difference between arrays. More...
 
void subtract (ShortArray operand2, ShortArray destination)
 Element-wise difference between arrays. More...
 
void toFloat (FloatArray destination)
 Copies the content of the array to a FloatArray, interpreting the content of the ShortArray as 1.15. More...
 

Static Public Member Functions

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

Protected Attributes

int16_t * data
 
size_t size
 

Detailed Description

This class contains useful methods for manipulating arrays of int16_ts.

It also provides a convenient handle to the array pointer and the size of the array. ShortArray objects can be passed by value without copying the contents of the array.

Definition at line 12 of file ShortArray.h.

Constructor & Destructor Documentation

◆ ShortArray() [1/2]

ShortArray::ShortArray ( )
inline

Definition at line 14 of file ShortArray.h.

Referenced by subArray().

◆ ShortArray() [2/2]

ShortArray::ShortArray ( int16_t *  data,
size_t  size 
)
inline

Definition at line 15 of file ShortArray.h.

Member Function Documentation

◆ add() [1/3]

void ShortArray::add ( int16_t  scalar)

Array-scalar sum.

Adds scalar to the values in the array.

Parameters
scalarvalue to be added to the array

Definition at line 264 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

◆ add() [2/3]

void ShortArray::add ( ShortArray  operand2)

Element-wise sum between arrays.

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

Parameters
operand2second operand for the sum
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 259 of file ShortArray.cpp.

References add().

◆ add() [3/3]

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

Element-wise sum between arrays.

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

Parameters
[in]operand2second operand for the sum
[out]destinationthe destination array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 242 of file ShortArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< int16_t >::data, saturateTo16(), SimpleArray< int16_t >::size, and SimpleArray< T >::size.

Referenced by add().

◆ clear()

void ShortArray::clear ( )
inline

Clear the array.

Set all the values in the array to 0.

Definition at line 22 of file ShortArray.h.

References setAll().

Referenced by create().

◆ clip() [1/2]

void ShortArray::clip ( int16_t  min,
int16_t  max 
)

Clips the elements in the array in the range [min, max].

Parameters
minminimum value
maxmaximum value

Definition at line 217 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, max, min, and SimpleArray< int16_t >::size.

◆ clip() [2/2]

void ShortArray::clip ( int16_t  range)

Clips the elements in the array in the range [-**range**, range].

Parameters
rangeclipping value.

Definition at line 208 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, max, and SimpleArray< int16_t >::size.

◆ convolve() [1/2]

void ShortArray::convolve ( ShortArray  operand2,
ShortArray  destination 
)

Convolution between arrays.

Sets destination to the result of the convolution between the array and operand2

Parameters
[in]operand2the second operand for the convolution
[out]destinationarray. It must have a minimum size of this+other-1.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 464 of file ShortArray.cpp.

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

Referenced by correlateInitialized().

◆ convolve() [2/2]

void ShortArray::convolve ( ShortArray  operand2,
ShortArray  destination,
int  offset,
size_t  samples 
)

Partial convolution between arrays.

Perform partial convolution: start at offset and compute samples values.

Parameters
[in]operand2the second operand for the convolution.
[out]destinationthe destination array.
[in]offsetfirst output sample to compute
[in]samplesnumber of samples to compute
Remarks
destination[n] is left unchanged for n<offset and the result is stored from destination[offset] onwards that is, in the same position where they would be if a full convolution was performed.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 483 of file ShortArray.cpp.

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

◆ copy()

static void SimpleArray< int16_t >::copy ( int16_t *  dst,
int16_t *  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()

void SimpleArray< int16_t >::copyFrom ( SimpleArray< int16_t >  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()

void SimpleArray< int16_t >::copyTo ( SimpleArray< int16_t >  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.

◆ correlate()

void ShortArray::correlate ( ShortArray  operand2,
ShortArray  destination 
)

Correlation between arrays.

Sets destination to the correlation of the array and operand2.

Parameters
[in]operand2the second operand for the correlation
[out]destinationthe destination array. It must have a minimum size of 2*max(srcALen, srcBLen)-1
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 511 of file ShortArray.cpp.

References correlateInitialized(), and setAll().

◆ correlateInitialized()

void ShortArray::correlateInitialized ( ShortArray  operand2,
ShortArray  destination 
)

Correlation between arrays.

Sets destination to the correlation of this array and operand2.

Parameters
[in]operand2the second operand for the correlation
[out]destinationarray. It must have a minimum size of 2*max(srcALen, srcBLen)-1
Remarks
It is the same as correlate(), but destination must have been initialized to 0 in advance.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 516 of file ShortArray.cpp.

References ASSERT, convolve(), SimpleArray< T >::data, SimpleArray< int16_t >::data, reverse(), SimpleArray< int16_t >::size, and SimpleArray< T >::size.

Referenced by correlate().

◆ create()

ShortArray ShortArray::create ( int  size)
static

Creates a new ShortArray.

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

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

Definition at line 579 of file ShortArray.cpp.

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

◆ destroy()

void ShortArray::destroy ( ShortArray  array)
static

Destroys a ShortArray created with the create() method.

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

Definition at line 585 of file ShortArray.cpp.

References SimpleArray< T >::data.

◆ equals()

bool SimpleArray< int16_t >::equals ( const SimpleArray< int16_t > &  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 ShortArray::fromFloat ( FloatArray  source)

Copies the content of a FloatArray into a ShortArray, converting the float elements to fixed-point 1.15.

Parameters
[in]sourcethe source array

Definition at line 555 of file ShortArray.cpp.

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

◆ getData()

int16_t * SimpleArray< int16_t >::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.

◆ getDb()

int16_t ShortArray::getDb ( )

◆ getElement()

int16_t SimpleArray< int16_t >::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.

◆ getFloatValue()

float ShortArray::getFloatValue ( uint32_t  n)

Returns an element of the array converted to float.

Parameters
nthe array element to read.
Returns
the floating point representation of the element.

Definition at line 551 of file ShortArray.cpp.

References SimpleArray< int16_t >::data.

Referenced by toFloat().

◆ getMax()

void ShortArray::getMax ( int16_t *  value,
int *  index 
)

Get the maximum value in the array and its index.

Parameters
[out]valuewill be set to the maximum value after the call
[out]indexwill be set to the index of the maximum value after the call
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 52 of file ShortArray.cpp.

References ASSERT, SimpleArray< int16_t >::data, and SimpleArray< int16_t >::size.

Referenced by getMaxIndex(), and getMaxValue().

◆ getMaxIndex()

int ShortArray::getMaxIndex ( )

Get the index of the maximum value in the array.

Returns
the maximum value contained in the array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 80 of file ShortArray.cpp.

References getMax().

◆ getMaxValue()

int16_t ShortArray::getMaxValue ( )

Get the maximum value in the array.

Returns
the maximum value contained in the array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 72 of file ShortArray.cpp.

References getMax().

◆ getMean()

int16_t ShortArray::getMean ( )

Mean of the array.

Gets the mean (or average) of the values in the array.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 149 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

◆ getMin()

void ShortArray::getMin ( int16_t *  value,
int *  index 
)

Get the minimum value in the array and its index.

Parameters
[out]valuewill be set to the minimum value after the call
[out]indexwill be set to the index of the minimum value after the call
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 17 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, and SimpleArray< int16_t >::size.

Referenced by getMinIndex(), and getMinValue().

◆ getMinIndex()

int ShortArray::getMinIndex ( )

Get the index of the minimum value in the array.

Returns
the mimimum value contained in the array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 44 of file ShortArray.cpp.

References getMin().

◆ getMinValue()

int16_t ShortArray::getMinValue ( )

Get the minimum value in the array.

Returns
the minimum value contained in the array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 36 of file ShortArray.cpp.

References getMin().

◆ getPower()

int64_t ShortArray::getPower ( )

Power of the array.

Gets the power of the values in the array.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 165 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

Referenced by getVariance().

◆ getRms()

int16_t ShortArray::getRms ( )

Root mean square value of the array.

Gets the root mean square of the values in the array.

Definition at line 133 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

◆ getSize()

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

Definition at line 31 of file SimpleArray.h.

◆ getStandardDeviation()

int16_t ShortArray::getStandardDeviation ( )

Standard deviation of the array.

Gets the standard deviation of the values in the array.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 181 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, getVariance(), and SimpleArray< int16_t >::size.

◆ getVariance()

int16_t ShortArray::getVariance ( )

Variance of the array.

Gets the variance of the values in the array.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 192 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, getPower(), and SimpleArray< int16_t >::size.

Referenced by getStandardDeviation().

◆ insert() [1/4]

void ShortArray::insert ( ShortArray  source,
int  destinationOffset,
size_t  samples 
)

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

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

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

◆ insert() [2/4]

void ShortArray::insert ( ShortArray  source,
int  sourceOffset,
int  destinationOffset,
size_t  samples 
)

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

Copies samples 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]samplesthe number of samples to copy

◆ insert() [3/4]

void SimpleArray< int16_t >::insert ( SimpleArray< int16_t >  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() [4/4]

void SimpleArray< int16_t >::insert ( SimpleArray< int16_t >  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< int16_t >::isEmpty ( ) const
inlineinherited

Definition at line 35 of file SimpleArray.h.

◆ move()

void ShortArray::move ( int  fromIndex,
int  toIndex,
size_t  length 
)

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]lengththe number of elements to copy
Remarks
this method uses memmove() so that the source memory and the destination memory can overlap. As a consequence it might have slow performances.

◆ multiply() [1/3]

void ShortArray::multiply ( int16_t  scalar)

Array-scalar multiplication.

Multiplies the values in the array by scalar.

Parameters
scalarto be multiplied with the array elements

Definition at line 422 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

◆ multiply() [2/3]

void ShortArray::multiply ( ShortArray  operand2)

Element-wise multiplication between arrays.

Multiplies each element in the array by the corresponding element in operand2.

Parameters
operand2second operand for the sum
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 417 of file ShortArray.cpp.

References multiply().

◆ multiply() [3/3]

void ShortArray::multiply ( ShortArray  operand2,
ShortArray  destination 
)

Element-wise multiplication between arrays.

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

Parameters
[in]operand2second operand for the product
[out]destinationthe destination array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 399 of file ShortArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< int16_t >::data, saturateTo16(), SimpleArray< int16_t >::size, and SimpleArray< T >::size.

Referenced by multiply().

◆ negate() [1/2]

void ShortArray::negate ( )

Negate the array.

Sets each element in the array to its opposite.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 446 of file ShortArray.cpp.

◆ negate() [2/2]

void ShortArray::negate ( ShortArray destination)

Negate the array.

Stores the opposite of the elements in the array into destination.

Parameters
[out]destinationthe destination array.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 436 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, SimpleArray< T >::getData(), and SimpleArray< int16_t >::size.

◆ noise() [1/2]

void ShortArray::noise ( )

Random values Fills the array with random values in the range [-1, 1)

Definition at line 451 of file ShortArray.cpp.

◆ noise() [2/2]

void ShortArray::noise ( int16_t  min,
int16_t  max 
)

Random values in range.

Fills the array with random values in the range [min, max)

Parameters
minminimum value in the range
maxmaximum value in the range

Definition at line 455 of file ShortArray.cpp.

References abs, SimpleArray< int16_t >::data, max, min, and SimpleArray< int16_t >::size.

◆ operator int16_t *()

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

Casting operator to T*.

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

Definition at line 157 of file SimpleArray.h.

◆ reciprocal() [1/2]

void ShortArray::reciprocal ( )

Reciprocal of the array.

Sets each element in the array to its reciprocal.

Definition at line 129 of file ShortArray.cpp.

◆ reciprocal() [2/2]

void ShortArray::reciprocal ( ShortArray destination)

Reciprocal of the array.

Stores the reciprocal of the elements in the array into destination.

Parameters
[out]destinationthe destination array.

Definition at line 123 of file ShortArray.cpp.

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

◆ rectify() [1/2]

void ShortArray::rectify ( )

Absolute value of the array.

Sets each element in the array to its absolute value.

Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 100 of file ShortArray.cpp.

◆ rectify() [2/2]

void ShortArray::rectify ( ShortArray destination)

Absolute value of the array.

Stores the absolute value of the elements in the array into destination.

Parameters
[out]destinationthe destination array.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 88 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, SimpleArray< T >::getData(), SimpleArray< T >::getSize(), min, and SimpleArray< int16_t >::size.

◆ reverse() [1/2]

void ShortArray::reverse ( )

Reverse the array.

Reverses the order of the elements in the array.

Definition at line 115 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, and SimpleArray< int16_t >::size.

Referenced by reverse().

◆ reverse() [2/2]

void ShortArray::reverse ( ShortArray destination)

Reverse the array Copies the elements of the array in reversed order into destination.

Parameters
[out]destinationthe destination array.

Definition at line 105 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, reverse(), and SimpleArray< int16_t >::size.

Referenced by correlateInitialized().

◆ setAll()

void ShortArray::setAll ( int16_t  value)

Set all the values in the array.

Sets all the elements of the array to value.

Parameters
[in]valueall the elements are set to this value.
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 231 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, and SimpleArray< int16_t >::size.

Referenced by clear(), and correlate().

◆ setElement()

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

Set a single value in the array.

Definition at line 50 of file SimpleArray.h.

◆ setFloatValue()

void ShortArray::setFloatValue ( uint32_t  n,
float  value 
)

Converts a float to int16 and stores it.

Parameters
nthe array element to write to. @value the value to write

Definition at line 547 of file ShortArray.cpp.

References SimpleArray< int16_t >::data.

Referenced by fromFloat().

◆ shift()

void ShortArray::shift ( int  shiftValue)

Bitshift the array values, saturating.

Parameters
shiftValuenumber of positions to shift. A positive value will shift left, a negative value will shift right.

Definition at line 532 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, and SimpleArray< int16_t >::size.

Referenced by ComplexShortArray::getMagnitudeValues().

◆ subArray()

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

A subset of the array.

Returns a 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 ShortArray.
Returns
the newly created ShortArray.
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 ShortArray::destroy() on the original ShortArray) as long as the ShortArray returned by this method is still in use.
Calling ShortArray::destroy() on a ShortArray instance created with this method might cause an exception.

Definition at line 226 of file ShortArray.cpp.

References ASSERT, SimpleArray< int16_t >::data, ShortArray(), and SimpleArray< int16_t >::size.

◆ subtract() [1/3]

void ShortArray::subtract ( int16_t  scalar)

Array-scalar subtraction.

Subtracts scalar from the values in the array.

Parameters
scalarto be subtracted from the array

Definition at line 340 of file ShortArray.cpp.

References SimpleArray< int16_t >::data, saturateTo16(), and SimpleArray< int16_t >::size.

◆ subtract() [2/3]

void ShortArray::subtract ( ShortArray  operand2)

Element-wise difference between arrays.

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

Parameters
[in]operand2second operand for the subtraction
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 335 of file ShortArray.cpp.

References subtract().

◆ subtract() [3/3]

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

Element-wise difference between arrays.

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

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

Definition at line 318 of file ShortArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< int16_t >::data, saturateTo16(), SimpleArray< int16_t >::size, and SimpleArray< T >::size.

Referenced by subtract().

◆ toFloat()

void ShortArray::toFloat ( FloatArray  destination)

Copies the content of the array to a FloatArray, interpreting the content of the ShortArray as 1.15.

Parameters
[out]destinationthe destination array

Definition at line 567 of file ShortArray.cpp.

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

Field Documentation

◆ data

int16_t * SimpleArray< int16_t >::data
protectedinherited

Definition at line 16 of file SimpleArray.h.

◆ size

size_t SimpleArray< int16_t >::size
protectedinherited

Definition at line 17 of file SimpleArray.h.


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