Exemple #1
0
 private double[,] CalcLXB(int n, int m, double[,] L, double[,] X, double[,] B)
 {
     double[,] T = new double[n, m];
     MatrixOperation.MultiplicationMatr(n, n, m, L, X, out T);
     MatrixOperation.MultiplicationMatr(m, n, m, T, B, out T);
     return(T);
 }
Exemple #2
0
 private double[,] CalcLXF(int n, int m, double[,] L, double[,] X, double[,] F)
 {
     double[,] T = new double[n, n];
     double[,] G = new double[n, m];
     MatrixOperation.MultiplicationMatr(n, n, m, L, X, out G);
     MatrixOperation.MultiplicationMatr(m, n, n, G, F, out T);
     return(T);
 }
 private double[,]  CalcLAX(int m, double[,] L, double[,] A, double[,] X)
 {
     double[,] T = new double[m, m];
     double[,] G = new double[m, m];
     MatrixOperation.MultiplicationMatr(m, m, m, L, A, out G);
     MatrixOperation.MultiplicationMatr(m, m, m, G, X, out T);
     return(T);
 }
Exemple #4
0
 private double[,] CalcLC(int n, int m, double[,] L, double[,] C)
 {
     double[,] T = new double[n, m];
     MatrixOperation.MultiplicationMatr(n, n, m, L, C, out T);
     return(T);
 }
Exemple #5
0
 private double[,] CalcKX(int n, int m, double[,] K, double[,] X)
 {
     double[,] T = new double[n, m];
     MatrixOperation.MultiplicationMatr(n, n, m, K, X, out T);
     return(T);
 }
Exemple #6
0
 private double[,] CalcLA(int n, int m, double[,] L, double[,] A)
 {
     double[,] T = new double[n, n];
     MatrixOperation.MultiplicationMatr(n, n, n, L, A, out T);
     return(T);
 }
