コード例 #1
0
ファイル: MatrixC.cs プロジェクト: im281/BioRadDemo
 public static double Determinant(MatrixC m)
 {
     double result = 0.0;
     if (!m.IsSquared())
     {
         throw new ArgumentOutOfRangeException(
          "Dimension", m.GetRows(), "The matrix must be squared!");
     }
     if (m.GetRows() == 1)
         result = m[0, 0];
     else
     {
         for (int i = 0; i < m.GetRows(); i++)
         {
             result += Math.Pow(-1, i)*m[0, i] * Determinant(MatrixC.Minor(m, 0, i));
         }
     }
     return result;
 }
コード例 #2
0
ファイル: MatrixC.cs プロジェクト: im281/BioRadDemo
 public static MatrixC Adjoint(MatrixC m)
 {
     if (!m.IsSquared())
     {
         throw new ArgumentOutOfRangeException(
          "Dimension", m.GetRows(), "The matrix must be squared!");
     }
     MatrixC ma = new MatrixC(m.GetRows(), m.GetCols());
     for (int i = 0; i < m.GetRows(); i++)
     {
         for (int j = 0; j < m.GetCols(); j++)
         {
             ma[i, j] = Math.Pow(-1, i + j) * (Determinant(Minor(m, i, j)));
         }
     }
     return ma.GetTranspose();
 }