Deterministic and Las Vegas Algorithms for Sparse Nonnegative Convolution

by   Karl Bringmann, et al.

Computing the convolution A⋆ B of two length-n integer vectors A,B is a core problem in several disciplines. It frequently comes up in algorithms for Knapsack, k-SUM, All-Pairs Shortest Paths, and string pattern matching problems. For these applications it typically suffices to compute convolutions of nonnegative vectors. This problem can be classically solved in time O(nlog n) using the Fast Fourier Transform. However, often the involved vectors are sparse and hence one could hope for output-sensitive algorithms to compute nonnegative convolutions. This question was raised by Muthukrishnan and solved by Cole and Hariharan (STOC '02) by a randomized algorithm running in near-linear time in the (unknown) output-size t. Chan and Lewenstein (STOC '15) presented a deterministic algorithm with a 2^O(√(log t·loglog n)) overhead in running time and the additional assumption that a small superset of the output is given; this assumption was later removed by Bringmann and Nakos (ICALP '21). In this paper we present the first deterministic near-linear-time algorithm for computing sparse nonnegative convolutions. This immediately gives improved deterministic algorithms for the state-of-the-art of output-sensitive Subset Sum, block-mass pattern matching, N-fold Boolean convolution, and others, matching up to log-factors the fastest known randomized algorithms for these problems. Our algorithm is a blend of algebraic and combinatorial ideas and techniques. Additionally, we provide two fast Las Vegas algorithms for computing sparse nonnegative convolutions. In particular, we present a simple O(tlog^2t) time algorithm, which is an accessible alternative to Cole and Hariharan's algorithm. We further refine this new algorithm to run in Las Vegas time O(tlog t·loglog t), matching the running time of the dense case apart from the loglog t factor.


Sparse Nonnegative Convolution Is Equivalent to Dense Nonnegative Convolution

Computing the convolution A⋆ B of two length-n vectors A,B is an ubiquit...

Fast n-fold Boolean Convolution via Additive Combinatorics

We consider the problem of computing the Boolean convolution (with wrapa...

Fast and Simple Modular Subset Sum

We revisit the Subset Sum problem over the finite cyclic group ℤ_m for s...

A Subquadratic Algorithm for 3XOR

Given a set X of n binary words of equal length w, the 3XOR problem asks...

A Simple Near-Linear Pseudopolynomial Time Randomized Algorithm for Subset Sum

Given a multiset of n positive integers and a target integer t, the Subs...

Top-k-Convolution and the Quest for Near-Linear Output-Sensitive Subset Sum

In the classical Subset Sum problem we are given a set X and a target t,...

A New Algorithm for Finding Closest Pair of Vectors

Given n vectors x_0, x_1, ..., x_n-1 in {0,1}^m, how to find two vectors...