Community
cancel
Showing results for 
Search instead for 
Did you mean: 
hb9drv
Beginner
32 Views

Max of every x elements...

Hi,

I am sure this is possible but my aged brain has so far failed me.

I would like to find the maximum of every n elements of an array, for example if n is 5 then I want the max of a[0 to 4], max of a[5 to 9], max of a[10 to 14] and so on.

I'm doing this quite a lot at times so would like to save some cycles and the planet in the process.

TTFN
0 Kudos
2 Replies
Naveen_G_Intel
Employee
32 Views

Hi,

IPP library has got a functions ippsMaxIndx which is declared in ipps.h

This function returns the maximum value of the input vector pSrc, and stores the result in pMax.

I hope this function could be helpful for you to find max value in an array.

Below is small example of usage of this function.

Ipp16s src[] = { 1, -2, 3, 8, -6 };

Ipp16s max;

int len = 5;

int indx;

ippsMaxIndx_16s ( src, len, &max, &indx );

result: max = 8 indx = 3

Regards,

Naveen Gv

hb9drv
Beginner
32 Views

Thanks Naveen, but the calls to ippsMaxIndx_16s would introduce too much overhead. I was rather hoping that there was a function in IPP that would do what I want. I can live without this actually :)