Beispiel #1
0
 def test_matrix(self):
     assert Quaternion().matrix == Matrix.identity(4)
Beispiel #2
0
    def test_dot_product_neutral_element(self):
        a = Matrix((2, 2), range(4))
        b = Matrix.identity(2)

        assert a @ b == a
        assert a @ b == b @ a
Beispiel #3
0
    def test_dot_product_inverse(self):
        a = Matrix((2, 2), (4, 3, 2, 1))
        b = Matrix((2, 2), (-0.5, 1.5, 1, -2))

        assert a @ b == Matrix.identity(2)
        assert b @ a == Matrix.identity(2)
Beispiel #4
0
 def test_identity(self):
     assert Matrix.identity(4) == Matrix((4, 4))
     assert Matrix.identity(4) == Matrix(
         (4, 4), (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1))