示例#1
0
        private void button_solve_Click(object sender, EventArgs e)
        {
            int serverCount = DEFAULT_SERVER_COUNT;

            try
            {
                serverCount = int.Parse(server_count.Text);
            }
            catch (Exception exc) { }


            try
            {
                GaussStatisticsMaker gaussStatisticsMaker = new GaussStatisticsMaker(matrix, 1, 2, 3, 4);
                gaussStatisticsMaker.MakeStatistic();
                gaussStatistics = gaussStatisticsMaker.GetWorkStatistic();
                DrawChart();

                GaussMethod gaussMethod = new GaussMethod(matrix);
                gaussMethod.Solve();
                VectorInterface <double> result = gaussMethod.GetSolution();

                FileHandler.WriteMatrix(matrix);
                FileHandler.WriteSolution(result);
            }
            catch (Exception exc) { }
        }
示例#2
0
        public void Variables_3_matrix_solve()
        {
            VectorInterface <Double> expected = new DoubleVector(-2f / 11.0, 1f / 11.0, 5f / 11.0);

            GaussMethod gaussMethod = new GaussMethod(new Double[][] { new double[] { 3.0, 2.0, 3.0, 1.0 },
                                                                       new double[] { 4.0, 4.0, 3.0, 1.0 },
                                                                       new double[] { 1.0, 4.0, 4.0, 2.0 } });

            gaussMethod.Solve();
            VectorInterface <Double> actual = gaussMethod.GetSolution();

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        private void TestFile(string testName)
        {
            VectorInterface <Double> expected = new DoubleVector(
                Parser.parseVector(FileHandler.Read("tests/" + testName + "/" + testName + ".des")));

            DoubleMatrix doubleMatrix = new DoubleMatrix(
                Parser.parseMatrix(FileHandler.Read("tests/" + testName + "/" + testName + ".A")));

            doubleMatrix.UpendColumn(new DoubleVector(
                                         Parser.parseVector(FileHandler.Read("tests/" + testName + "/" + testName + ".B"))));

            GaussMethod gaussMethod = new GaussMethod(doubleMatrix);

            gaussMethod.Solve();
            VectorInterface <Double> actual = gaussMethod.GetSolution();

            Assert.AreEqual(expected, actual);
        }