Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

## Retrieving data from specific indices

Beginner
121 Views
Hi

I have situation where I have a vector and a set of indices in this vector. The number of indices is equal the number of elements in the vector. Then I want copy the value of the vector at the specific indices over to a second vector. Can IPP (or other intel libraries) be used to perform this task?

I guess you would do something like taking the pointer to the beginning of the vector and add the indices and take the value at this memory location:
B = value_at(A+ix);

Any help would be highly appreciated.

I will use this to perform interpolation. Find the interpolation coefficients based on the closest index to the point you would like to interpolate.

Thor Andreas

PS: Any Intel libraries who does interpolation? spline?
4 Replies
Beginner
121 Views
I have been looking for a nice interpolation routine as well, but I couldn't find a general 1D one. However, for 2D, you may try the remap function in IPP. Of course, you can try using that for 1D as well, but my bet is that it isn't optimized for it.

If you find another solution, please let us know!

Koen

Beginner
121 Views
Hi

I have developed my own interpolation library based on the IPP functions. The library does linear,shifted linear and cubic spline interpolation for 32f and 32fc. But to optimize this library such a function I sugested would be very nice.

Thanks
Thor Andreas
Employee
121 Views

Hi Andreas,

it seems that SIMD can't be applied efficiently for such algorithm so just a pure C code should be good enough. What do you think?

Regards,

Beginner
121 Views

Sounds reasonable. I did not really expect to find such an operation either. I though that there might have been a routine that could e.g. load a 32bit value from 4 memory locations at the same time, but that migtht not be that easy to implement

. Doing this by using a regular for loop works OK though.

What I am doing is this:

`for(int k=0;k{	iKhat = (int)floor(pTi);	iKhat = max(0,iKhat); iKhat = min(iKhat,pLength-2);	iTfractional = pTi - iKhat;	Out = iCoefs[iKhat+1]*iTfractional + iCoefs[iKhat]*(1.0f-iTfractional);		}`

The flooring,max/min, the subtraction,addition and multiplication can be done using SIMD, but its the retrieving of the coefs from the remapped positions kHat which is not possible to do using some kind of SIMD. But this might not be so performance degrading.

Thanks,

Thor Andreas