Example #1
0
        public void ExtentionMethodTests()
        {
            DiagonalMatrix <Book> ds = new DiagonalMatrix <Book>(new Book("Roman", "Ditle", "Ganre", "Publisher", 8)
                                                                 , new Book("Roman", "Ditle", "Ganre", "Publisher", 5));
            SymetricMatrix <Book> ss = new SymetricMatrix <Book>(2, new Book("Roman", "Ditle", "Ganre", "Publisher", 4)
                                                                 , new Book("Roman", "Ditle", "Ganre", "Publisher", 5), new Book("ASDASDSAD", "Ditle", "Ganre", "Publisher", 12));

            Console.WriteLine(ss);

            Console.WriteLine(ds);

            ss.Add(ds);
            Console.WriteLine(ss);

            /*DiagonalMatrix<int> m = new DiagonalMatrix<int>(1, 2, 3, 4, 5);
             * SymetricMatrix<int> m2 = new SymetricMatrix<int>(5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
             *
             * m2.MatrixEvent += (o, e) => Console.WriteLine($"EVENT: {o.ToString()}");
             * Console.WriteLine(m2);
             * m2.Add(m);
             * Console.WriteLine(m2);
             * m2.SomeMethod();
             *
             * m2[1, 1] = 12;*/
        }
Example #2
0
        public void AddExtensionsIntTests_SymetricDiagonal(int dimension, int[] masA, int[] masB, int[] result)
        {
            var matrixA      = new SymetricMatrix <int>(dimension, masA);
            var matrixB      = new DiagonalMatrix <int>(masB); //TODO: add big diag  + sym => sym with 0s
            var resultMatrix = new SymetricMatrix <int>(dimension, result);

            matrixA.Add(matrixB);

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

            CollectionAssert.AreEquivalent(matrixA.InnerMatrix, resultMatrix.InnerMatrix);
        }
Example #3
0
        public void AddExtensionsIntTests_Symetric(int rc, int[] masA, int[] masB, int[] result)
        {
            var matrixA      = new SymetricMatrix <int>(rc, masA);
            var matrixB      = new SymetricMatrix <int>(rc, masB);
            var resultMatrix = new SymetricMatrix <int>(rc, result);

            matrixA.Add(matrixB);

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

            CollectionAssert.AreEquivalent(matrixA.InnerMatrix, resultMatrix.InnerMatrix);
        }