Hi Morten,
I'm not sure if I've understood correctly what you're interested in.
Usually, the results are more stable numerically if you directly solve
the equation using one of the functions in the org.jblas.Solve class.
What you can do is to decompose a matrix first via SVD and then
compute the inverse of a vector quickly.
So in essence, you say that X = USV', where U and V are matrices with
the singular vectors in the columns, and S is a diagonal matrix which
contains the singular values. Then, you can compute the inverse by
X^-1 = V S^-1 U'
Computing the inverse of S is simple, you only have to invert the
elements on the diagonal. You should probably regularize a bit, for
example by mapping the entries s => 1 / (s + e) where e is small, for
example 10^-6 or so.
In code, this would look like this:
DoubleMatrix X = new DoubleMatrix(...);
DoubleMatrix y = new DoubleMatrix(...); // a vector
DoubleMatrix[] svd = Singular.sparseSVD(X);
double eps = 1e-6;
DoubleMatrix invS = svd.add(eps).rdiv(1.0);
DoubleMatrix z =
svd[2].mmul(DoubleMatrix.diag(invS).mmul(svd[0].transpose().mmul(y)));
If I'm not mistaken ;)
-M