Ejemplo n.º 1
0
 public static DataGridView MatrixInversion(DataGridView dataGridView1, DataGridView dataGridView3)
 {
     if (DoCheckVoid(dataGridView3))
     {
         double[][] array = MatrixCalculator.GridToArray(dataGridView1);
         if (CheckDeterminant(array, dataGridView1.RowCount, dataGridView1.ColumnCount))
         {
             double[][] inverse = InversingHelp.MatrixInverse(array);
             dataGridView3         = ArrayToGrid(inverse, dataGridView3, dataGridView1.RowCount, dataGridView1.ColumnCount);
             dataGridView3.Visible = true;
         }
         else
         {
             MessageBox.Show("Детерминант 0 как бэ");
         }
     }
     return(dataGridView3);
 }
Ejemplo n.º 2
0
        public static bool CheckDeterminant(double[][] array, int n, int m)
        {
            float[,] temp = new float[n, m];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    temp[i, j] = (float)array[i][j];
                }
            }
            if (Math.Truncate(InversingHelp.MatrixDeterminant(temp, n, m)) == 1 || Math.Truncate(InversingHelp.MatrixDeterminant(temp, n, m)) == 0)
            {
                return(false);
            }

            else
            {
                MessageBox.Show(Math.Truncate(InversingHelp.MatrixDeterminant(temp, n, m)).ToString());
                return(true);
            }
        }