liebke/incanter — pull request #111 by Quantisan (2012-12-23 11:07:20+00:00)
Title: incanter-core use jBLAS through Clatrix library

This is a drop-in replacement for incanter core to use jBLAS through [my branch of the Clatrix library](https://github.com/Quantisan/clatrix). All incanter-core tests are passing but I doubt it's bullet-proof yet. The idea is to decouple matrix computations from incanter and increase performance.

# Motivation

Interest in a jBLAS backed incanter-core started from [this thread on the forum](https://groups.google.com/d/topic/incanter/JiIdkJ3EFiA/discussion).

Clatrix is a standalone clojure matrix library. It provides a Matrix deftype backed by jBLAS and is also a clojure seq so functions like `first`, `next`, and even `map`, `reduce` should all work. Clatrix also has a series of BLAS operations that incanter-core now surfaces.

This could be a first step for incanter-core to be matrix-implementation agnostic so people can just drop in Clatrix or other matrix libs.

Now on to the reason to use BLAS instead of Colt.

## Benchmark

From [incanter-benchmark](https://github.com/Quantisan/incanter-benchmark) comparing this pull request vs incanter 1.4.1.

![plot](https://raw.github.com/Quantisan/incanter-benchmark/master/data/incanter_benchmark_blas.png)

I would imagine much can still be done to speed things up both on the Clatrix side and incanter-core side. In particular, matrix creation is slower on Clatrix/jBLAS because it is transferring data to a native lib.

## Known issues

- matrix print-method hasn't been implemented but just needs to surface the Clatrix print
- QR decomposition removed as jblas doesn't have it yet, a temp solution is to do it manually in incanter for now until we can patch it into jblas
- determinant of matrix function removed for now, can either be computed from LU decomp or added in jblas
- as I aim to keep the code structure as close to the original as possible, there's some redundancy and potential for restructuring the core code base
- compatibility issue in real-world use? as I was saying, even though it pass all tests, some code have been hacked together