예제 #1
0
파일: MatrixC.cs 프로젝트: im281/BioRadDemo
 public MatrixC(MatrixC m)
 {
     Rows = m.GetRows();
     Cols = m.GetCols();
     matrix = m.matrix;
 }
예제 #2
0
파일: MatrixC.cs 프로젝트: im281/BioRadDemo
 public static VectorC Transform(VectorC v, MatrixC m)
 {
     VectorC result = new VectorC(v.GetSize());
     //if (!m.IsSquared())
     //{
     //    throw new ArgumentOutOfRangeException(
     //     "Dimension", m.GetRows(), "The matrix must be squared!");
     //}
     //if (m.GetRows() != v.GetSize())
     //{
     //    throw new ArgumentOutOfRangeException(
     //     "Size", v.GetSize(), "The size of the vector must be equal"
     //     + "to the number of rows of the matrix!");
     //}
     for (int i = 0; i < m.GetRows(); i++)
     {
         result[i] = 0.0;
         for (int j = 0; j < m.GetCols(); j++)
         {
             result[i] += v[j] * m[j, i];
         }
     }
     return result;
 }
예제 #3
0
파일: MatrixC.cs 프로젝트: im281/BioRadDemo
 public static bool CompareDimension(MatrixC m1, MatrixC m2)
 {
     if (m1.GetRows() == m2.GetRows() && m1.GetCols() == m2.GetCols())
         return true;
     else
         return false;
 }
예제 #4
0
파일: MatrixC.cs 프로젝트: im281/BioRadDemo
 public static MatrixC Minor(MatrixC m, int row, int col)
 {
     MatrixC mm = new MatrixC(m.GetRows() - 1, m.GetCols() - 1);
     int ii = 0, jj = 0;
     for (int i = 0; i < m.GetRows(); i++)
     {
         if (i == row)
             continue;
         jj = 0;
         for (int j = 0; j < m.GetCols(); j++)
         {
             if (j == col)
                 continue;
             mm[ii, jj] = m[i, j];
             jj++;
         }
         ii++;
     }
     return mm;
 }
예제 #5
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();
 }