Beispiel #1
0
        private static void InnerRREchelon(MatrisBase <object> A, MatrisBase <object> result)
        {
            int lead = 0;
            int nr   = A.Row;
            int nc   = A.Col;

            for (int r = 0; r < nr; r++)
            {
                if (nc <= lead)
                {
                    break;
                }
                int i = r;
                while (float.Parse(result[i, lead].ToString()) == (float)0.0)
                {
                    i++;
                    if (nr == i)
                    {
                        i = r;
                        lead++;
                        if (nc == lead)
                        {
                            break;
                        }
                    }
                }

                if (nc == lead)
                {
                    break;
                }
                result.Swap(i, r, 0, 0);

                if (float.Parse(result[r, lead].ToString()) != (float)0.0)
                {
                    result.MulRow(r, (float)1.0 / float.Parse(result[r, lead].ToString()), 0);
                }
                for (int j = 0; j < nr; j++)
                {
                    if (j != r)
                    {
                        for (int k = 0; k < nc; k++)
                        {
                            result.MulThenSubFromOtherRow(r, float.Parse(result[j, lead].ToString()), j, 0);
                        }
                    }
                }
                lead++;
            }

            result.FixMinusZero();
        }