コード例 #1
0
 public void Identity2x3()
 {
     Assert.Equal(
         MathS.Matrix(new Entity[, ]
     {
         { 1, 0, 0 },
         { 0, 1, 0 },
     }),
         MathS.IdentityMatrix(2, 3));
 }
コード例 #2
0
 public void Identity2()
 {
     Assert.Equal(
         MathS.Matrix(new Entity[, ]
     {
         { 1, 0 },
         { 0, 1 }
     }),
         MathS.IdentityMatrix(2));
 }
コード例 #3
0
        [Fact] public void WithColumnMatrix2()
        {
            var m = MathS.IdentityMatrix(5)
                    .WithColumn(2, MathS.Vector(1, 2, 3, 4, 5))
                    .WithColumn(4, MathS.Vector(1, 3, 5, 9, 1))
                    .WithColumn(4, MathS.Vector(5, 6, 7, 8, 9));

            Assert.Equal(
                MathS.Matrix(new Entity[, ]
            {
                { 1, 0, 1, 0, 5 },
                { 0, 1, 2, 0, 6 },
                { 0, 0, 3, 0, 7 },
                { 0, 0, 4, 1, 8 },
                { 0, 0, 5, 0, 9 }
            }),
                m);
        }
コード例 #4
0
        [Fact] public void WithRowMatrix2()
        {
            var m = MathS.IdentityMatrix(5)
                    .WithRow(2, MathS.Vector(1, 2, 3, 4, 5).T)
                    .WithRow(4, MathS.Vector(1, 3, 5, 9, 1).T)
                    .WithRow(4, MathS.Vector(5, 6, 7, 8, 9).T);

            Assert.Equal(
                MathS.Matrix(new Entity[, ]
            {
                { 1, 0, 0, 0, 0 },
                { 0, 1, 0, 0, 0 },
                { 1, 2, 3, 4, 5 },
                { 0, 0, 0, 1, 0 },
                { 5, 6, 7, 8, 9 }
            }),
                m);
        }