def test_Pullback_GivenRotatedBasis_ReturnRotatedVectors(self):
     transformation = OrthogonalTransformation(x=(0, 1, 0),
                                               y=(-1, 0, 0),
                                               z=(0, 0, 1))
     vectors = [(0, 1, 0), (-1, 1, 0), (-1, 1, 1)]
     expected_vectors = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
     assert_allclose(transformation.pullback(vectors), expected_vectors)
 def test_PullBack_ComplexExample_ReturnCorrectVectors(self):
     transformation = OrthogonalTransformation(x=(-2, 0, 2),
                                               y=(-1, 2, -1),
                                               z=(-1, -1, -1))
     vectors = ((+0, +0, +0), (-2, +0, +2), (-2, -2, +4), (+0, -6, +6),
                (+2, -8, +6), (+4, -8, +4), (+4, -6, +2), (+2, -2, +0))
     expected_vectors = ((+0, +0, +0), (+2 * sqrt(2), +0, +0),
                         (+3 * sqrt(2), -1 * sqrt(6),
                          +0), (+3 * sqrt(2), -3 * sqrt(6),
                                +0), (+2 * sqrt(2), -4 * sqrt(6),
                                      +0), (+0, -4 * sqrt(6), +0),
                         (-1 * sqrt(2), -3 * sqrt(6),
                          +0), (-1 * sqrt(2), -1 * sqrt(6), +0))
     assert_allclose(transformation.pullback(vectors),
                     expected_vectors,
                     atol=1e-8)
 def test_PullBack_ComplexExample_ReturnCorrectVectors(self):
     transformation = OrthogonalTransformation(x=(-2, 0, 2), y=(-1, 2, -1), z=(-1, -1, -1))
     vectors = (
         (+0, +0, +0),
         (-2, +0, +2),
         (-2, -2, +4),
         (+0, -6, +6),
         (+2, -8, +6),
         (+4, -8, +4),
         (+4, -6, +2),
         (+2, -2, +0),
     )
     expected_vectors = (
         (+0, +0, +0),
         (+2 * sqrt(2), +0, +0),
         (+3 * sqrt(2), -1 * sqrt(6), +0),
         (+3 * sqrt(2), -3 * sqrt(6), +0),
         (+2 * sqrt(2), -4 * sqrt(6), +0),
         (+0, -4 * sqrt(6), +0),
         (-1 * sqrt(2), -3 * sqrt(6), +0),
         (-1 * sqrt(2), -1 * sqrt(6), +0),
     )
     assert_allclose(transformation.pullback(vectors), expected_vectors, atol=1e-8)
 def test_Pullback_GivenRotatedBasis_ReturnRotatedVectors(self):
     transformation = OrthogonalTransformation(x=(0, 1, 0), y=(-1, 0, 0), z=(0, 0, 1))
     vectors = [(0, 1, 0), (-1, 1, 0), (-1, 1, 1)]
     expected_vectors = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
     assert_allclose(transformation.pullback(vectors), expected_vectors)
 def test_Pullback_GivenUnitBasis_ReturnOriginalVectors(self):
     transformation = OrthogonalTransformation(x=(1, 0, 0), y=(0, 1, 0), z=(0, 0, 1))
     vectors = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
     assert_allclose(transformation.pullback(vectors), vectors)
 def test_Pullback_GivenUnitBasis_ReturnOriginalVectors(self):
     transformation = OrthogonalTransformation(x=(1, 0, 0),
                                               y=(0, 1, 0),
                                               z=(0, 0, 1))
     vectors = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
     assert_allclose(transformation.pullback(vectors), vectors)