Running finite sum #548
-
Any idea about using GenericScanKernel to make a running sum of the preceding N terms, i.e. S(k) = Sum(i = k - N, k)input[i] instead of S(k) = Sum(i = 0, k)input[i] (e.g. for a window averaging) ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Isn't that just
? (with appropriate handling of the left boundary of course) |
Beta Was this translation helpful? Give feedback.
-
The problem is to deal with the loss of resolution you get when accumulating millions of values (all GPU cards do not accept double precision). Of course you are right (simply subtracting two scans once they are done), but it gets more and more noisy towards the end of the scans. My question was: can this be handled within the GenericScanKernel mechanism... |
Beta Was this translation helpful? Give feedback.
-
To overcome this, I am trying to use a segmented scan. However, I can see nowhere any simple working example. I have seen issue #411 and your comment, which is hard to understand (what does ' the scan expression must act as if the How should I modify the following code ?
|
Beta Was this translation helpful? Give feedback.
-
Here is a working example:
|
Beta Was this translation helpful? Give feedback.
Here is a working example: