Пример #1
0
        public void AddExtensionsIntTests_SquareDiagonal(int[] masA, int[] masB, int[] result)
        {
            var matrixA      = new SquareMaxrix <int>(masA);
            var matrixB      = new DiagonalMatrix <int>(masB);
            var resultMatrix = new SquareMaxrix <int>(result);

            matrixA.Add(matrixB);

            Console.WriteLine(matrixA);
            Console.WriteLine(resultMatrix);

            CollectionAssert.AreEquivalent(matrixA.InnerMatrix, resultMatrix.InnerMatrix);
        }
Пример #2
0
 public void Visit(SquareMaxrix <T> matrixA, DiagonalMatrix <T> matrixB)
 {
     try
     {
         for (int i = 0; i < matrixB.RowsAndColsNumber; i++)
         {
             matrixA[i, i] += (dynamic)matrixB[i, i];
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("bad");
     }
 }
Пример #3
0
        public void Test1()
        {
            Matrix <int> m = new SquareMaxrix <int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);

            //Matrix<string> m = new SquareMaxrix<string>(4, "zxcvbnmasdfghjkl");

            Console.WriteLine(m);
            m[1, 2]        = 25;
            m.MatrixEvent += (o, e) => Console.WriteLine($"Event {e.PreviousValue} -> {e.NewValue}");
            m.MatrixEvent += (o, e) => Console.WriteLine($"Event 2 {e.PreviousValue} -> {e.NewValue}");

            m[3, 3] = 25;
            Console.WriteLine(m);
            //Assert.True(true);
        }
Пример #4
0
 public void Visit(SquareMaxrix <T> matrixA, SymetricMatrix <T> matrixB)
 {
     try
     {
         for (int i = 0; i < matrixB.RowsAndColsNumber; i++)
         {
             for (int j = 0; j < matrixB.RowsAndColsNumber; j++)
             {
                 matrixA[i, j] += (dynamic)matrixB[i, j];
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("bad");
     }
 }
Пример #5
0
 public void Visit(DiagonalMatrix <T> matrixA, SquareMaxrix <T> matrixB)
 {
     Visit(matrixB, matrixA);
 }
Пример #6
0
 public void Visit(SquareMaxrix <T> m)
 {
     Console.WriteLine("Some method of Square");
 }
Пример #7
0
 public void Visit(SymetricMatrix <T> matrixA, SquareMaxrix <T> matrixB)
 {
     Visit(matrixB, matrixA);
 }