Exemple #1
0
        public void MatrixTransposeTest()
        {
            IRDL rdl = new UniformRDL();
            Matrix matrix = Matrix.GetRandomMatrix(2, 3, rdl);

            Matrix tr = ~matrix;
            Matrix tr2 = ~tr;

            Assert.AreEqual(true, tr2.IsEqual(matrix));
        }
Exemple #2
0
        public void MatrixInverseTest()
        {
            IRDL rdl = new UniformRDL();
            Matrix matrix = Matrix.GetRandomMatrix(3, 3, rdl);

            Matrix inversed = !matrix;
            //RealMatrix inversed2 = !inversed;
            Matrix identity = inversed * matrix;

            for (int i = 0; i < identity.RowsCount; i++)
            {
                Console.WriteLine();
                for (int j = 0; j < identity.ColumnsCount; j++)
                {

                    Console.Write(identity[i, j] + " ");

                }
            }

            Assert.AreEqual(true, identity.IsIdentityMatrix());
        }
Exemple #3
0
        public void MatrixPlusTest()
        {
            IRDL rdl = new UniformRDL();

            Matrix m1 = Matrix.GetRandomMatrix(3, rdl);
            Matrix m2 = Matrix.GetRandomMatrix(3, rdl);

            Matrix rm = m1 - m2;

            for (int i = 0; i < rm.RowsCount; i++) {
                for (int j = 0; j < rm.ColumnsCount; j++) {
                    if (rm[i, j] != m1[i, j] - m2[i, j]) Assert.Fail("Fail ", i, j);
                }
            }
        }