OpenWareLaboratory
FloatArray Class Reference

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

Inheritance diagram for FloatArray:
Collaboration diagram for FloatArray:

Public Member Functions

void add (float scalar)
 In-place array-scalar addition. More...
 
void add (float scalar, FloatArray destination)
 Array-scalar addition. More...
 
void add (FloatArray operand2)
 Element-wise sum between arrays. More...
 
void add (FloatArray operand2, FloatArray destination)
 Element-wise sum between arrays. More...
 
void clear ()
 Clear the array. More...
 
void clip ()
 Clips the elements in the array in the range [-1, 1]. More...
 
void clip (float min, float max)
 Clips the elements in the array in the range [min, max]. More...
 
void clip (float range)
 Clips the elements in the array in the range [-**range**, range]. More...
 
void convolve (FloatArray operand2, FloatArray destination)
 Convolution between arrays. More...
 
void convolve (FloatArray operand2, FloatArray destination, int offset, size_t samples)
 Partial convolution between arrays. More...
 
void copyFrom (SimpleArray< float > source)
 Copies the content of another array into this array. More...
 
void copyTo (SimpleArray< float > destination)
 Copies the content of this array to another array. More...
 
void correlate (FloatArray operand2, FloatArray destination)
 Correlation between arrays. More...
 
void correlateInitialized (FloatArray operand2, FloatArray destination)
 Correlation between arrays. More...
 
void decibelToGain (FloatArray destination)
 Convert decibel to gains values: gain = 10^(dB/20) -6dB = 0.5, 0dB = 1.0, +6dB = 2.0. More...
 
bool equals (const SimpleArray< float > &other) const
 Compares two arrays. More...
 
 FloatArray ()
 
 FloatArray (float *data, size_t size)
 
void gainToDecibel (FloatArray destination)
 Convert gains to decibel values: dB = log10(gain)*20 Gain 0.5 = -6dB, 1.0 = 0dB, 2.0 = +6dB. More...
 
float * getData ()
 Get the data stored in the Array. More...
 
float getElement (size_t index)
 Get a single value stored in the array. More...
 
