Exemple #1
0
        public void TestReadFile_4()
        {
            sourceMx = "Matrix4.txt";

            double[] XX = new double[] { 0.73421, 0.27065, -1.05448, -0.50694 };

            decomposition.ClcltLU_Dcmp(sourceMx, from, out X);

            int  i  = 0;
            bool fl = false;

            while (!fl && i < X.Length)
            {
                if (Math.Round(X[i], 5) == XX[0])
                {
                    fl = true;
                }
                i++;
            }
            Assert.AreEqual(true, fl);
        }
        static void Main(string[] args)
        {
            //Create method
            LU_Decomposition decomposition = new LU_Decomposition();
            //Create source
            string source = "Matrix.txt";

            int from = 0;

            double[] vector;

            byte key = 99;

            while (key != 0)
            {
                Console.Clear();
                Console.WriteLine("Choose point of menu");
                Console.WriteLine("1. Write data");
                if (from != 0)
                {
                    Console.WriteLine("2. Output determination");
                }
                Console.WriteLine("3. Output README");
                Console.WriteLine("4. Exit");
                Console.Write("Your number: ");
                key = Byte.Parse(Console.ReadLine());
                switch (key)
                {
                case 1:
                {
                    Console.WriteLine("What kind of source(file (1) or hand-create values (2))\n" +
                                      "Your number: ");
                    int fl = Convert.ToInt32(Console.ReadLine());
                    switch (fl)
                    {
                    case 1:
                    {
                        from = 1;
                    }
                    break;

                    case 2:
                    {
                        from = 2;
                    }
                    break;
                    }
                }
                break;

                case 2:
                {
                    if (from != 0)
                    {
                        Console.WriteLine("Your output is");
                        decomposition.ClcltLU_Dcmp(source, from, out vector);
                        foreach (double x in vector)
                        {
                            Console.Write(Math.Round(x, 5) + " ");
                        }
                        Console.ReadKey();
                    }
                }
                break;

                case 3:
                {
                    Console.Clear();
                    Console.Write("Program for design SLAE");
                }
                break;

                case 4:
                {
                    key = 0;
                }
                break;
                }
            }
        }