public static double[,] PseudoInverse(this double[,] m) { SingularValueDecomposition svd = new SingularValueDecomposition(m); return(svd.Solve(Matrix.Diagonal(m.GetLength(0), m.GetLength(1), 1.0))); }
/// <summary> /// Inverse of the matrix if matrix is square, pseudoinverse otherwise. /// </summary> public static double[,] Inverse(this double[,] m) { return(m.Solve(Matrix.Diagonal(m.GetLength(0), 1.0))); }