Document Open Access Logo

Counting Short Vector Pairs by Inner Product and Relations to the Permanent

Authors Andreas Björklund, Petteri Kaski

Thumbnail PDF


  • Filesize: 0.79 MB
  • 21 pages

Document Identifiers

Author Details

Andreas Björklund
  • Lund, Sweden
Petteri Kaski
  • Department of Computer Science, Aalto University, Espoo, Finland


We thank Virginia Vassilevska Williams and Ryan Williams for many useful discussions. We also thank the anonymous reviewers for their useful remarks.

Cite AsGet BibTex

Andreas Björklund and Petteri Kaski. Counting Short Vector Pairs by Inner Product and Relations to the Permanent. In 48th International Colloquium on Automata, Languages, and Programming (ICALP 2021). Leibniz International Proceedings in Informatics (LIPIcs), Volume 198, pp. 29:1-29:21, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2021)


Given as input two n-element sets A, B ⊆ {0,1}^d with d = clog n ≤ (log n)²/(log log n)⁴ and a target t ∈ {0,1,…,d}, we show how to count the number of pairs (x,y) ∈ A× B with integer inner product ⟨ x,y ⟩ = t deterministically, in n²/2^{Ω(√{log nlog log n/(clog² c)})} time. This demonstrates that one can solve this problem in deterministic subquadratic time almost up to log² n dimensions, nearly matching the dimension bound of a subquadratic randomized detection algorithm of Alman and Williams [FOCS 2015]. We also show how to modify their randomized algorithm to count the pairs w.h.p., to obtain a fast randomized algorithm. Our deterministic algorithm builds on a novel technique of reconstructing a function from sum-aggregates by prime residues, or modular tomography, which can be seen as an additive analog of the Chinese Remainder Theorem. As our second contribution, we relate the fine-grained complexity of the task of counting of vector pairs by inner product to the task of computing a zero-one matrix permanent over the integers.

Subject Classification

ACM Subject Classification
  • Theory of computation → Design and analysis of algorithms
  • additive reconstruction
  • Chinese Remainder Theorem
  • counting
  • inner product
  • modular tomography
  • orthogonal vectors
  • permanent


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Amir Abboud, Richard Ryan Williams, and Huacheng Yu. More applications of the polynomial method to algorithm design. In Piotr Indyk, editor, Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 218-230. SIAM, 2015. URL:
  2. Josh Alman. An illuminating algorithm for the light bulb problem. In Jeremy T. Fineman and Michael Mitzenmacher, editors, 2nd Symposium on Simplicity in Algorithms, SOSA@SODA 2019, January 8-9, 2019 - San Diego, CA, USA, volume 69 of OASICS, pages 2:1-2:11. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2019. URL:
  3. Josh Alman, Timothy M. Chan, and R. Ryan Williams. Polynomial representations of threshold functions and algorithmic applications. In Irit Dinur, editor, IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 467-476. IEEE Computer Society, 2016. URL:
  4. Josh Alman, Timothy M. Chan, and R. Ryan Williams. Faster deterministic and Las Vegas algorithms for offline approximate nearest neighbors in high dimensions. In Shuchi Chawla, editor, Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms, SODA 2020, Salt Lake City, UT, USA, January 5-8, 2020, pages 637-649. SIAM, 2020. URL:
  5. Josh Alman and Lijie Chen. Efficient construction of rigid matrices using an NP oracle. In David Zuckerman, editor, 60th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2019, Baltimore, Maryland, USA, November 9-12, 2019, pages 1034-1055. IEEE Computer Society, 2019. URL:
  6. Josh Alman and Ryan Williams. Probabilistic polynomials and hamming nearest neighbors. In Venkatesan Guruswami, editor, IEEE 56th Annual Symposium on Foundations of Computer Science, FOCS 2015, Berkeley, CA, USA, 17-20 October, 2015, pages 136-150. IEEE Computer Society, 2015. URL:
  7. Eric Bach and Jeffrey Shallit. Algorithmic Number Theory. Vol. 1. Foundations of Computing Series. MIT Press, Cambridge, MA, 1996. Efficient algorithms. Google Scholar
  8. Eric T. Bax and Joel Franklin. A permanent algorithm with exp[Ω(N^1/3/2ln N)] expected speedup for 0-1 matrices. Algorithmica, 32(1):157-162, 2002. URL:
  9. Richard Beigel and Jun Tarui. On ACC. Computational Complexity, 4:350-366, 1994. URL:
  10. Andreas Björklund. Below all subsets for some permutational counting problems. In Rasmus Pagh, editor, 15th Scandinavian Symposium and Workshops on Algorithm Theory, SWAT 2016, June 22-24, 2016, Reykjavik, Iceland, volume 53 of LIPIcs, pages 17:1-17:11. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016. URL:
  11. Andreas Björklund, Thore Husfeldt, and Isak Lyckberg. Computing the permanent modulo a prime power. Inf. Process. Lett., 125:20-25, 2017. URL:
  12. Andreas Björklund, Petteri Kaski, and Ryan Williams. Generalized Kakeya sets for polynomial evaluation and faster computation of fermionants. Algorithmica, 81(10):4010-4028, 2019. URL:
  13. Andreas Björklund and Ryan Williams. Computing permanents and counting hamiltonian cycles by listing dissimilar vectors. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece., volume 132 of LIPIcs, pages 25:1-25:14. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2019. URL:
  14. Timothy M. Chan and Ryan Williams. Deterministic APSP, orthogonal vectors, and more: Quickly derandomizing Razborov-Smolensky. In Robert Krauthgamer, editor, Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 1246-1255. SIAM, 2016. URL:
  15. Lijie Chen and Ryan Williams. An equivalence class for orthogonal vectors. In Timothy M. Chan, editor, Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 21-40. SIAM, 2019. URL:
  16. Don Coppersmith. Rapid multiplication of rectangular matrices. SIAM J. Comput., 11(3):467-471, 1982. URL:
  17. Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512-530, 2001. URL:
  18. Matti Karppa, Petteri Kaski, and Jukka Kohonen. A faster subquadratic algorithm for finding outlier correlations. ACM Trans. Algorithms, 14(3):31:1-31:26, 2018. URL:
  19. Donald E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms. Addison-Wesley, Reading, MA, 1998. Google Scholar
  20. Herbert Robbins. A remark on Stirling’s formula. The American Mathematical Monthly, 62(1):26-29, 1955. Google Scholar
  21. J. Barkley Rosser and Lowell Schoenfeld. Approximate formulas for some functions of prime numbers. Ill. J. Math., 6:64-94, 1962. Google Scholar
  22. Herbert John Ryser. Combinatorial Mathematics. The Carus Mathematical Monographs, No. 14. Published by The Mathematical Association of America; distributed by John Wiley and Sons, Inc., New York, 1963. Google Scholar
  23. Gregory Valiant. Finding correlations in subquadratic time, with applications to learning parities and the closest pair problem. J. ACM, 62(2):13:1-13:45, 2015. URL:
  24. Leslie G. Valiant. The complexity of computing the permanent. Theor. Comput. Sci., 8:189-201, 1979. URL:
  25. Joachim von zur Gathen and Jürgen Gerhard. Modern Computer Algebra. Cambridge University Press, third edition, 2013. URL:
  26. Ryan Williams. A new algorithm for optimal 2-constraint satisfaction and its implications. Theor. Comput. Sci., 348(2-3):357-365, 2005. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail