예제 #1
0
 public void Matrix_has_no_inverse()
 {
     var testMatrix = new Matrix33(1, 2, 3.3,
                                   4, 7,-4,
                                   0, 0, 0);
     testMatrix.CalculateInverse();
 }
예제 #2
0
        public void Inverse_matrix_should_be_calculated_properly()
        {
            var testMatrix = new Matrix33(3, 2, 6,
                                          1, 1, 3,
                                          -3, -2, -5);

            var actual = testMatrix.CalculateInverse();

            Assert.AreEqual(actual.A11, 1, 1E-08);
            Assert.AreEqual(actual.A12, -2, 1E-08);
            Assert.AreEqual(actual.A13, 0, 1E-08);
            Assert.AreEqual(actual.A21, -4, 1E-08);
            Assert.AreEqual(actual.A22, 3, 1E-08);
            Assert.AreEqual(actual.A23, -3, 1E-08);
            Assert.AreEqual(actual.A31, 1, 1E-08);
            Assert.AreEqual(actual.A32, 0, 1E-08);
            Assert.AreEqual(actual.A33, 1, 1E-08);
        }