https://hal.inria.fr/hal-00923380Griffioen, PaulPaulGriffioenATEAMS - Analysis and Transformation based on rEliAble tool coMpositionS - Inria Lille - Nord Europe - Inria - Institut National de Recherche en Informatique et en Automatique - CWI - Centrum Wiskunde & InformaticaType Inference For Linear Algebra With Units Of MeasurementHAL CCSD2013[INFO.INFO-SE] Computer Science [cs]/Software Engineering [cs.SE]Van Der Storm, Tijs2014-01-02 17:05:342023-03-15 08:52:082014-01-03 09:29:09enReports1Refining types of numerical data with units of measurement has the potential to increase safety of programming languages but is restricted to homogeneous units when checked statically with parametric polymorphism. We lift units to vectors and show how type inference of linear algebra expressions can statically determine safety for data with heterogeneous units. The typing is based on the dyadic product of units that is found in linear transformations and the corresponding vector spaces. Since it is a refinement of Kennedy's types for units we automatically obtain a unification algorithm, which gives principal types for linear algebra. The extension of unit-unification to numerical data with heterogeneous units makes the safety of statically checked numerical expressions available to a significantly larger set of use-cases.