English

Gaussian Variant of Freivalds' Algorithm for Efficient and Reliable Matrix Product Verification

Data Structures and Algorithms 2017-05-31 v1

Abstract

In this article, we consider the general problem of checking the correctness of matrix multiplication. Given three n×nn \times n matrices AA, BB, and CC, the goal is to verify that A×B=CA \times B=C without carrying out the computationally costly operations of matrix multiplication and comparing the product A×BA \times B with CC, term by term. This is especially important when some or all of these matrices are very large, and when the computing environment is prone to soft errors. Here we extend Freivalds' algorithm to a Gaussian Variant of Freivalds' Algorithm (GVFA) by projecting the product A×BA \times B as well as CC onto a Gaussian random vector and then comparing the resulting vectors. The computational complexity of GVFA is consistent with that of Freivalds' algorithm, which is O(n2)O(n^{2}). However, unlike Freivalds' algorithm, whose probability of a false positive is 2k2^{-k}, where kk is the number of iterations. Our theoretical analysis shows that when A×BCA \times B \neq C, GVFA produces a false positive on set of inputs of measure zero with exact arithmetic. When we introduce round-off error and floating point arithmetic into our analysis, we can show that the larger this error, the higher the probability that GVFA avoids false positives. Moreover, by iterating GVFA kk times, the probability of a false positive decreases as pkp^k, where pp is a very small value depending on the nature of the fault on the result matrix and the arithmetic system's floating-point precision. Unlike deterministic algorithms, there do not exist any fault patterns that are completely undetectable with GVFA. Thus GVFA can be used to provide efficient fault tolerance in numerical linear algebra, and it can be efficiently implemented on modern computing architectures. In particular, GVFA can be very efficiently implemented on architectures with hardware support for fused multiply-add operations.

Keywords

Cite

@article{arxiv.1705.10449,
  title  = {Gaussian Variant of Freivalds' Algorithm for Efficient and Reliable Matrix Product Verification},
  author = {Hao Ji and Michael Mascagni and Yaohang Li},
  journal= {arXiv preprint arXiv:1705.10449},
  year   = {2017}
}
R2 v1 2026-06-22T20:02:57.204Z