コード例 #1
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void TestIdentityMatrix()
 {
     string expectedResult = "| 1  0  0 |\r\n| 0  1  0 |\r\n| 0  0  1 |\r\n";
     MatrixTypedInt I = new MatrixTypedInt(3, 3, 1);
     System.Diagnostics.Trace.Write(I.ToString());
     Assert.Equal(I.ToString(), expectedResult);
 }
コード例 #2
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void TestDeputyMatry()
 {
     string expectedResult = "| 1  5 |\r\n| 3  5 |\r\n";
     int[][] data1 = new int[][] { new int[] { 3, 2, 1 }, new int[] { 0, 2, -5 }, new int[] { -2, 1, 4 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
     MatrixTypedInt R = A.ComplementaryMinorMatrix(0, 2);
     Assert.Equal(R.ToString(), expectedResult);
 }
コード例 #3
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void AdjugateMatrixTest()
 {
     string extendedResult = "| 0  -3  3 |\r\n| 1  -3  -2 |\r\n| 0  3  0 |\r\n";
     int[][] data1 = new int[][] { new int[] { 2, 0, 1 }, new int[] { 3, 0, 0 }, new int[] { 5, 1, 1 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
     MatrixTypedInt R = A.AdjugateMatrix();
     Assert.Equal(R.ToString(), extendedResult);
 }
コード例 #4
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void InverseMatrixTest()
 {
     string extendedResult = "| 0  0,333333333333333  0 |\r\n| -1  -1  1 |\r\n| 1  -0,666666666666667  0 |\r\n";
     int[][] data1 = new int[][] { new int[] { 2, 0, 1 }, new int[] { 3, 0, 0 }, new int[] { 5, 1, 1 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
     MatrixTypedDouble R = A.Inverse();
     Assert.Equal(R.ToString(), extendedResult);
 }
コード例 #5
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
        public void TestIntMatrixAddition()
        {
            string expectedResult = "| 3  3  3  3  3  3 |\r\n| 3  3  3  3  3  3 |\r\n";
            ThreadPoolUtil.Instance.MaxNumberRunningThreads = 2;
            int[][] data1 = new int[][] { new int[] { 1, 1, 1, 1, 1, 1 }, new int[] { 1, 1, 1, 1, 1, 1 } };
            int[][] data2 = new int[][] { new int[] { 2, 2, 2, 2, 2, 2 }, new int[] { 2, 2, 2, 2, 2, 2 } };

            MatrixTypedInt A = new MatrixTypedInt(data1);
            MatrixTypedInt B = new MatrixTypedInt(data2);
            MatrixTypedInt R = A + B;
            Assert.Equal(R.ToString(), expectedResult);
        }
コード例 #6
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void GeneralMatrixPurposeTest()
 {
     int[][] data1 = new int[][] { new int[] { 1, 3 }, new int[] { 1, 1 }, new int[] { 1, 3 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
 }
コード例 #7
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void TransponseMatrixTest()
 {
     string extendedResult = "| 0  1  0 |\r\n| -3  -3  3 |\r\n| 3  -2  0 |\r\n";
     int[][] data1 = new int[][] { new int[] { 0, -3, 3 }, new int[] { 1, -3, -2 }, new int[] { 0, 3, 0 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
     MatrixTypedInt R = A.TransponseMatrix();
     Assert.Equal(R.ToString(), extendedResult);
 }
コード例 #8
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void TexMatrixDetTest()
 {
     int[][] data1 = new int[][] { new int[] { 3, 2, 1 }, new int[] { 0, 2, -5 }, new int[] { -2, 1, 4 } };
     MatrixTypedInt A = new MatrixTypedInt(data1);
     long result = A.Det();
     Assert.Equal(result, 63);
 }
コード例 #9
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
        public void TestMatrixesMultiply()
        {
            int[][] data1 = new int[][] { new int[] { 1, 3 }, new int[] { 1, 1 }, new int[] { 1, 3 } };
            int[][] data2 = new int[][] { new int[] { 0, 2 }, new int[] { 2, 1 } };
            string expectedResult = "| 5  15 |\r\n| 5  5 |\r\n| 5  15 |\r\n";

            MatrixTypedInt A = new MatrixTypedInt(data1);
            MatrixTypedInt B = new MatrixTypedInt(data2);
            MatrixTypedInt R = A * B;
            Assert.Equal(R.ToString(), expectedResult);
        }
コード例 #10
0
ファイル: TestMatrix.cs プロジェクト: xurdegarpal/SharpMath
 public void TestIntMatrixProductScalar()
 {
     string expectedResult = "| 3  3  3  3  3  3 |\r\n| 3  3  3  3  3  3 |\r\n";
     ThreadPoolUtil.Instance.MaxNumberRunningThreads = 2;
     int[][] data = new int[][] { new int[] { 1, 1, 1, 1, 1, 1 }, new int[] { 1, 1, 1, 1, 1, 1 } };
     MatrixTypedInt A = new MatrixTypedInt(data);
     MatrixTypedInt R = A * 3;
     Assert.Equal(R.ToString(), expectedResult);
 }