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

Cumulative Sum

thorsan1
Beginner
1,063 Views
Hi

I need to compute the cumulative sum of a 1D signal. In C it would look like

for(int k=0;k...)
{
A += A[k-1];
}

How can this be done using intrinsics and/or IPP?

Thanks for any help
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
1,063 Views

Hello,

As I remember there was a similar question regarding 2D operation, you can see thread

http://softwareforums.intel.com/ids/board/message?board.id=IPP&message.id=980

regarding piece of code you shown, is it exactly what you mean? This code will read data from outside of available memory for k=0.

We do not have similar functions in IPP. You can take a look on ippsSum function family, which calculate sum of all elements in 1D vector

Regards,
Vladimir

0 Kudos
Intel_C_Intel
Employee
1,063 Views

Hi!

IPP has function ippiIntegral that calculates the image integral on the rectangular area. If you call it for the image with 1 row you get the cumulative sum

Alexander

0 Kudos
thorsan1
Beginner
1,063 Views
hi

thanks for the help.

ok. there was an error in the kode the loop should go from k=1...

Ill take a look at the integral function. but does anyone know how it is done?

thorsan
0 Kudos
Intel_C_Intel
Employee
1,063 Views

Imageintegral function maps input NxM image to output (N+1)x(M+1) image. It calculates dst[n,m]=SUM(src[i,j]), i

For more details see IPP Manual Image processing

Alexander

0 Kudos
Reply