Getting a vector subset

Getting a vector subset

Bild des Benutzers David B.

Hi,

I'm new to IPP, and I have a somewhat basic question. Suppose I have a vector "v" of float32 values 1-9. I want to take some of the middle values (e.g. 5-7) and assign them to another vector "v_subset." I can't seem to find the function to do that. ippsMove_32f and ippsCopy_32f seem to only allow me to take the first x values of the vector, but I'm interested in a subset from the middle of the vector. Basically, what I'm trying to accomplish is something like the following:

void main()

{

Ipp32f v[9] = {1,2,3,4,5,6,7,8,9};

Ipp32f v_subset[3];

\\ some function that sets Ipp32f v_subset equal to {"5 6 7"}

}

Thanks for your help!

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Sergey Kostrov

Hi David, You need to do this:

...
Ipp32f v[9] = {1,2,3,4,5,6,7,8,9};

Ipp32f v_subset[3] = { 0, 0, 0 };

ippsCopy_32f( &v[4], &v_subset[0], 3 );
...

Bild des Benutzers David B.

Works! Thanks Sergey for your quick reply and help.
-David

Melden Sie sich an, um einen Kommentar zu hinterlassen.