public static double Determinant(this double[,] matrix) { if (matrix.ColumnCount() != matrix.RowCount()) { return(double.NaN); //Not a square matrix } return(LUD.ComputeLUD(matrix).Determinant()); }
public static double[,] Solve(this double[,] matrix, double[,] b) { return(matrix.IsSquare() ? (LUD.ComputeLUD(matrix)).Solve(b) : (QRD.ComputeQRD(matrix)).Solve(b)); }