### Matrix Expressions and BLAS/LAPACK; SciPy 2013 Presentation

#### Summary

Authors: Rocklin, Matthew, University of Chicago Computer Science

Track: General

Numeric linear algebra is important ubiquitous. The BLAS/LAPACK libraries include high performance implementations of DLA algorithms in a variety of mathematical situations. They are underused because

The interface is challenging to scientific users The number of routines is huge, pressuring users to select general routines rather than finding the one that best fits their situation. I demonstrate a small DSL for Matrix Algebra[1] embedded in the SymPy project [2]. I use logic programming to infer attributes about larger matrix expressions [3]. I describe the BLAS and LAPACK libraries programmatically [4] and use strategic programming [5] to automatically build directed acyclic graphs of BLAS/LAPACK operations to compute complex expressions [6]. From these I generate readable Fortran code [7]. I then use f2py to bring this back into Python. The result is a clean mathematical interface that efficiently generates mathematically informed numeric code. I compare these results against other popular numeric packages like NumPy and Theano.

Philosophically I'll plug the following ideas

Multiple clean intermediate representations - Aside from a runnable Python function this project also generates perfectly readable Fortran90 code and a directed acyclic graph. I'll briefly show that the availability of the DAG representation opens up the possibility of static scheduling. Declarative programming - All of the math in this project is defined separately from the algorithms, increasing opportunities for independent development. I'll probably talk about separating what code from how code. I may evangelize a bit about small, modular and generally applicable projects.