Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to store the result in one of the input vectors in the vDSP framework

In the vDSP functions of the Accelerate Framework, all the functions require you to input a result vector. Is it correct to pass the input vector (or one of the input vectors) as the result vector if I no longer need whatever was in the original input vector?

Example of what I mean:

vDSP_vsadd(input_vector,1,scalar_addition,input_vector,1,length);

This would take the input_vector and add a scalar_addition to all the elements. The result would be stored in the input_vector.

like image 710
user1357607 Avatar asked Aug 27 '12 08:08

user1357607


Video Answer


1 Answers

The simple vector operations in vDSP all work correctly in-place (so long as they are strictly in-place; for instance you can't use &input_vector[length/2] for output and expect to get meaningful results). In fact, using them in-place will often give better performance, as it can reduce cache pressure.

Some of the more complicated vDSP operations do not support in-place operation with one or more of their arguments; this should be called out in the vDSP reference guide.

like image 130
Stephen Canon Avatar answered Sep 17 '22 04:09

Stephen Canon