Пример #1
0
        public void TranspondTest()
        {
            Matrix target   = new SingleArrayMatrix(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 4);
            Matrix expected = new SingleArrayMatrix(new double[] { 1, 5, 2, 6, 3, 7, 4, 8 }, 2);
            Matrix actual;

            actual = target.Transpond();
            Assert.IsTrue(Matrix.AreEqual(actual, expected));
        }
Пример #2
0
        public void AreEqualTest()
        {
            Matrix a = new SingleArrayMatrix(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 4);
            Matrix b = new MultidimensionalArrayMatrix(new double[, ] {
                { 1, 2, 3, 4 }, { 5, 6, 7, 8 }
            });

            double[][] pom = new double[2][];
            pom[0] = new double[] { 1, 2, 3, 4 };
            pom[1] = new double[] { 5, 6, 7, 8 };
            Matrix c = new ArrayOfArrayMatrix(pom);

            bool actual;

            actual = Matrix.AreEqual(a, b);
            Assert.IsTrue(actual, "Matrices A and B are different.");
            actual = Matrix.AreEqual(a, c);
            Assert.IsTrue(actual, "Matrice A and C are different.");
            actual = Matrix.AreEqual(b, c);
            Assert.IsTrue(actual, "Matrice B and C are different.");
        }