+
    ,i              	       ^   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt Rt]! ^^4      t. R(O] U u. uF  p R	V  2NK
  	  up ,           ] U u. uF  p R
V  2NK
  	  up ,           t. R)O]! ]4      ,           ] U u. uF  p ^V ,          NK  	  up ,           tR tR tR tR tR tR t] P8                  P;                  RR*RR]P<                  ! R.4      .4      R 4       t] P8                  P;                  R. R+O4      R 4       t ] P8                  P;                  RRR.4      R 4       t!] P8                  P;                  R. R,O4      R 4       t"R t#R t$R t%] P8                  P;                  R]4      ] P8                  P;                  RR4      R  4       4       t&] P8                  P;                  R]4      ] P8                  P;                  RR4      R! 4       4       t'] P8                  P;                  R"](! ]]4      4      R# 4       t)] P8                  P;                  R"](! ]]4      4      R$ 4       t*] P8                  P;                  R"](! ]]4      4      R% 4       t+] P8                  P;                  R]4      R& 4       t,] P8                  P;                  R]4      R' 4       t-R# u up i u up i u up i )-    N)assert_array_almost_equal)Rotation)linear_sum_assignment)cdist)golden)cKDTreeg-q=CDc                    \        WRR7      p\        V4      p\        P                  ! W#,          P	                  4       4      # )zCalculates the root-mean-square distance between the points of P and Q.
The distance is taken as the minimum over all possible matchings. It is
zero if P and Q are identical and non-zero if not.
sqeuclidean)metric)r   r   npsqrtsum)PQdistance_matrixmatchings   &&  T/usr/lib/python3/dist-packages/scipy/spatial/transform/tests/test_rotation_groups.py_calculate_rmsdr      s5    
 A7O$_5H77?,00233    c                    \         P                  ! ^ ^\         P                  ,          V ^,           4      RR p\         P                  ! \         P                  ! V 4      \         P
                  ! V4      \         P                  ! V4      .4      P                  p\         P                  ! V. RO.34      p\         P                  ! W1^R7      # )r   Naxis   r   r   )
r   linspacepivstackzeroscossinTconcatenateroll)nr   thetasr   s   &&  r   _generate_pyramidr)      s    [[AIq1u-cr2F
		288A;vv?@BBA
I;'(A771##r   c                 N   \         P                  ! ^ ^\         P                  ,          V ^,           4      RR p\         P                  ! \         P                  ! V 4      ) \         P
                  ! V4      \         P                  ! V4      .4      P                  p\         P                  ! \         P                  ! V 4      5\         P
                  ! V4      \         P                  ! V4      .4      P                  p\         P                  ! W434      p\         P                  ! WQ^R7      # )r   Nr   r   )
r   r   r   r    onesr"   r#   r$   r%   r&   )r'   r   r(   bottomtopr   s   &&    r   _generate_prismr.   #   s    [[AIq1u-cr2FYYRVVF^RVVF^DEGGF
))bggaj["&&."&&.A
B
D
DC
}%A771##r   c                  
   \         P                  ! ^ R\        ) .^ R\        5.^ ^\        ) .^ ^\        5..4      p \         P                  ! \	        ^4       Uu. uF  p\         P
                  ! W^R7      NK  	  up4      # u upi )r   r   r   )r   arrayphir%   ranger&   )xis     r   _generate_icosahedronr5   +   sr    
1b3$-b3$-b3$-b3$-! 	"A >>%(C(Q2771a0(CDDCs   !B c            	      R    \         P                  ! . RO. RO. RO. RO. RO. RO.4      # )r   )r   r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   r   r0    r   r   _generate_octahedronr9   3   s%    88ZZZ9 : :r   c                  F    \         P                  ! . RO. RO. RO. RO.4      # )r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   r7   r8   r   r   _generate_tetrahedronr;   8   s    88Y[+FGGr   nameTC3c                     \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! V 4       RRR4       R#   + '       g   i     R# ; i)zmust be a stringmatchNpytestraises
ValueErrorr   create_groupr<   s   &r   test_group_typerG   <   s;    	z/
1 
1d#
1 
1 
1 
1   AA	c                     \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! V 4       RRR4       R#   + '       g   i     R# ; i)z(must be one of 'I', 'O', 'T', 'Dn', 'Cn'r?   NrA   rF   s   &r   test_group_namerJ   C   sA    	zG
I 
Id#
I 
I 
I 
IrH   C0D0c                     \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! V 4       RRR4       R#   + '       g   i     R# ; i)zGroup order must be positiver?   NrA   rF   s   &r   test_group_order_positiverN   J   s;    	z;
= 
=d#
= 
= 
= 
=rH   r   c                     \         P                  ! \        R R7      ;_uu_ 4        \        P                  ! RV 4       RRR4       R#   + '       g   i     R# ; i)z`axis` must be one ofr?   C1NrA   r   s   &r   test_axis_validrQ   Q   s=    	z4
6 
6dD)
6 
6 
6 
6s   AA	c                     \        4       p \        P                  ! R4       FL  p\        P                  ! VP	                  4       4      p\        WP                  V 4      4      \        8  d   KL  Q h	  R# )zThe icosahedral group fixes the rotations of an icosahedron. Here we
test that the icosahedron is invariant after application of the elements
of the rotation group.IN)r5   r   rE   	from_quatas_quatr   applyTOLr   gs     r   test_icosahedralrZ   X   sR     	A""3'qyy{+q''!*-333 (r   c                     \        4       p \        P                  ! R4       F(  p\        WP	                  V 4      4      \
        8  d   K(  Q h	  R# )zNTest that the octahedral group correctly fixes the rotations of an
