/// <summary> /// 取(i+1,j+1)的余子式 /// </summary> /// <param name="i">行标减1</param> /// <param name="j">列标减1</param> /// <returns>返回该处的余子式(以行列式的形式返回)</returns> private Determinant GetMinorMij(int i, int j) { double[][] table = new double[this.Order - 1][]; for (int Mrow = 0, Orow = 0; Orow < Order; Orow++) { table[Mrow] = new double[this.Order - 1]; if (Orow == i) { continue; } for (int Mcol = 0, Ocol = 0; Ocol < Order; Ocol++) { if (Ocol == j) { continue; } else { table[Mrow][Mcol] = this.m_dSquare[Orow][Ocol]; Mcol++; } } Mrow++; } Determinant det = new Determinant(table); return(det); }
/// <summary> /// 求矩阵的行列式的值 /// </summary> /// <returns>行列式的结果,若不为方阵则返回0</returns> public double Determinant() { if (!this.Row.Equals(this.Column)) { Console.WriteLine("error:Square Matrix has determinant"); return(0); } Determinant det = new Determinant(this.m_dData); return(det.CalculateDet()); }