A simple and practical Linear Algebra Library interface with static size checking

Akinori Abe, Eijiro Sumii

Research output: Contribution to journalConference articlepeer-review

2 Citations (Scopus)


Linear algebra is a major field of numerical computation and is widely applied. Most linear algebra libraries (in most programming languages) do not statically guarantee consistency of the dimensions of vectors and matrices, causing runtime errors. While advanced type systems - specifically, dependent types on natural numbers - can ensure consistency among the sizes of collections such as lists and arrays [3,4,22], such type systems generally require non-trivial changes to existing languages and application programs, or tricky type-level programming. We have developed a linear algebra library interface that verifies the consistency (with respect to dimensions) of matrix operations by means of generative phantom types, implemented via fairly standard ML types and module system. To evaluate its usability, we ported to it a practical machine learning library from a traditional linear algebra library. We found that most of the changes required for the porting could be made mechanically, and changes that needed human thought are minor.

Original languageEnglish
Pages (from-to)1-21
Number of pages21
JournalElectronic Proceedings in Theoretical Computer Science, EPTCS
Publication statusPublished - 2015 Dec 5
EventML Family/OCaml Users and Developers Workshops, ML 2014 - Gothenburg, Sweden
Duration: 2014 Sep 42014 Sep 5

ASJC Scopus subject areas

  • Software


Dive into the research topics of 'A simple and practical Linear Algebra Library interface with static size checking'. Together they form a unique fingerprint.

Cite this