@@ -990,6 +990,7 @@ def test_broadcastcomposition(self,shape):
990
990
(Rotation .from_axis_angle , np .array ([1 ,0 ,0 ,4 ])),
991
991
(Rotation .from_axis_angle , np .array ([1 ,1 ,0 ,1 ])),
992
992
(Rotation .from_matrix , np .random .rand (3 ,3 )),
993
+ (Rotation .from_matrix , np .array ([[2 ,0 ,0 ],[0 ,2 ,0 ],[0 ,1 ,0 ]])),
993
994
(Rotation .from_matrix , np .array ([[1 ,1 ,0 ],[1 ,2 ,0 ],[0 ,0 ,1 ]])),
994
995
(Rotation .from_Rodrigues_vector , np .array ([1 ,0 ,0 ,- 1 ])),
995
996
(Rotation .from_Rodrigues_vector , np .array ([1 ,1 ,0 ,1 ])),
@@ -1128,10 +1129,13 @@ def test_invariant(self):
1128
1129
R = Rotation .from_random ()
1129
1130
assert (R / R ).isclose (R * R ** (- 1 )) and (R / R ).isclose (Rotation ())
1130
1131
1131
- @pytest .mark .parametrize ('item' ,[np .ones (3 ),np .ones ((3 ,3 )), np .ones ((3 ,3 ,3 ,3 ))])
1132
- def test_apply (self ,item ):
1133
- r = Rotation .from_random ()
1134
- assert (r .apply (item ) == r @item ).all ()
1132
+ @pytest .mark .parametrize ('shape' ,[None ,2 ,(2 ,3 ),(2 ,2 ),(2 ,3 ,3 ,3 )])
1133
+ @pytest .mark .parametrize ('item' ,[np .random .rand (3 ),np .random .rand (3 ,3 ), np .random .rand (3 ,3 ,3 ,3 )])
1134
+ def test_apply (self ,item ,shape ):
1135
+ r = Rotation .from_random (shape )
1136
+ i = r * ~ r
1137
+ applied = i .apply (item )
1138
+ assert np .allclose (np .broadcast_to (item ,applied .shape ),applied )
1135
1139
1136
1140
@pytest .mark .parametrize ('angle' ,[10 ,20 ,30 ,40 ,50 ,60 ,70 ,80 ,90 ,100 ,120 ])
1137
1141
def test_average (self ,angle ):
0 commit comments