Shaikhha, AmirParreaux, Lionel2019-06-142019-06-142019-06-14201910.4230/LIPIcs.ECOOP.2019.25https://infoscience.epfl.ch/handle/20.500.14299/156805Many different data analytics tasks boil down to linear algebra primitives. In practice, for each different type of workload, data scientists use a particular specialised library. In this paper, we present Pilatus, a polymorphic iterative linear algebra language, applicable to various types of data analytics workloads. The design of this domain-specific language (DSL) is inspired by both mathematics and programming languages: its basic constructs are borrowed from abstract algebra, whereas the key technology behind its polymorphic design uses the tagless final approach (a.k.a. polymorphic embedding/object algebras). This design enables us to change the behaviour of arithmetic operations to express matrix algebra, graph algorithms, logical probabilistic programs, and differentiable programs. Crucially, the polymorphic design of Pilatus allows us to use multistage programming and rewrite-based optimisation to recover the performance of specialised code, supporting fixed sized matrices, algebraic optimisations, and fusion.Linear AlgebraDomain-Specific LanguagesTagless FinalPolymorphic Em- beddingObject AlgebraMulti-Stage ProgrammingGraph ProcessingProbabilistic ProgrammingAutomatic DifferentiationFinally, a Polymorphic Linear Algebra Languagetext::conference output::conference paper not in proceedings