本文整理汇总了C++中FloatArray::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatArray::getData方法的具体用法?C++ FloatArray::getData怎么用?C++ FloatArray::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatArray
的用法示例。
在下文中一共展示了FloatArray::getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convolve
void FloatArray::convolve(FloatArray operand2, FloatArray destination, int offset, int samples){
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)
/// @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>
#ifdef ARM_CORTEX
//TODO: I suspect a bug in arm_conv_partial_f32
//it seems that destination[n] is left unchanged for n<offset
//and the result is actually stored from destination[offset] onwards
//that is, in the same position where they would be if a full convolution was performed.
//This requires (destination.size >= size + operand2.size -1). Ideally you would want destination to be smaller
arm_conv_partial_f32(data, size, operand2.data, operand2.size, destination.getData(), offset, samples);
#else
//this implementations reproduces the (buggy?) behaviour of arm_conv_partial (see comment above and inline comments below)
/*
This implementation is just a copy/paste/edit from the overloaded method
*/
int size2=operand2.getSize();
for (int n=offset; n<offset+samples; n++){
int n1=n;
destination[n] =0; //this should be [n-offset]
for(int k=0; k<size2; k++){
if(n1>=0 && n1<size)
destination[n]+=data[n1]*operand2[k];//this should be destination[n-offset]
n1--;
}
}
#endif /* ARM_CORTEX */
}
示例2: negate
void FloatArray::negate(FloatArray& destination){//allows in-place
/// @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>
#ifdef ARM_CORTEX
arm_negate_f32(data, destination.getData(), size);
#else
for(int n=0; n<size; n++){
destination[n]=-data[n];
}
#endif /* ARM_CORTEX */
}
示例3: insert
void FloatArray::insert(FloatArray source, int sourceOffset, int destinationOffset, int samples){
ASSERT(size >= destinationOffset+samples, "Array too small");
ASSERT(source.size >= sourceOffset+samples, "Array too small");
/// @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>
#ifdef ARM_CORTEX
arm_copy_f32(source.data+sourceOffset, data+destinationOffset, samples);
#else
memcpy((void*)(getData()+destinationOffset), (void*)(source.getData()+sourceOffset), samples*sizeof(float));
#endif /* ARM_CORTEX */
}
示例4: rectify
void FloatArray::rectify(FloatArray& destination){ //this is actually "copy data with rectifify"
/// @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>
#ifdef ARM_CORTEX
arm_abs_f32(data, destination.getData(), size);
#else
int minSize= min(size,destination.getSize()); //TODO: shall we take this out and allow it to segfault?
for(int n=0; n<minSize; n++){
destination[n] = fabs(data[n]);
}
#endif
}