Ejemplo n.º 1
0
 private Task <IVector> RunAsync(LoggingSolver loggingSolver, IMatrix matrix, IVector x0, IVector b)
 {
     return(Task.Run(() =>
     {
         return loggingSolver.Solve((ILinearOperator)matrix, x0, b);
     }));
 }
Ejemplo n.º 2
0
        public void TestAlgorithmCountMult()
        {
            var proxyMethod = new ProxyMethod(new JacobiMethod());

            loggingSolver     = new LoggingSolver(proxyMethod, Logger);
            double[,] _matrix = new double[3, 3] {
                { 3, 1, 1 },
                { 0, 5, 1 },
                { 2, 0, 3 }
            };

            IVector resultActual = new Vector(new double[] { 1, 1, 1 });

            DenseMatrix denseMatrix = new DenseMatrix(_matrix);
            ProxyMatrix proxyMatrix = new ProxyMatrix(denseMatrix);

            Vector  x0 = new Vector(new double[] { 0, 0, 0 });
            IVector b  = denseMatrix.Multiply(resultActual);

            var result    = loggingSolver.Solve(proxyMatrix, x0, b);
            var MultCount = proxyMethod.MultCount;


            _testOutputHelper.WriteLine(MultCount[0].ToString());
            _testOutputHelper.WriteLine(MultCount[1].ToString());

            for (int i = 0; i < resultActual.Size; i++)
            {
                Assert.Equal(result[i], resultActual[i], 8);
            }
        }
Ejemplo n.º 3
0
 public TestJacobiMethod(ITestOutputHelper testOutputHelper)
 {
     Method            = new JacobiMethod();
     Logger            = new FakeLog();
     loggingSolver     = new LoggingSolver(Method, Logger);
     _testOutputHelper = testOutputHelper;
 }
 public TestsGaussianSeidelMethod(ITestOutputHelper testOutputHelper)
 {
     Method            = new GaussianSeidelMethod();
     Logger            = new FakeLog();
     loggingSolver     = new LoggingSolver(Method, Logger);
     _testOutputHelper = testOutputHelper;
 }
Ejemplo n.º 5
0
 public TestBCGStabMethod(ITestOutputHelper testOutputHelper)
 {
     Method            = new BCGStab();
     Logger            = new FakeLog();
     loggingSolver     = new LoggingSolver(Method, Logger);
     _testOutputHelper = testOutputHelper;
 }
Ejemplo n.º 6
0
 private async void SolveAsync()
 {
     /*
      * foreach (string Method in Types)
      * {
      *  ILogger Logger = new FakeLog();
      *  LoggingSolver loggingSolver = Spawn(Method, Logger);
      *  IVector result = await RunAsync(loggingSolver, matrix, x0, b);
      * }
      */
     //Необходима фабрика решателей, жду слияния главной ветки и ветки решателей
     //временная мера для запуска программы
     for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++)
     {
         LoggingSolver loggingSolver;
         IMethod       Method = new JacobiMethod();
         ILogger       Logger = new FakeLog();
         loggingSolver = new LoggingSolver(Method, Logger);
         IVector result = await RunAsync(loggingSolver, currentSLAE.matrix, currentSLAE.x0, currentSLAE.b);
     }
 }
Ejemplo n.º 7
0
 public TestJacobiMethod()
 {
     Method        = new JacobiMethod();
     Logger        = new FakeLog();
     loggingSolver = new LoggingSolver(Method, Logger);
 }
 public TestJacobiMethod()
 {
     Method        = new GaussianSeidelMethod();
     Logger        = new FakeLog();
     loggingSolver = new LoggingSolver(Method, Logger);
 }