11 else if(value < SHRT_MIN)
21 arm_min_q15(
data,
size, value, &idx);
26 for(
size_t n=1; n<
size; n++){
27 int16_t currentValue=
data[n];
28 if(currentValue<*value){
57 arm_max_q15(
data,
size, value, &idx);
62 for(
size_t n=1; n<
size; n++){
63 int16_t currentValue=
data[n];
64 if(currentValue>*value){
94 for(
size_t n=0; n<minSize; n++){
95 destination[n] = fabs(
data[n]);
106 if(destination==*
this){
110 for(
size_t n=0; n<
size; n++){
116 for(
size_t n=0; n<
size/2; n++){
117 int16_t temp=
data[n];
125 for(
size_t n=0; n<
getSize(); n++)
126 destination[n] = (int16_t)(0.5 + 1.0f/
data[n]);
140 for(
size_t n=0; n <
size; ++n){
143 value = sqrtf(value /
size);
156 for(
size_t n=0; n <
size; n++){
159 value = value /
size;
169 arm_power_q15 (
data,
size, &result);
172 int16_t *pSrc =
data;
173 for(
size_t n=0; n <
size; n++){
174 int32_t value = (int32_t)pSrc[n]*pSrc[n];
200 for(
size_t n=0; n<
size; n++){
203 result=(sumOfSquares - sum*sum/
size) / (
size - 1);
209 for(
size_t n=0; n<
size; n++){
218 for(
size_t n=0; n<
size; n++){
227 ASSERT(
size >= offset+length,
"Array too small");
236 for(
size_t n=0; n<
size; n++){
252 for(
size_t n=0; n<
size; n++){
253 int32_t value =
data[n] + operand2[n];
261 add(operand2, *
this);
266 int16_t doubleScalar[2] = {scalar, scalar};
268 q15_t * pSrcB = (int16_t*)&doubleScalar;
270 uint32_t blockSize =
size;
274 q31_t inA1, inA2, inB1, inB2;
277 blkCnt = blockSize >> 2u;
285 inA1 = *__SIMD32(pSrcA)++;
286 inA2 = *__SIMD32(pSrcA)++;
287 inB1 = *__SIMD32(pSrcB);
288 inB2 = *__SIMD32(pSrcB);
290 *__SIMD32(pDst)++ = __QADD16(inA1, inB1);
291 *__SIMD32(pDst)++ = __QADD16(inA2, inB2);
299 blkCnt = blockSize % 0x4u;
305 *pDst++ = (
q15_t) __QADD16(*pSrcA++, *pSrcB);
311 for(
size_t n=0; n <
size; ++n){
312 int32_t value =
data[n] + scalar;
328 for(
size_t n=0; n <
size; ++n){
329 int32_t value =
data[n] - operand2[n];
346 int16_t *pSrcA =
data;
347 int16_t scalarDouble[2] = {scalar, scalar};
348 int16_t *pSrcB = scalarDouble;
349 int16_t *pDst =
data;
350 uint32_t blockSize =
size;
358 blkCnt = blockSize >> 2u;
366 inA1 = *__SIMD32(pSrcA)++;
367 inA2 = *__SIMD32(pSrcA)++;
368 inB1 = *__SIMD32(pSrcB);
369 inB2 = *__SIMD32(pSrcB);
371 *__SIMD32(pDst)++ = __QSUB16(inA1, inB1);
372 *__SIMD32(pDst)++ = __QSUB16(inA2, inB2);
380 blkCnt = blockSize % 0x4u;
386 *pDst++ = (
q15_t) __QSUB16(*pSrcA++, *pSrcB);
392 for(
size_t n = 0; n <
size; ++n){
393 int32_t value =
data[n] - scalar;
409 for(
size_t n=0; n<
size; n++){
410 int32_t value =
data[n] * operand2[n];
429 for(
size_t n = 0; n <
size; ++n){
430 int32_t value =
data[n] * scalar;
441 for(
size_t n=0; n<
size; n++){
442 destination[n]=-
data[n];
452 noise(-32768, 32767);
456 uint16_t amplitude =
abs((int32_t)
max-(int32_t)
min);
457 int16_t offset =
min;
458 for(
size_t n=0; n<
size; n++){
459 data[n]=(rand()/((float)RAND_MAX)) * amplitude + offset;
470 size_t size2=operand2.
getSize();
471 for (
size_t n=0; n<
size+size2-1; n++){
474 for(
size_t k=0; k<size2; k++){
476 destination[n]+=
data[n1]*operand2[k];
498 size_t size2=operand2.
getSize();
499 for (
size_t n=offset; n<offset+samples; n++){
502 for(
size_t k=0; k<size2; k++){
504 destination[n]+=
data[n1]*operand2[k];
537 for(
size_t n=0; n<
size; n++)
540 shiftValue = -shiftValue;
541 for(
size_t n=0; n<
size; n++)
548 data[n] = value * -SHRT_MIN;
552 return data[n] / (float)-SHRT_MIN;
559 arm_float_to_q15((
float*)source,
data,
size);
561 for(
size_t n = 0; n <
size; ++n){
571 arm_q15_to_float(
data, (
float*)destination,
size);
573 for(
size_t n = 0; n <
size; ++n){
static int16_t saturateTo16(int64_t value)
This class contains useful methods for manipulating arrays of floats.
This class contains useful methods for manipulating arrays of int16_ts.
int16_t getMean()
Mean of the array.
void correlate(ShortArray operand2, ShortArray destination)
Correlation between arrays.
void rectify()
Absolute value of the array.
void setFloatValue(uint32_t n, float value)
Converts a float to int16 and stores it.
void setAll(int16_t value)
Set all the values in the array.
int16_t getStandardDeviation()
Standard deviation of the array.
void noise()
Random values Fills the array with random values in the range [-1, 1)
void fromFloat(FloatArray source)
Copies the content of a FloatArray into a ShortArray, converting the float elements to fixed-point 1....
void toFloat(FloatArray destination)
Copies the content of the array to a FloatArray, interpreting the content of the ShortArray as 1....
void reverse(ShortArray &destination)
Reverse the array Copies the elements of the array in reversed order into destination.
int getMinIndex()
Get the index of the minimum value in the array.
void shift(int shiftValue)
Bitshift the array values, saturating.
void clip(int16_t range)
Clips the elements in the array in the range [-**range**, range].
static void destroy(ShortArray array)
Destroys a ShortArray created with the create() method.
ShortArray subArray(int offset, size_t length)
A subset of the array.
void clear()
Clear the array.
void subtract(ShortArray operand2, ShortArray destination)
Element-wise difference between arrays.
void multiply(ShortArray operand2, ShortArray destination)
Element-wise multiplication between arrays.
int16_t getMaxValue()
Get the maximum value in the array.
float getFloatValue(uint32_t n)
Returns an element of the array converted to float.
void reciprocal()
Reciprocal of the array.
int16_t getMinValue()
Get the minimum value in the array.
int16_t getVariance()
Variance of the array.
int16_t getRms()
Root mean square value of the array.
static ShortArray create(int size)
Creates a new ShortArray.
void getMax(int16_t *value, int *index)
Get the maximum value in the array and its index.
int64_t getPower()
Power of the array.
int getMaxIndex()
Get the index of the maximum value in the array.
void negate()
Negate the array.
void correlateInitialized(ShortArray operand2, ShortArray destination)
Correlation between arrays.
void getMin(int16_t *value, int *index)
Get the minimum value in the array and its index.
void convolve(ShortArray operand2, ShortArray destination)
Convolution between arrays.
void add(ShortArray operand2, ShortArray destination)
Element-wise sum between arrays.
void reverse()
Reverse the array.
T * getData()
Get the data stored in the Array.
#define ASSERT(cond, msg)