Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Optimizing compiler for matrix expressions, targeting numpy / MATLAB

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


To build:

runhaskell Setup.hs configure
runhaskell Setup.hs build

If cabal complains about being unable to find a dependency that you know is installed, it might be in your user package db. Try running

runhaskell Setup.hs --user configure

instead. For other common issues with cabal, see

Try running an example:

dist/build/matrizer/matrizer examples/

This should output:

Preamble symbol table: fromList [("X",100x5 []),("y",100x1 [])]
Code parsed as:
w := (* (* (inv (* (transpose X) X)) (transpose X)) y)
Inferred symbol table: fromList [("X",100x5 []),("w",5x1 []),("y",100x1 [])]
Naive FLOPs required: 10563
Naive code generated:
w =, X)), X.T), y)

Optimized flops required: 6061
Optimized program:
w := (cholSolve (* (transpose X) X) (* (transpose X) y))
Optimized code generated:
w = scipy.linalg.cho_solve(scipy.linalg.cho_factor(, X)),, y))

There is currently no documentation, but the examples provide a reasonable guide to what's possible. Currently we support basic matrix operations (addition, multiplication, inverse, transpose, negation, solving linear systems using LU or Cholesky decompositions), matrix properties (diagonal, symmetric, positive definite), and many of the obvious algebraic rewrite rules.

See the file TODO for features we hope to implement.

Something went wrong with that request. Please try again.