EJML for Clojure (Work in Progress)


Today I pushed to GitHub clojure-ejml, an (incomplete) implementation of Clojure core.matrix API for Efficient Java Matrix Library.

There are many reasons to choose EJML over other Java matrix libraries. It is a pure Java, small (340 K), very portable library, and its performance is indeed very good. It also lends itself well to functional style of programming (there are many static members, few classes).

So, I started using it in my Clojure code. And finally decided that implementing a common interoperable API (core.matrix) might be better than using a bunch of adhoc wrappers. It turned out to be more work that I expected, but the stuff mostly works now. Right now only DenseMatrix64F type is supported.

I also want to use the project as a test bed to propose some linear algebra extension to core.matrix API. Some common linear algebra functionality is not covered by core.matrix (see a table in clojure.core.matrix.lingalg): decompositions, eigenvalues, norms, linear solvers. I'd like to propose a bunch of protocols which simulate NumPy facilities. It's on TODO. If the idea is successful, they may be contributed to core.matrix. Otherwise, they may be extracted into a standalone library.

EJML supports only 2D matrices, vectors are either row vectors, or column vectors. There is some impendance mismatch with how core.matrix is designed, because it expects 1D results even if the implementation doesn't declare 1D support. In short, there are rough edge cases, don't expect clojure-ejml to be a drop-in replacement for any other implementation. But it should become eventually. I'd really appreciate some help.