You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LibSource/FloatArray.cpp
+40-6Lines changed: 40 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
#include<string.h>
5
5
6
6
voidFloatArray::getMin(float* value, int* index){
7
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
27
29
getMin(&value, &index);
28
30
return value;
29
31
}
30
32
31
33
intFloatArray::getMinIndex(){
32
34
float value;
33
35
int index;
36
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
34
37
getMin(&value, &index);
35
38
return index;
36
39
}
37
40
38
41
voidFloatArray::getMax(float* value, int* index){
39
42
ASSERT(size>0, "Wrong size");
43
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
60
65
getMax(&value, &index);
61
66
return value;
62
67
}
63
68
64
69
intFloatArray::getMaxIndex(){
65
70
float value;
66
71
int index;
72
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
67
73
getMax(&value, &index);
68
74
return index;
69
75
}
70
76
71
77
voidFloatArray::rectify(FloatArray& destination){ //this is actually "copy data with rectifify"
72
78
int minSize= min(size,destination.getSize()); //TODO: shall we take this out and allow it to segfault?
73
-
#ifdef ARM_CORTEX
79
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
@@ -80,6 +87,7 @@ void FloatArray::rectify(FloatArray& destination){ //this is actually "copy data
80
87
}
81
88
82
89
voidFloatArray::rectify(){//in place
90
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
83
91
rectify(*this);
84
92
}
85
93
@@ -104,7 +112,7 @@ void FloatArray::reverse(){//in place
@@ -113,6 +121,7 @@ void FloatArray::reciprocal(){//in place
113
121
114
122
floatFloatArray::getRms(){
115
123
float result;
124
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
116
125
#ifdef ARM_CORTEX
117
126
arm_rms_f32 (data, size, &result);
118
127
#else
@@ -128,6 +137,7 @@ float FloatArray::getRms(){
128
137
129
138
floatFloatArray::getMean(){
130
139
float result;
140
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
131
141
#ifdef ARM_CORTEX
132
142
arm_mean_f32 (data, size, &result);
133
143
#else
@@ -142,6 +152,7 @@ float FloatArray::getMean(){
142
152
143
153
floatFloatArray::getPower(){
144
154
float result;
155
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
145
156
#ifdef ARM_CORTEX
146
157
arm_power_f32 (data, size, &result);
147
158
#else
@@ -156,6 +167,7 @@ float FloatArray::getPower(){
156
167
157
168
floatFloatArray::getStandardDeviation(){
158
169
float result;
170
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
192
207
scale(factor, *this);
193
208
}
194
209
voidFloatArray::clip(){
@@ -216,15 +231,18 @@ FloatArray FloatArray::subArray(int offset, int length){
216
231
}
217
232
218
233
voidFloatArray::copyTo(FloatArray destination){
234
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
223
240
copyFrom(source, min(size, source.getSize()));
224
241
}
225
242
226
243
voidFloatArray::copyTo(float* other, int length){
227
244
ASSERT(size >= length, "Array too small");
245
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
228
246
#ifdef ARM_CORTEX
229
247
arm_copy_f32(data, other, length);
230
248
#else
@@ -234,6 +252,7 @@ void FloatArray::copyTo(float* other, int length){
234
252
235
253
voidFloatArray::copyFrom(float* other, int length){
236
254
ASSERT(size >= length, "Array too small");
255
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
237
256
#ifdef ARM_CORTEX
238
257
arm_copy_f32(other, data, length);
239
258
#else
@@ -244,6 +263,7 @@ void FloatArray::copyFrom(float* other, int length){
244
263
voidFloatArray::insert(FloatArray source, int sourceOffset, int destinationOffset, int samples){
245
264
ASSERT(size >= destinationOffset+samples, "Array too small");
246
265
ASSERT(source.size >= sourceOffset+samples, "Array too small");
266
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
@@ -252,6 +272,7 @@ void FloatArray::insert(FloatArray source, int sourceOffset, int destinationOffs
252
272
}
253
273
254
274
voidFloatArray::insert(FloatArray source, int destinationOffset, int samples){
275
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
255
276
insert(source, 0, destinationOffset, samples);
256
277
}
257
278
@@ -261,6 +282,7 @@ void FloatArray::move(int fromIndex, int toIndex, int samples){
261
282
}
262
283
263
284
voidFloatArray::setAll(float value){
285
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
ASSERT(operand2.size == size && destination.size==size, "Arrays must be same size");
297
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
275
298
#ifdef ARM_CORTEX
276
299
/* despite not explicitely documented in the CMSIS documentation,
277
300
this has been tested to behave properly even when pSrcA==pDst
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
ASSERT(operand2.size == size && destination.size==size, "Arrays must be same size");
300
-
#ifdef ARM_CORTEX
324
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
325
+
#ifdef ARM_CORTEX
301
326
/* despite not explicitely documented in the CMSIS documentation,
302
327
this has been tested to behave properly even when pSrcA==pDst
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
ASSERT(operand2.size == size && destination.size==size, "Arrays must be same size");
325
-
#ifdef ARM_CORTEX
351
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
352
+
#ifdef ARM_CORTEX
326
353
/* despite not explicitely documented in the CMSIS documentation,
327
354
this has been tested to behave properly even when pSrcA==pDst
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
ASSERT(destination.size >= size + operand2.size -1, "Destination array too small");
408
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
voidFloatArray::convolve(FloatArray operand2, FloatArray destination, int offset, int samples){
395
426
ASSERT(destination.size >= size + operand2.size -1, "Destination array too small"); //TODO: change this condition to the actual size being written(will be samples+ tail)
427
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
396
428
#ifdef ARM_CORTEX
397
429
//TODO: I suspect a bug in arm_conv_partial_f32
398
430
//it seems that destination[n] is left unchanged for n<offset
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
ASSERT(destination.size >= size+operand2.size-1, "Destination array too small"); //TODO: change CMSIS docs, which state a different size
460
+
/// @note When built for ARM Cortex-M processor series, this method uses the optimized <a href="http://www.keil.com/pack/doc/CMSIS/General/html/index.html">CMSIS library</a>
* @param[in] offset the first element of the subset.
318
319
* @param[in] length the number of elments in the new FloatArray.
319
320
* @return the newly created FloatArray.
320
-
* @note no memory is allocated by this method. The memory is still shared with the original array.
321
+
* @remarks no memory is allocated by this method. The memory is still shared with the original array.
321
322
* The memory should not be de-allocated elsewhere (e.g.: by calling FloatArray::destroy() on the original FloatArray)
322
323
* as long as the FloatArray returned by this method is still in use.
323
-
* @note Calling FloatArray::destroy() on a FloatArray instance created wit this method will cause an exception.
324
+
* @remarks Calling FloatArray::destroy() on a FloatArray instance created wit this method will cause an exception.
324
325
*/
325
326
FloatArray subArray(int offset, int length);
326
327
@@ -377,7 +378,7 @@ class FloatArray {
377
378
* @param[in] fromIndex the first element to copy
378
379
* @param[in] toIndex the destination of the first element
379
380
* @param[in] length the number of elements to copy
380
-
* @note this method uses *memmove()* so that the source memory and the destination memory can overlap. As a consequence it might have slow performances.
381
+
* @remarks this method uses *memmove()* so that the source memory and the destination memory can overlap. As a consequence it might have slow performances.
381
382
*/
382
383
voidmove(int fromIndex, int toIndex, int length);
383
384
@@ -446,15 +447,15 @@ class FloatArray {
446
447
* Allocates size*sizeof(float) bytes of memory and returns a FloatArray that points to it.
447
448
* @param size the size of the new FloatArray.
448
449
* @return a FloatArray which **data** point to the newly allocated memory and **size** is initialized to the proper value.
449
-
* @note a FloatArray created with this method has to be destroyed invoking the FloatArray::destroy() method.
450
+
* @remarks a FloatArray created with this method has to be destroyed invoking the FloatArray::destroy() method.
450
451
*/
451
452
static FloatArray create(int size);
452
453
453
454
/**
454
455
* Destroys a FloatArray created with the create() method.
455
456
* @param array the FloatArray to be destroyed.
456
-
* @note the FloatArray object passed as an argument should not be used again after invoking this method.
457
-
* @note a FloatArray object that has not been created by the FloatArray::create() method might cause an exception if passed as an argument to this method.
457
+
* @remarks the FloatArray object passed as an argument should not be used again after invoking this method.
458
+
* @remarks a FloatArray object that has not been created by the FloatArray::create() method might cause an exception if passed as an argument to this method.
0 commit comments