Skip to content

Running finite sum #548

Answered by yves-surrel
yves-surrel asked this question in Q&A
Mar 31, 2022 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

Here is a working example:

"""
Created on Thu Mar 31 11:25:45 2022
@author: yves

Example of use of GenericScanKernel to calculate a running average.

In this example , the average is done over the 'abscissa', i.e. the index

A moving window sweeps across the buffer, and the indices within the window
are averaged.

The initial state is when the center of the window is at the first point of
the buffer, and the final state is when it is at the last point of the buffer

"""

import numpy as np
from matplotlib.pyplot import plot
import pyopencl as cl
import pyopencl.array as cla
from pyopencl.scan import GenericScanKernel

ctx = cl.create_some_context()

queue = cl.CommandQueue(ctx)

width = …

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@inducer
Comment options

@kif
Comment options

@yves-surrel
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by yves-surrel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants