English

Computing Generalized Convolutions Faster Than Brute Force

Data Structures and Algorithms 2023-01-31 v2

Abstract

In this paper, we consider a general notion of convolution. Let DD be a finite domain and let DnD^n be the set of nn-length vectors (tuples) of DD. Let f:D×DDf : D \times D \to D be a function and let f\oplus_f be a coordinate-wise application of ff. The ff-Convolution of two functions g,h:Dn{M,,M}g,h : D^n \to \{-M,\ldots,M\} is (gfh)(v):=vg,vhDns.t. vgfvhg(vg)h(vh)(g \otimes_f h)(\textbf{v}) := \sum_{\substack{\textbf{v}_g,\textbf{v}_h \in D^n\\ \text{s.t. } \textbf{v}_g \oplus_f \textbf{v}_h}} g(\textbf{v}_g) \cdot h(\textbf{v}_h) for every vDn\textbf{v} \in D^n. This problem generalizes many fundamental convolutions such as Subset Convolution, XOR Product, Covering Product or Packing Product, etc. For arbitrary function ff and domain DD we can compute ff-Convolution via brute-force enumeration in O~(D2npolylog(M))\widetilde{O}(|D|^{2n}\mathrm{polylog}(M)) time. Our main result is an improvement over this naive algorithm. We show that ff-Convolution can be computed exactly in O~((cD2)npolylog(M))\widetilde{O}((c \cdot |D|^2)^{n}\mathrm{polylog}(M)) for constant c:=3/4c := 3/4 when DD has even cardinality. Our main observation is that a \emph{cyclic partition} of a function f:D×DDf : D \times D \to D can be used to speed up the computation of ff-Convolution, and we show that an appropriate cyclic partition exists for every ff. Furthermore, we demonstrate that a single entry of the ff-Convolution can be computed more efficiently. In this variant, we are given two functions g,h:Dn{M,,M}g,h : D^n \to \{-M,\ldots,M\} alongside with a vector vDn\textbf{v} \in D^n and the task of the ff-Query problem is to compute integer (gfh)(v)(g \otimes_f h)(\textbf{v}). This is a generalization of the well-known Orthogonal Vectors problem. We show that ff-Query can be computed in O~(Dω2npolylog(M))\widetilde{O}(|D|^{\frac{\omega}{2} n}\mathrm{polylog}(M)) time, where ω[2,2.372)\omega \in [2,2.372) is the exponent of currently fastest matrix multiplication algorithm.

Keywords

Cite

@article{arxiv.2209.01623,
  title  = {Computing Generalized Convolutions Faster Than Brute Force},
  author = {Barış Can Esmer and Ariel Kulik and Dániel Marx and Philipp Schepper and Karol Węgrzycki},
  journal= {arXiv preprint arXiv:2209.01623},
  year   = {2023}
}

Comments

We improved constant c, 29 pages, 5 colored figures

R2 v1 2026-06-28T00:42:01.501Z