public MatrixR LUInverse(MatrixR m) { int n = m.GetRows(); MatrixR u = m.Identity(); LUDecompose(m); VectorR uv = new VectorR(n); for (int i = 0; i < n; i++) { uv = u.GetRowVector(i); LUSubstitute(m, uv); u.ReplaceRow(uv, i); } MatrixR inv = u.GetTranspose(); return(inv); }