Barış Can Esmer, Ariel Kulik, Dániel Marx, Philipp Schepper, Karol Węgrzycki
{"title":"Computing Generalized Convolutions Faster Than Brute Force","authors":"Barış Can Esmer, Ariel Kulik, Dániel Marx, Philipp Schepper, Karol Węgrzycki","doi":"10.1007/s00453-023-01176-2","DOIUrl":null,"url":null,"abstract":"<div><p>In this paper, we consider a general notion of convolution. Let <span>\\(D\\)</span> be a finite domain and let <span>\\(D^n\\)</span> be the set of <i>n</i>-length vectors (tuples) of <span>\\(D\\)</span>. Let <span>\\(f :D\\times D\\rightarrow D\\)</span> be a function and let <span>\\(\\oplus _f\\)</span> be a coordinate-wise application of <i>f</i>. The <span>\\(f\\)</span>-<span>Convolution</span> of two functions <span>\\(g,h :D^n \\rightarrow \\{-M,\\ldots ,M\\}\\)</span> is </p><div><div><span>$$\\begin{aligned} (g \\mathbin {\\circledast _{f}}h)(\\textbf{v}) {:}{=}\\sum _{\\begin{array}{c} \\textbf{v}_g,\\textbf{v}_h \\in D^n\\\\ \\text {s.t. } \\textbf{v}= \\textbf{v}_g \\oplus _f \\textbf{v}_h \\end{array}} g(\\textbf{v}_g) \\cdot h(\\textbf{v}_h) \\end{aligned}$$</span></div></div><p>for every <span>\\(\\textbf{v}\\in D^n\\)</span>. This problem generalizes many fundamental convolutions such as Subset Convolution, XOR Product, Covering Product or Packing Product, etc. For arbitrary function <i>f</i> and domain <span>\\(D\\)</span> we can compute <span>\\(f\\)</span>-<span>Convolution</span> via brute-force enumeration in <span>\\(\\widetilde{{\\mathcal {O}}}(|D|^{2n} \\cdot \\textrm{polylog}(M))\\)</span> time. Our main result is an improvement over this naive algorithm. We show that <span>\\(f\\)</span>-<span>Convolution</span> can be computed exactly in <span>\\(\\widetilde{{\\mathcal {O}}}( (c \\cdot |D|^2)^{n} \\cdot \\textrm{polylog}(M))\\)</span> for constant <span>\\(c {:}{=}3/4\\)</span> when <span>\\(D\\)</span> has even cardinality. Our main observation is that a <i>cyclic partition</i> of a function <span>\\(f :D\\times D\\rightarrow D\\)</span> can be used to speed up the computation of <span>\\(f\\)</span>-<span>Convolution</span>, and we show that an appropriate cyclic partition exists for every <i>f</i>. Furthermore, we demonstrate that a single entry of the <span>\\(f\\)</span>-<span>Convolution</span> can be computed more efficiently. In this variant, we are given two functions <span>\\(g,h :D^n \\rightarrow \\{-M,\\ldots ,M\\}\\)</span> alongside with a vector <span>\\(\\textbf{v}\\in D^n\\)</span> and the task of the <span>\\(f\\)</span>-<span>Query</span> problem is to compute integer <span>\\((g \\mathbin {\\circledast _{f}}h)(\\textbf{v})\\)</span>. This is a generalization of the well-known Orthogonal Vectors problem. We show that <span>\\(f\\)</span>-<span>Query</span> can be computed in <span>\\(\\widetilde{{\\mathcal {O}}}(|D|^{\\frac{\\omega }{2} n} \\cdot \\textrm{polylog}(M))\\)</span> time, where <span>\\(\\omega \\in [2,2.372)\\)</span> is the exponent of currently fastest matrix multiplication algorithm.</p></div>","PeriodicalId":50824,"journal":{"name":"Algorithmica","volume":"86 1","pages":"334 - 366"},"PeriodicalIF":0.9000,"publicationDate":"2023-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://link.springer.com/content/pdf/10.1007/s00453-023-01176-2.pdf","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Algorithmica","FirstCategoryId":"94","ListUrlMain":"https://link.springer.com/article/10.1007/s00453-023-01176-2","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0
Abstract
In this paper, we consider a general notion of convolution. Let \(D\) be a finite domain and let \(D^n\) be the set of n-length vectors (tuples) of \(D\). Let \(f :D\times D\rightarrow D\) be a function and let \(\oplus _f\) be a coordinate-wise application of f. The \(f\)-Convolution of two functions \(g,h :D^n \rightarrow \{-M,\ldots ,M\}\) is
for every \(\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 f and domain \(D\) we can compute \(f\)-Convolution via brute-force enumeration in \(\widetilde{{\mathcal {O}}}(|D|^{2n} \cdot \textrm{polylog}(M))\) time. Our main result is an improvement over this naive algorithm. We show that \(f\)-Convolution can be computed exactly in \(\widetilde{{\mathcal {O}}}( (c \cdot |D|^2)^{n} \cdot \textrm{polylog}(M))\) for constant \(c {:}{=}3/4\) when \(D\) has even cardinality. Our main observation is that a cyclic partition of a function \(f :D\times D\rightarrow D\) can be used to speed up the computation of \(f\)-Convolution, and we show that an appropriate cyclic partition exists for every f. Furthermore, we demonstrate that a single entry of the \(f\)-Convolution can be computed more efficiently. In this variant, we are given two functions \(g,h :D^n \rightarrow \{-M,\ldots ,M\}\) alongside with a vector \(\textbf{v}\in D^n\) and the task of the \(f\)-Query problem is to compute integer \((g \mathbin {\circledast _{f}}h)(\textbf{v})\). This is a generalization of the well-known Orthogonal Vectors problem. We show that \(f\)-Query can be computed in \(\widetilde{{\mathcal {O}}}(|D|^{\frac{\omega }{2} n} \cdot \textrm{polylog}(M))\) time, where \(\omega \in [2,2.372)\) is the exponent of currently fastest matrix multiplication algorithm.
期刊介绍:
Algorithmica is an international journal which publishes theoretical papers on algorithms that address problems arising in practical areas, and experimental papers of general appeal for practical importance or techniques. The development of algorithms is an integral part of computer science. The increasing complexity and scope of computer applications makes the design of efficient algorithms essential.
Algorithmica covers algorithms in applied areas such as: VLSI, distributed computing, parallel processing, automated design, robotics, graphics, data base design, software tools, as well as algorithms in fundamental areas such as sorting, searching, data structures, computational geometry, and linear programming.
In addition, the journal features two special sections: Application Experience, presenting findings obtained from applications of theoretical results to practical situations, and Problems, offering short papers presenting problems on selected topics of computer science.