Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Missing Max Function?

Simon_B_
Novice
325 Views

Hi,

An example of something I often have to do - I have a vector with (say) 1024 floating point values and I want the maximum of every 8 values, i.e.

output[0] = max (input, 0 to 7)
output[1] = max (input, 8 to 15)
output[2] = max (input, 15 to 23)
etc.

So what's the correct / most efficient way to do this? I don't think there's a function...
 

0 Kudos
3 Replies
Jeffrey_M_Intel1
Employee
325 Views

There may be a better answer, but based on this description I think you're correct that this is not covered by a single function.  It may be possible to work in a loop across this vector where you compute the maximum for every 8 values separately.  You may want to check whether it is faster to use an IPP function on these very short vectors or write your own max function.

 Depending on future use of this data you may be able to combine steps after computing the max inside this loop for greater cache efficiency.  That is an advantage you will get with looping over shorter vectors that would not be available by calling a single IPP function to go over the entire array.

0 Kudos
Simon_B_
Novice
325 Views

Hi Jeffrey,

Pretty well my conclusion. Having made extensive use of the ipps functions, I miss only two:

1) ippsFMODF_32f
2) As I described above.

I couldn't live without IPP :) .

0 Kudos
Ying_H_Intel
Employee
325 Views

HI Simon, 

Just add one piece. If you have Intel composer product, you can try array notation, which can operate array in simple way. 

for example, C[:]=A[:]+B[:]. 

for (i<0; i<length; i+=8)

b[:]=__sec_reduce_max(a);

Best Regards,

Ying 

0 Kudos
Reply