Exemple #1
0
 [TestMethod] public void Ajoint()
 {
     {               // int
         Matrix <int> A = new int[, ]
         {
             { 1, 2, 3, },
             { 4, 5, 6, },
             { 7, 8, 9, },
         };
         Matrix <int> B = new int[, ]
         {
             { -3, 6, -3, },
             { 6, -12, 6, },
             { -3, 6, -3, },
         };
         Assert.IsTrue(A.Adjoint() == B);
     }
     {             // float
         Matrix <float> A = new float[, ]
         {
             { 1f, 2f, 3f, },
             { 4f, 5f, 6f, },
             { 7f, 8f, 9f, },
         };
         Matrix <float> B = new float[, ]
         {
             { -3f, 6f, -3f, },
             { 6f, -12f, 6f, },
             { -3f, 6f, -3f, },
         };
         Assert.IsTrue(A.Adjoint().Equal(B, 0.01f));
     }
     {             // double
         Matrix <double> A = new double[, ]
         {
             { 1d, 2d, 3d, },
             { 4d, 5d, 6d, },
             { 7d, 8d, 9d, },
         };
         Matrix <double> B = new double[, ]
         {
             { -3d, 6d, -3d, },
             { 6d, -12d, 6d, },
             { -3d, 6d, -3d, },
         };
         Assert.IsTrue(A.Adjoint().Equal(B, 0.01d));
     }
     {             // decimal
         Matrix <decimal> A = new decimal[, ]
         {
             { 1m, 2m, 3m, },
             { 4m, 5m, 6m, },
             { 7m, 8m, 9m, },
         };
         Matrix <decimal> B = new decimal[, ]
         {
             { -3m, 6m, -3m, },
             { 6m, -12m, 6m, },
             { -3m, 6m, -3m, },
         };
         Assert.IsTrue(A.Adjoint() == B);
     }
 }