Example #1
0
        [Test] public void TestInversion()
        {
            var rng = new Random();
            //{
            //	var m = m2x2.Random(rng, v4.Random3N(0, rng), -(float)Math_.Tau, +(float)Math_.Tau);
            //	var inv_m0 = m3x4.InvertFast(m);
            //	var inv_m1 = m3x4.Invert(m);
            //	Assert.True(m3x4.FEql(inv_m0, inv_m1, 0.001f));
            //}
            {
                //m2x2.Random(rng, -5.0f, +5.0f);
                var m = new m2x2(
                    new v2(-3.0f, +4.2f),
                    new v2(1.2f, -0.3f));
                var inv_m = Math_.Invert(m);
                var I0    = inv_m * m;
                var I1    = m * inv_m;

                Assert.True(Math_.FEql(I1, m2x2.Identity));
                Assert.True(Math_.FEql(I0, m2x2.Identity));
            }
            {
                var m = new m2x2(
                    new v2(4f, 7f),
                    new v2(2f, 6f));
                var inv_m = Math_.Invert(m);

                var det   = 4f * 6f - 7f * 2f;
                var INV_M = new m2x2(
                    new v2(6f, -7f) / det,
                    new v2(-2f, 4f) / det);

                Assert.True(Math_.FEql(m * INV_M, m2x2.Identity));
                Assert.True(Math_.FEql(inv_m, INV_M));
            }
        }
 => InverseMatrix(
     m1x1, m1x2, m1x3, m1x4, m1x5,
     m2x1, m2x2, m2x3, m2x4, m2x5,
     m3x1, m3x2, m3x3, m3x4, m3x5,
     m4x1, m4x2, m4x3, m4x4, m4x5,
     m5x1, m5x2, m5x3, m5x4, m5x5);
Example #3
0
 => CofactorMatrix(
     m1x1, m1x2, m1x3, m1x4, m1x5,
     m2x1, m2x2, m2x3, m2x4, m2x5,
     m3x1, m3x2, m3x3, m3x4, m3x5,
     m4x1, m4x2, m4x3, m4x4, m4x5,
     m5x1, m5x2, m5x3, m5x4, m5x5);
Example #4
0
 => AdjointMatrix(m1x1, m1x2, m1x3, m1x4, m1x5, m2x1, m2x2, m2x3, m2x4, m2x5, m3x1, m3x2, m3x3, m3x4, m3x5, m4x1, m4x2, m4x3, m4x4, m4x5, m5x1, m5x2, m5x3, m5x4, m5x5);