rewrite Matrix libraries, add LUPDecomposition