Matrices as arrows!: a biproduct approach to typed linear algebra

  • Authors:
  • Hugo Daniel Macedo;José Nuno Oliveira

  • Affiliations:
  • Minho University, Portugal;Minho University, Portugal

  • Venue:
  • MPC'10 Proceedings of the 10th international conference on Mathematics of program construction
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Motivated by the need to formalize generation of fast running code for linear algebra applications, we show how an index-free, calculational approach to matrix algebra can be developed by regarding matrices as morphisms of a category with biproducts. This shifts the traditional view of matrices as indexed structures to a type-level perspective analogous to that of the pointfree algebra of programming. The derivation of fusion, cancellation and abide laws from the biproduct equations makes it easy to calculate algorithms implementing matrix multiplication, the kernel operation of matrix algebra, ranging from its divide-and-conquer version to the conventional, iterative one. From errant attempts to learn how particular products and coproducts emerge from biproducts, we not only rediscovered block-wise matrix combinators but also found a way of addressing other operations calculationally such as e.g. Gaussian elimination. A strategy for addressing vectorization along the same lines is also given.