对高效流滑动窗口处理的建议(Advice for efficient stream sliding window processing)

在每次t(每10ms)我收到一组整数

{i_{0,t}, i_{1,t}, i_{2,t}}_t

进入单独的缓冲区:

seq_0 = [...,i_{0,t-2},i_{0,t-1},i_{0,t},...], seq_1 and seq_2

我需要对一组不同大小的滑动窗口的序列进行实时计算。 例如:对于大小为3的滑动窗口,我将计算在每个缓冲序列中在时间t , t-1 , t-2接收的样本上的函数f() 。

at time t for seq_0 I compute f([i_{0,t-2},i_{0,t-1},i_{0,t}])

我想要使​​用数据结构(c ++)或代码设计的一些建议。 在实践中,我想要4种不同尺寸的推拉窗。

提前致谢。

At each time t (every 10ms) I receive a set of ints

{i_{0,t}, i_{1,t}, i_{2,t}}_t

which goes into separate buffers:

seq_0 = [...,i_{0,t-2},i_{0,t-1},i_{0,t},...], seq_1 and seq_2

I need to make real-time computations on the sequences for a set of sliding window of different sizes. For example: for a sliding window of size 3, I will compute function f() on samples received at time t, t-1, t-2 in each buffered sequences.

at time t for seq_0 I compute f([i_{0,t-2},i_{0,t-1},i_{0,t}])

I would like some advice for data structure (c++) to use or code design. In practice I would like 4 different sizes of sliding window.

Thanks in advance.

最满意答案

您可以使用大小等于最大窗口宽度的循环缓冲区 。

You could use a circular buffer with the size equal to the width of the largest window.

对高效流滑动窗口处理的建议(Advice for efficient stream sliding window processing)

在每次t(每10ms)我收到一组整数

{i_{0,t}, i_{1,t}, i_{2,t}}_t

进入单独的缓冲区:

seq_0 = [...,i_{0,t-2},i_{0,t-1},i_{0,t},...], seq_1 and seq_2

我需要对一组不同大小的滑动窗口的序列进行实时计算。 例如:对于大小为3的滑动窗口,我将计算在每个缓冲序列中在时间t , t-1 , t-2接收的样本上的函数f() 。

at time t for seq_0 I compute f([i_{0,t-2},i_{0,t-1},i_{0,t}])

我想要使​​用数据结构(c ++)或代码设计的一些建议。 在实践中,我想要4种不同尺寸的推拉窗。

提前致谢。

At each time t (every 10ms) I receive a set of ints

{i_{0,t}, i_{1,t}, i_{2,t}}_t

which goes into separate buffers:

seq_0 = [...,i_{0,t-2},i_{0,t-1},i_{0,t},...], seq_1 and seq_2

I need to make real-time computations on the sequences for a set of sliding window of different sizes. For example: for a sliding window of size 3, I will compute function f() on samples received at time t, t-1, t-2 in each buffered sequences.

at time t for seq_0 I compute f([i_{0,t-2},i_{0,t-1},i_{0,t}])

I would like some advice for data structure (c++) to use or code design. In practice I would like 4 different sizes of sliding window.

Thanks in advance.

最满意答案

您可以使用大小等于最大窗口宽度的循环缓冲区 。

You could use a circular buffer with the size equal to the width of the largest window.