Exemple #7
0
        private void MethoHOVR()
        {
            double[,] T1 = new double[n, n];
            double[,] T2 = new double[n, n];
            double[,] T3 = new double[n, m];
            double[,] T4 = new double[n, m];
            double[,] T5 = new double[n, m];
            double norma;

            XK = new double[n, m];
            k  = 0;

            do
            {
                Thread thear1 = new Thread(() => { T1 = CalcLXF(n, m, LE, X_0, F); });
                Thread thear2 = new Thread(() => { T2 = CalcLA(n, m, LE, A); });
                Thread thear3 = new Thread(() => { T3 = CalcKX(n, m, KE, X_0); });
                Thread thear4 = new Thread(() => { T4 = CalcLXB(n, m, LE, X_0, B); });
                Thread thear5 = new Thread(() => { T5 = CalcLC(n, m, LE, C); });
                thear1.Start();
                thear2.Start();
                thear3.Start();
                thear4.Start();
                thear5.Start();
                thear1.Join();
                thear2.Join();
                thear3.Join();
                thear4.Join();
                thear5.Join();
                MatrixOperation.AddMatr(n, T1, T2, out T1);
                MatrixOperation.AddMatr(n, T1, KE, out T1);
                MatrixOperation.SerchObernen(n, T1, out T1);
                MatrixOperation.DifferenceMatr(n, m, T3, T4, out T3);
                MatrixOperation.DifferenceMatr(n, m, T3, T5, out T3);
                MatrixOperation.MultiplicationMatr(n, n, m, T1, T3, out T3);
                norma = MatrixOperation.NormaMax(n, m, T3, X_0);
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        X_0[i, j] = T3[i, j];
                    }
                }
                k++;
            }while (norma > eps);
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    XK[i, j] = T1[i, j];
                }
            }
            string temp = null;

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    temp += XK[i, j].ToString("E5") + "   ";
                }
                result_value.Document.Blocks.Add(new Paragraph(new Run(temp)));
                temp = null;
            }
            result_value.Document.Blocks.Add(new Paragraph(new Run("Кількість ітерацій: " + k.ToString())));
        }
 private double[,] CalcLA(int m, double[,] L, double[,] A)
 {
     double[,] G = new double[m, m];
     MatrixOperation.MultiplicationMatr(m, m, m, L, A, out G);
     return(G);
 }
        private void MethoHOV()
        {
            double[,] T1 = new double[m, m];
            double[,] T2 = new double[m, m];
            double[,] T3 = new double[m, m];
            double[,] T4 = new double[m, m];

            Yn = new double[n - 2][, ];
            Y0 = new double[n - 2][, ];

            double norma;

            XK = new double[m, m];
            k  = 0;

            MatrixOperation.SerchObernen(m, X_0, out T1); /// x_0^-1
            // Y_0_n
            for (int i = 0; i < n - 2; i++)
            {
                Y0[i] = new double[m, m];
                Yn[i] = new double[m, m];
            }
            if (n - 2 != 0)
            {
                for (int i = 0; i < m; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        Y0[0][i, j] = T1[i, j];
                    }
                }
            }
            for (int i = 1; i < n - 2; i++)
            {
                Y0[i] = new double[m, m];
                MatrixOperation.PowMatr(m, i, T1, out Y0[i]);
            }
            //
            do
            {
                //Y_n
                if (n - 2 != 0)
                {
                    T2 = CalcLAX(m, LE, An[n], X_0);
                    MatrixOperation.AddMatr(m, T2, KE, out T2);
                    MatrixOperation.SerchObernen(m, T2, out T2);
                    MatrixOperation.MultiplicationMatr(m, m, m, LE, An[n], out T3);
                    MatrixOperation.MultiplicationMatr(m, m, m, KE, Y0[0], out T4);
                    MatrixOperation.AddMatr(m, T3, T4, out T3);
                    MatrixOperation.MultiplicationMatr(m, m, m, T2, T3, out Yn[0]);
                }
                for (int i = 1; i < n - 2; i++)
                {
                    MatrixOperation.MultiplicationMatr(m, m, m, LE, An[n], out T3);
                    MatrixOperation.MultiplicationMatr(m, m, m, T3, Yn[i - 1], out T3);
                    MatrixOperation.MultiplicationMatr(m, m, m, KE, Y0[i], out T4);
                    MatrixOperation.AddMatr(m, T3, T4, out T3);
                    MatrixOperation.MultiplicationMatr(m, m, m, T2, T3, out Yn[i]);
                }
                // X_n
                Thread thear1 = new Thread(() => { T1 = CalcLAX(m, LE, An[n], X_0); });
                Thread thear2 = new Thread(() => { T2 = CalcLA(m, LE, An[n - 1]); });
                Thread thear3 = new Thread(() => { T3 = CalcLA(m, LE, An[n - 2]); });
                thear1.Start();
                thear2.Start();
                thear3.Start();
                thear1.Join();
                thear2.Join();
                thear3.Join();

                MatrixOperation.AddMatr(m, T1, KE, out T1);
                MatrixOperation.SerchObernen(m, T1, out T1);

                MatrixOperation.DifferenceMatr(m, m, KE, T2, out T2);
                MatrixOperation.MultiplicationMatr(m, m, m, T2, X_0, out T2);
                MatrixOperation.DifferenceMatr(m, m, T2, T3, out T2);

                for (int i = 0; i < n - 2; i++)
                {
                    T3 = CalcLAX(m, LE, An[n - 3 - i], Yn[i]);
                    MatrixOperation.DifferenceMatr(m, m, T2, T3, out T2);
                }

                MatrixOperation.MultiplicationMatr(m, m, m, T1, T2, out T2);
                norma = MatrixOperation.NormaMax(m, m, T2, X_0);

                for (int i = 0; i < m; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        X_0[i, j] = T2[i, j];
                    }
                }
                for (int r = 0; r < n - 2; r++)
                {
                    for (int i = 0; i < m; i++)
                    {
                        for (int j = 0; j < m; j++)
                        {
                            Y0[r][i, j] = Yn[r][i, j];
                        }
                    }
                }
                k++;
            }while (norma > eps);
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    XK[i, j] = T2[i, j];
                }
            }
            string temp = null;

            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    temp += XK[i, j].ToString("E5") + "   ";
                }
                result.Document.Blocks.Add(new Paragraph(new Run(temp)));
                temp = null;
            }
            result.Document.Blocks.Add(new Paragraph(new Run("Кількість ітерацій: " + k.ToString())));
        }