Table of Contents
Fetching ...

Faster arbitrary-precision dot product and matrix multiplication

Fredrik Johansson

TL;DR

This work targets efficient real and complex dot product and matrix multiplication in arbitrary-precision and ball arithmetic, implemented in the Arb library. By treating the dot product as an atomic operation and using a two-pass fixed-point accumulation, the authors achieve major speedups for basecase polynomial and matrix operations, while preserving per-entry accuracy; they also develop a scalable scaled-integer block approach for large matrices that leverages FLINT for high-performance integer arithmetic. The results show significant speedups over MPFR/MPC across a range of precisions and problem sizes, with competitive precision guarantees and practical applicability to large-scale linear algebra and polynomial computations. The paper argues that these methods offer a flexible, accurate, and efficient path for high-precision numerical computation in scientific computing pipelines.

Abstract

We present algorithms for real and complex dot product and matrix multiplication in arbitrary-precision floating-point and ball arithmetic. A low-overhead dot product is implemented on the level of GMP limb arrays; it is about twice as fast as previous code in MPFR and Arb at precision up to several hundred bits. Up to 128 bits, it is 3-4 times as fast, costing 20-30 cycles per term for floating-point evaluation and 40-50 cycles per term for balls. We handle large matrix multiplications even more efficiently via blocks of scaled integer matrices. The new methods are implemented in Arb and significantly speed up polynomial operations and linear algebra.

Faster arbitrary-precision dot product and matrix multiplication

TL;DR

This work targets efficient real and complex dot product and matrix multiplication in arbitrary-precision and ball arithmetic, implemented in the Arb library. By treating the dot product as an atomic operation and using a two-pass fixed-point accumulation, the authors achieve major speedups for basecase polynomial and matrix operations, while preserving per-entry accuracy; they also develop a scalable scaled-integer block approach for large matrices that leverages FLINT for high-performance integer arithmetic. The results show significant speedups over MPFR/MPC across a range of precisions and problem sizes, with competitive precision guarantees and practical applicability to large-scale linear algebra and polynomial computations. The paper argues that these methods offer a flexible, accurate, and efficient path for high-precision numerical computation in scientific computing pipelines.

Abstract

We present algorithms for real and complex dot product and matrix multiplication in arbitrary-precision floating-point and ball arithmetic. A low-overhead dot product is implemented on the level of GMP limb arrays; it is about twice as fast as previous code in MPFR and Arb at precision up to several hundred bits. Up to 128 bits, it is 3-4 times as fast, costing 20-30 cycles per term for floating-point evaluation and 40-50 cycles per term for balls. We handle large matrix multiplications even more efficiently via blocks of scaled integer matrices. The new methods are implemented in Arb and significantly speed up polynomial operations and linear algebra.

Paper Structure

This paper contains 20 sections, 5 equations, 4 figures, 5 tables, 2 algorithms.

Figures (4)

  • Figure 1: The accumulator $s_{n_s-1}, \ldots, s_0$ and the term $t_{n_t-1}, \ldots, t_0$, prior to limb alignment. More significant limbs are shown towards the left.
  • Figure 2: Matrix multiplication $C = AB$ using scaled blocks.
  • Figure 3: Dot product cost (cycles/term) as a function of the precision $p$, using MPFR, simple Arb code (arb_addmul in a loop), and Algorithm \ref{['alg:dot']} in Arb (both ball and approximate floating-point versions).
  • Figure 4: Speedup of Arb 2.15 over 2.14 for various operations on polynomials (top) and matrices (bottom), here for $p = 64$ and complex coefficients.