Lienar Algebra: Implement Type monad into matrix library, clean up matrix library