void getMax (float *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...
 
float getMaxValue ()
 Get the maximum value in the array. More...
 
float getMean ()
 Mean of the array. More...
 
void getMin (float *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...
 
float getMinValue ()
 Get the minimum value in the array. More...
 
float getPower ()
 Power of the array. More...
 
float getRms ()
 Root mean square value of the array. More...
 
size_t getSize () const
 
float getStandardDeviation ()
 Standard deviation of the array. More...
 
float getSum ()
 Sum of the array. More...
 
float getVariance ()
 Variance of the array. More...
 
void insert (SimpleArray< float > source, int destinationOffset, size_t len)
 Copies the content of an array into a subset of the array. More...
 
void insert (SimpleArray< float > 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 len)
 Copies values within an array. More...
 
void multiply (float scalar)
 Array-scalar multiplication. More...
 
void multiply (float scalar, FloatArray destination)
 Array-scalar multiplication. More...
 
void multiply (FloatArray operand2)
 Element-wise multiplication between arrays. More...
 
void multiply (FloatArray operand2, FloatArray destination)
 Element-wise multiplication between arrays. More...
 
void negate ()
 Negate the array. More...
 
void negate (FloatArray &destination)
 Negate the array. More...
 
void noise ()
 Random values Fills the array with random values in the range [-1, 1) More...
 
void noise (float min, float max)
 Random values in range. More...
 
 operator float * ()
 Casting operator to T*. More...
 
void ramp (float from, float to)
 Create a linear ramp from one value to another. More...
 
void reciprocal ()
 Reciprocal of the array, in-place version. More...
 
void reciprocal (FloatArray &destination)
 Reciprocal of the array. More...
 
void rectify ()
 Absolute value of the array, in-place version. More...
 
void rectify (FloatArray &destination)
 Absolute value of the array. More...
 
void reverse ()
 Reverse the array. More...
 
void reverse (FloatArray &destination)
 Reverse the array Copies the elements of the array in reversed order into destination. More...
 
void scale (float from, float to)
 In-place scale. More...
 
void scale (float from, float to, FloatArray destination)
 Scale all values along a linear ramp from one value to another. More...
 
void setAll (float value)
 Set all the values in the array. More...
 
void setElement (size_t index, float value)
 Set a single value in the array. More...
 
void softclip ()
 Applies a cubic soft-clip algorithm to all elements in the array which limits them to the range [-1, 1] In-place version. More...
 
void softclip (FloatArray destination)
 Applies a cubic soft-clip algorithm to all elements in the array which limits them to the range [-1, 1]. More...
 
FloatArray subArray (int offset, size_t length)
 A subset of the array. More...
 
void subtract (float scalar)
 Array-scalar subtraction. More...
 
void subtract (FloatArray operand2)
 Element-wise difference between arrays. More...
 
void subtract (FloatArray operand2, FloatArray destination)
 Element-wise difference between arrays. More...
 
void tanh ()
 In-place tanh. More...
 
void tanh (FloatArray destination)
 Apply tanh to each element in the array. More...
 

Static Public Member Functions

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

Protected Attributes

float * data
 
size_t size
 

Detailed Description

This class contains useful methods for manipulating arrays of floats.

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

Definition at line 12 of file FloatArray.h.

Constructor & Destructor Documentation

◆ FloatArray() [1/2]

FloatArray::FloatArray ( )
inline

Definition at line 14 of file FloatArray.h.

Referenced by subArray().

◆ FloatArray() [2/2]

FloatArray::FloatArray ( float *  data,
size_t  size 
)
inline

Definition at line 15 of file FloatArray.h.

Member Function Documentation

◆ add() [1/4]

void FloatArray::add ( float  scalar)

In-place array-scalar addition.

Adds scalar to each value in the array

Parameters
[in]scalarvalue to be added to the array

Definition at line 252 of file FloatArray.cpp.

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

◆ add() [2/4]

void FloatArray::add ( float  scalar,
FloatArray  destination 
)

Array-scalar addition.

Adds scalar to each value in the array and put the result in destination

Parameters
[in]scalarvalue to be added to the array
[out]destinationthe destination array

Definition at line 258 of file FloatArray.cpp.

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

◆ add() [3/4]

void FloatArray::add ( FloatArray  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 247 of file FloatArray.cpp.

References add().

◆ add() [4/4]

void FloatArray::add ( FloatArray  operand2,
FloatArray  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 231 of file FloatArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< float >::data, SimpleArray< float >::size, and SimpleArray< T >::size.

Referenced by AudioBuffer::add(), add(), CrossFadingCircularBuffer< T >::delay(), MorphingOscillator::generate(), VoiceAllocatorSignalGenerator< Allocator, SynthVoice, VOICES >::generate(), PolyBlepOscillator::generate(), StereoFeedbackProcessor::process(), PingPongFeedbackProcessor::process(), DryWetSignalProcessor< Processor >::process(), FeedbackSignalProcessor< Processor >::process(), and VoiceAllocatorSignalProcessor< Allocator, SynthVoice, VOICES >::process().

◆ clear()

void FloatArray::clear ( )
inline

Clear the array.

Set all the values in the array to 0.

Definition at line 29 of file FloatArray.h.

References setAll().

Referenced by create(), FirFilter::create(), UpSampler::process(), and SimpleMovingAverage::reset().

◆ clip() [1/3]

void FloatArray::clip ( )

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

Definition at line 193 of file FloatArray.cpp.

◆ clip() [2/3]

void FloatArray::clip ( float  min,
float  max 
)

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

Parameters
minminimum value
maxmaximum value

Definition at line 206 of file FloatArray.cpp.

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

◆ clip() [3/3]

void FloatArray::clip ( float  range)

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

Parameters
rangeclipping value.

Definition at line 197 of file FloatArray.cpp.

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

◆ convolve() [1/2]

void FloatArray::convolve ( FloatArray  operand2,
FloatArray  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 352 of file FloatArray.cpp.

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

Referenced by correlateInitialized().

◆ convolve() [2/2]

void FloatArray::convolve ( FloatArray  operand2,
FloatArray  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
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 370 of file FloatArray.cpp.

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

◆ copy()

static void SimpleArray< float >::copy ( float *  dst,
float *  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< float >::copyFrom ( SimpleArray< float >  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< float >::copyTo ( SimpleArray< float >  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 FloatArray::correlate ( FloatArray  operand2,
FloatArray  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
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 398 of file FloatArray.cpp.

References correlateInitialized(), and setAll().

◆ correlateInitialized()

void FloatArray::correlateInitialized ( FloatArray  operand2,
FloatArray  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 404 of file FloatArray.cpp.

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

Referenced by correlate().

◆ create()

◆ decibelToGain()

void FloatArray::decibelToGain ( FloatArray  destination)

Convert decibel to gains values: gain = 10^(dB/20) -6dB = 0.5, 0dB = 1.0, +6dB = 2.0.

Definition at line 426 of file FloatArray.cpp.

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

◆ destroy()

◆ equals()

bool SimpleArray< float >::equals ( const SimpleArray< float > &  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.

◆ gainToDecibel()

void FloatArray::gainToDecibel ( FloatArray  destination)

Convert gains to decibel values: dB = log10(gain)*20 Gain 0.5 = -6dB, 1.0 = 0dB, 2.0 = +6dB.

Definition at line 420 of file FloatArray.cpp.

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

◆ getData()

float * SimpleArray< float >::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()

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

◆ getMax()

void FloatArray::getMax ( float *  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 41 of file FloatArray.cpp.

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

Referenced by getMaxIndex(), and getMaxValue().

◆ getMaxIndex()

int FloatArray::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 69 of file FloatArray.cpp.

References getMax().

Referenced by FourierPitchDetector::computeFrequency().

◆ getMaxValue()

float FloatArray::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 61 of file FloatArray.cpp.

References getMax().

◆ getMean()

float FloatArray::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 136 of file FloatArray.cpp.

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

Referenced by ZeroCrossingPitchDetector::getFrequency().

◆ getMin()

void FloatArray::getMin ( float *  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 6 of file FloatArray.cpp.

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

Referenced by getMinIndex(), and getMinValue().

◆ getMinIndex()

int FloatArray::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 33 of file FloatArray.cpp.

References getMin().

◆ getMinValue()

float FloatArray::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 25 of file FloatArray.cpp.

References getMin().

◆ getPower()

float FloatArray::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 151 of file FloatArray.cpp.

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

Referenced by getVariance().

◆ getRms()

float FloatArray::getRms ( )

Root mean square value of the array.

Gets the root mean square 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 113 of file FloatArray.cpp.

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

◆ getSize()

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

Definition at line 31 of file SimpleArray.h.

◆ getStandardDeviation()

float FloatArray::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 166 of file FloatArray.cpp.

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

◆ getSum()

float FloatArray::getSum ( )

Sum of the array.

Gets the sum of the values in the array.

Definition at line 129 of file FloatArray.cpp.

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

◆ getVariance()

float FloatArray::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 177 of file FloatArray.cpp.

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

Referenced by getStandardDeviation().

◆ insert() [1/2]

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

Definition at line 35 of file SimpleArray.h.

◆ move()

void SimpleArray< float >::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.

◆ multiply() [1/4]

void FloatArray::multiply ( float  scalar)

Array-scalar multiplication.

Multiplies the values in the array by scalar.

Parameters
scalarto be multiplied with the array elements

Definition at line 312 of file FloatArray.cpp.

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

◆ multiply() [2/4]

void FloatArray::multiply ( float  scalar,
FloatArray  destination 
)

Array-scalar multiplication.

Multiplies the values in the array by scalar.

Parameters
scalarto be subtracted from the array
destinationthe destination array

Definition at line 321 of file FloatArray.cpp.

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

◆ multiply() [3/4]

void FloatArray::multiply ( FloatArray  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 307 of file FloatArray.cpp.

References multiply().

◆ multiply() [4/4]

void FloatArray::multiply ( FloatArray  operand2,
FloatArray  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 290 of file FloatArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< float >::data, SimpleArray< float >::size, and SimpleArray< T >::size.

Referenced by MorphingOscillator::generate(), PolyBlepOscillator::generate(), PolyBlepOscillator::getSamples(), AudioBuffer::multiply(), multiply(), StereoFeedbackProcessor::process(), PingPongFeedbackProcessor::process(), FourierPitchDetector::process(), DryWetSignalProcessor< Processor >::process(), and FeedbackSignalProcessor< Processor >::process().

◆ negate() [1/2]

void FloatArray::negate ( )
inline

Negate the array.

Sets each element in the array to its opposite.

Definition at line 127 of file FloatArray.h.

◆ negate() [2/2]

void FloatArray::negate ( FloatArray 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 330 of file FloatArray.cpp.

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

◆ noise() [1/2]

void FloatArray::noise ( )

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

Definition at line 340 of file FloatArray.cpp.

◆ noise() [2/2]

void FloatArray::noise ( float  min,
float  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 344 of file FloatArray.cpp.

References SimpleArray< float >::data, max, min, randf(), and SimpleArray< float >::size.

◆ operator float *()

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

Casting operator to T*.

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

Definition at line 157 of file SimpleArray.h.

◆ ramp()

void FloatArray::ramp ( float  from,
float  to 
)

Create a linear ramp from one value to another.

Interpolates all samples in the FloatArray between the endpoints from to to.

Definition at line 432 of file FloatArray.cpp.

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

Referenced by Window::applyTriangularWindow(), and Window::triangular().

◆ reciprocal() [1/2]

void FloatArray::reciprocal ( )
inline

Reciprocal of the array, in-place version.

Sets each element in the array to its reciprocal.

Definition at line 111 of file FloatArray.h.

◆ reciprocal() [2/2]

void FloatArray::reciprocal ( FloatArray destination)

Reciprocal of the array.

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

Parameters
[out]destinationthe destination array.

Definition at line 107 of file FloatArray.cpp.

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

◆ rectify() [1/2]

void FloatArray::rectify ( )
inline

Absolute value of the array, in-place version.

Sets each element in the array to its absolute value.

Definition at line 83 of file FloatArray.h.

◆ rectify() [2/2]

void FloatArray::rectify ( FloatArray 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 77 of file FloatArray.cpp.

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

◆ reverse() [1/2]

void FloatArray::reverse ( )

Reverse the array.

Reverses the order of the elements in the array.

Definition at line 99 of file FloatArray.cpp.

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

Referenced by reverse().

◆ reverse() [2/2]

void FloatArray::reverse ( FloatArray destination)

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

Parameters
[out]destinationthe destination array.

Definition at line 89 of file FloatArray.cpp.

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

Referenced by correlateInitialized().

◆ scale() [1/2]

void FloatArray::scale ( float  from,
float  to 
)
inline

In-place scale.

Definition at line 374 of file FloatArray.h.

References scale().

◆ scale() [2/2]

void FloatArray::scale ( float  from,
float  to,
FloatArray  destination 
)

Scale all values along a linear ramp from one value to another.

Definition at line 440 of file FloatArray.cpp.

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

Referenced by CrossFadingCircularBuffer< T >::delay(), and scale().

◆ setAll()

void FloatArray::setAll ( float  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 220 of file FloatArray.cpp.

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

Referenced by clear(), correlate(), InterpolatingSignalGenerator< im >::generate(), and SimpleMovingAverage::set().

◆ setElement()

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

Set a single value in the array.

Definition at line 50 of file SimpleArray.h.

◆ softclip() [1/2]

void FloatArray::softclip ( )
inline

Applies a cubic soft-clip algorithm to all elements in the array which limits them to the range [-1, 1] In-place version.

Definition at line 209 of file FloatArray.h.

◆ softclip() [2/2]

void FloatArray::softclip ( FloatArray  destination)

Applies a cubic soft-clip algorithm to all elements in the array which limits them to the range [-1, 1].

Parameters
[out]destinationthe destination array

Definition at line 454 of file FloatArray.cpp.

References clamp, SimpleArray< float >::data, and SimpleArray< float >::size.

◆ subArray()

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

Definition at line 215 of file FloatArray.cpp.

References ASSERT, SimpleArray< float >::data, FloatArray(), and SimpleArray< float >::size.

Referenced by FourierPitchDetector::computeFrequency().

◆ subtract() [1/3]

void FloatArray::subtract ( float  scalar)

Array-scalar subtraction.

Subtracts scalar from the values in the array.

Parameters
scalarto be subtracted from the array

Definition at line 284 of file FloatArray.cpp.

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

◆ subtract() [2/3]

void FloatArray::subtract ( FloatArray  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 279 of file FloatArray.cpp.

References subtract().

◆ subtract() [3/3]

void FloatArray::subtract ( FloatArray  operand2,
FloatArray  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
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 263 of file FloatArray.cpp.

References ASSERT, SimpleArray< T >::data, SimpleArray< float >::data, SimpleArray< float >::size, and SimpleArray< T >::size.

Referenced by subtract().

◆ tanh() [1/2]

void FloatArray::tanh ( )
inline

In-place tanh.

Definition at line 386 of file FloatArray.h.

◆ tanh() [2/2]

void FloatArray::tanh ( FloatArray  destination)

Apply tanh to each element in the array.

Definition at line 461 of file FloatArray.cpp.

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

Field Documentation

◆ data

float * SimpleArray< float >::data
protectedinherited

Definition at line 16 of file SimpleArray.h.

◆ size

size_t SimpleArray< float >::size
protectedinherited

Definition at line 17 of file SimpleArray.h.


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