예제 #1
0
        public void OughtTo2x2()
        {
            var M = new RTF.Matrix(2, 2);

            M.SetColumn(0, new double[] { -3, 1 });
            M.SetColumn(1, new double[] { 5, -2 });

            Assert.Equal(-3, M[0, 0]);
            Assert.Equal(5, M[0, 1]);
            Assert.Equal(1, M[1, 0]);
            Assert.Equal(-2, M[1, 1]);
        }
예제 #2
0
        public void TestTranspose()
        {
            var b = new RTF.Matrix(4, 4);

            b.SetRow(0, new double[] { 0, 9, 3, 0 });
            b.SetRow(1, new double[] { 9, 8, 0, 8 });
            b.SetRow(2, new double[] { 1, 8, 5, 3 });
            b.SetRow(3, new double[] { 0, 0, 5, 8 });

            var e = new RTF.Matrix(4, 4);

            e.SetColumn(0, new double[] { 0, 9, 3, 0 });
            e.SetColumn(1, new double[] { 9, 8, 0, 8 });
            e.SetColumn(2, new double[] { 1, 8, 5, 3 });
            e.SetColumn(3, new double[] { 0, 0, 5, 8 });

            Assert.Equal(e, b.Transpose());
        }