public static double Determinant(GMatrix m) { if (m.NumRows == m.NumCols) { GaussianElimination.Solve(m.NumRows, m.elements.Vector, null, out double determinant, null, null, null, 0, null); return(determinant); } Debug.Assert(false, "Matrix must be square."); return(double.NaN); }
public static GMatrix Inverse(GMatrix m, out bool invertible) { invertible = false; if (m.NumRows == m.NumCols) { double[] invM = new double[m.NumRows * m.NumCols]; invertible = GaussianElimination.Solve(m.NumRows, m.elements.Vector, invM, out _, null, null, null, 0, null); return(new GMatrix(m.NumRows, m.NumCols, invM)); } Debug.Assert(false, "Matrix must be square."); return(new GMatrix(0, 0)); }