Table of Contents
Fetching ...

How to Compute a Moving Sum

David K. Maslen, Daniel N. Rockmore

TL;DR

This work presents a unifying theory and practical toolkit for windowed recurrences, including moving sums and related sliding-window computations. It introduces an algebraic foundation based on semi-associativity, set actions, and semidirect products to model composition and evaluation of windowed operations, enabling both sequential and vectorized/ parallel implementations. The text then develops multiple families of algorithms (Two Stacks, DEW, DABA/DABA Lite, SlickDeque) with quantified complexities and streaming capabilities, and extends the theory to nonassociative and multi-domain settings via a metastructure that reduces to associative computation through representations of function composition. The resulting framework connects classical prefix-sum techniques to modern parallel/reduction theory, providing scalable, low-latency methods and a pathway to vectorized implementations for user-defined operations. Overall, the monograph offers both rigorous algebraic foundations and practical algorithms for a broad class of windowed recurrence problems across disciplines, with clear guidance for vectorization, streaming, and generalization to categories and magmoids.

Abstract

Windowed recurrences are sliding window calculations where a function is applied iteratively across the window of data, and are ubiquitous throughout the natural, social, and computational sciences. In this monograph we explore the computational aspects of these calculations, including sequential and parallel computation, and develop the theory underlying the algorithms and their applicability. We introduce an efficient new sequential algorithm with low latency, and develop new techniques to derive and analyze the complexity and domain of validity of existing sequential algorithms. For parallel computation we derive new parallel and vector algorithms by relating windowed recurrences to the algebraic construction of semidirect products, and to algorithms for exponentiation in semigroups. In the middle chapters of the monograph we further develop the theory of semi-associativity and the algebraic conditions for representing function composition and function application by data. This systematizes the techniques used by practitioners to parallelize recurrence calculations. We end the monograph with an extensive gallery of examples of interest to specialists in many fields. Throughout the monograph new algorithms are described with pseudo-code transcribed from functioning source code.

How to Compute a Moving Sum

TL;DR

This work presents a unifying theory and practical toolkit for windowed recurrences, including moving sums and related sliding-window computations. It introduces an algebraic foundation based on semi-associativity, set actions, and semidirect products to model composition and evaluation of windowed operations, enabling both sequential and vectorized/ parallel implementations. The text then develops multiple families of algorithms (Two Stacks, DEW, DABA/DABA Lite, SlickDeque) with quantified complexities and streaming capabilities, and extends the theory to nonassociative and multi-domain settings via a metastructure that reduces to associative computation through representations of function composition. The resulting framework connects classical prefix-sum techniques to modern parallel/reduction theory, providing scalable, low-latency methods and a pathway to vectorized implementations for user-defined operations. Overall, the monograph offers both rigorous algebraic foundations and practical algorithms for a broad class of windowed recurrence problems across disciplines, with clear guidance for vectorization, streaming, and generalization to categories and magmoids.

Abstract

Windowed recurrences are sliding window calculations where a function is applied iteratively across the window of data, and are ubiquitous throughout the natural, social, and computational sciences. In this monograph we explore the computational aspects of these calculations, including sequential and parallel computation, and develop the theory underlying the algorithms and their applicability. We introduce an efficient new sequential algorithm with low latency, and develop new techniques to derive and analyze the complexity and domain of validity of existing sequential algorithms. For parallel computation we derive new parallel and vector algorithms by relating windowed recurrences to the algebraic construction of semidirect products, and to algorithms for exponentiation in semigroups. In the middle chapters of the monograph we further develop the theory of semi-associativity and the algebraic conditions for representing function composition and function application by data. This systematizes the techniques used by practitioners to parallelize recurrence calculations. We end the monograph with an extensive gallery of examples of interest to specialists in many fields. Throughout the monograph new algorithms are described with pseudo-code transcribed from functioning source code.

Paper Structure

This paper contains 103 sections, 58 theorems, 365 equations, 16 algorithms.

Key Result

Lemma 3.5

For the four variants Combined-Insert-Evict, Evict-Insert, Variant 3, Variant 4, we have where $X$ is one of CIE, EI, V3, V4. For Insert-Evict

Theorems & Definitions (244)

  • Example 2.4: Moving Sums with Missing Data
  • Example 2.5: Moving Products
  • Example 2.6: Moving Sums and Products with Binary Operations
  • Example 2.7: Moving Max and Min
  • Example 2.8: Fill Forward
  • Example 2.9: Sliding Window Continued Fractions
  • Example 2.10: Moving Sums with Scale Changes
  • Example 2.11: Moving Sums with Sign Changes
  • Example 3.3: Stacked Staggered Sequence Diagram
  • Lemma 3.5
  • ...and 234 more