octahedron.ON)r9   r   rE   r   rV   rW   rX   s     r   test_octahedralr]   b   s<     	A""3'q''!*-333 (r   c                     \        4       p \        P                  ! R4       F(  p\        WP	                  V 4      4      \
        8  d   K(  Q h	  R# )zOTest that the tetrahedral group correctly fixes the rotations of a
tetrahedron.r$   N)r;   r   rE   r   rV   rW   rX   s     r   test_tetrahedralr_   j   s<     	A""3'q''!*-333 (r   r'   XYZc                    \        V RP                  V4      R7      p\        P                  ! RV  2VR7       F(  p\	        W#P                  V4      4      \        8  d   K(  Q h	  R# )zFTest that the dicyclic group correctly fixes the rotations of a
prism.r`   r   r
   N)r.   indexr   rE   r   rV   rW   r'   r   r   rY   s   &&  r   test_dicyclicrd   r   sQ    
 	D 12A""Qqc76q''!*-333 7r   c                    \        V RP                  V4      R7      p\        P                  ! RV  2VR7       F(  p\	        W#P                  V4      4      \        8  d   K(  Q h	  R# )zFTest that the cyclic group correctly fixes the rotations of a
pyramid.r`   r   r	   N)r)   rb   r   rE   r   rV   rW   rc   s   &&  r   test_cyclicrf   |   sQ    
 	!%++d"34A""Qqc76q''!*-333 7r   z
name, sizec                 R    \        \        P                  ! V 4      4      V8X  g   Q hR # )N)lenr   rE   )r<   sizes   &&r   test_group_sizesrj      s     x$$T*+t333r   c                     \         P                  ! V 4      p\        VP                  4       4      p\	        VP                  R 4      4      ^ 8X  g   Q hR# )gMbP?N)r   rE   r   rU   rh   query_pairs)r<   ri   rY   kdtrees   &&  r   test_group_no_duplicatesrn      s@    d#AQYY[!Fv!!$'(A---r   c                    \         P                  ! V 4      p\        P                  ! VP	                  4       ) VP	                  4       34      p\        P
                  ! \        W34      4      p\        P                  ! V^ R7      \        P                  ! V^ R7      ,
          pV\        8  P                  4       '       g   Q hR# )r   r   N)r   rE   r   r%   rU   sortr   maxminrW   all)r<   ri   rY   qdistancedeltass   &&    r   test_group_symmetryrw      s~    d#A
aiik23AwwuQ{#HVVH1%xa(@@FSLr   c                    \         P                  ! V 4      pVP                  V4      p\        VP	                  4       \
        P                  ! \        V4      4      4       R# )z]Test that the elements of the rotation group are correctly
mapped onto the identity rotation.N)r   rE   reducer   	magnituder   r!   rh   r<   rY   fs   &  r   test_reductionr}      s>     	d#A	AakkmRXXc!f-=>r   c                     \         P                  ! V 4      pVR,          P                  V4      p\        VP	                  4       ^ 4       VP                  4       P                  R8X  g   Q hR# )r   Nr   )   )r   rE   ry   r   rz   rU   shaper{   s   &  r   test_single_reductionr      sM    d#A	"QAakkmQ/99;$$$r   )rS   r\   r$   )<         r   )r    CAzC DAzD I2 )Abr   r      r   FN).rB   numpyr   numpy.testingr   scipy.spatial.transformr   scipy.optimizer   scipy.spatial.distancer   scipy.constantsr   r1   scipy.spatialr   rW   r2   NSNAMESlistSIZESr   r)   r.   r5   r9   r;   markparametrizer0   rG   rJ   rN   rQ   rZ   r]   r_   rd   rf   ziprj   rn   rw   r}   r   )r'   s   0r   <module>r      s     3 , 0 ( ) ! 
1b\B/BqQqc7B//B2GBqQqc7B2GGtBx""5"Q1q55""554$$E:
H "dD"((D62B!CD$ E$ !MN$ O$ $.$ /$ !DE* F*444 b!'4 ( "4 b!'4 ( "4 s5%'894 :4 s5%'89. :. s5%'89  :  '? (? '% (%o 02G"5s   J J%J*