
    xfC&                         d dl mZmZ d dlmZmZ d dlmZ d dlZd dl	Z
d dlZg dZd Zd Z G d d	      Z G d
 d      Zy)    )next_fast_len_init_nd_shape_and_axes)assert_equalassert_array_equal)raisesN)                  	   
      i  i  c                  D    t         D ]  } t        t        |       |         y )N)_5_smooth_numbersr   r   )ns    =/usr/lib/python3/dist-packages/scipy/fft/tests/test_helper.pytest_next_fast_lenr      s      *]1%q)*    c                     | }|dk  rJ 	 t        | d      \  }}|dk7  rn|} t        d|dz   d      D ]  }	 t        | |      \  }}|dk7  r|}  | dk(  sJ d| d| d|         y )Nr   r   r	      zx=z is not z-smooth, remainder=)divmodrange)xr   x_origqrds         r   _assert_n_smoothr       s    F1uu
a|16	  1ac1 !Q<DAqAvA	  6 :xxs"5aS9:6r   c                       e Zd Zd Zd Zd Zej                  j                  e	j                  dk  ded      d        Zd	 Zy
)TestNextFastLenc                     t         j                  j                  d       d } |       D ]B  }t        |      }t	        |d       |t        |d      k(  sJ t        |d      }t	        |d       D y )Ni  c               3   @   K   t        dd      E d {    d y 7 	w)Nr   i  iy )r    r   r   numsz0TestNextFastLen.test_next_fast_len.<locals>.nums/   s      Q~%%(( &s   
   FTr   )nprandomseedr   r    )selfr&   r   ms       r   r   z"TestNextFastLen.test_next_fast_len,   si    
		t	)  	#Aa AQ#a////a&AQ"	#r   c           	      ,   t         j                  t         j                  t         j                  t         j                  t         j
                  t         j                  g}|D ]3  } |d      }t        |      }t        |t        t        |                   5 y )Ni90  )
r(   int16int32int64uint16uint32uint64r   r   int)r+   ITYPESitypr   testNs        r   test_np_integersz TestNextFastLen.test_np_integers;   sa    ((BHHbhh		299biiP 	7DUA!!$Ec!f 56	7r   c                     ddddddddddd	d
dddd}|j                         D ]  \  }}t        t        |d      |        y )Nr   r   r	   r
   r   r   r            i       @)r   r   r	   r
   r   r      r      r:   r;      i  r=   r>   Titemsr   r   r+   hamsr   ys       r   testnext_fast_len_smallz'TestNextFastLen.testnext_fast_len_smallB   sU    Q1qQ1$dh
 JJL 	4DAqq$/3	4r   l        z$Hamming Numbers too large for 32-bitT)reasonr   strictc                     i ddddddddddddd	d
dddddddddddddddddddddddddddddddd }|j                         D ]  \  }}t        t        |d!      |        y )"Nihihi i=ui+2i,2i  B3l      l     l   s' l   >9l   >9l         l      fn l     fn l    >Uko l     q. l    q. l   xQ+t0 l      ! l     ! l    dopL? l   hRl   hR   2 f;               `71Y!l    ("               X l         	 )rK   l   2 f;rL   l   rM   l    `71Y!rN   l          l   X rO   l   !X TrB   rD   s       r   testnext_fast_len_bigz%TestNextFastLen.testnext_fast_len_bigJ   s'   
y
"/
y
 y
 #0
 ,	
 )9,	

 =

 +<]
 _
  
 _
  
 .
 !"2
 0
 "#4
   1#40#40#4 2$6$6 2$69
< JJL 	4DAqq$/3	4r   c                 L    t        dd      dk(  sJ t        dd      dk(  sJ y )Nr'   T)real   r?   F)targetrR   )r   )r+   s    r   test_keyword_argsz!TestNextFastLen.test_keyword_argso   s,    Rd+r111AE2a777r   N)__name__
__module____qualname__r   r8   rG   pytestmarkxfailsysmaxsize
ValueErrorrP   rU   r%   r   r   r"   r"   *   sR    #74 [[s{{U*D(  7 47 4D8r   r"   c                   T    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)Test_init_nd_shape_and_axesc                     t        j                  d      }d }d }t        j                  g       }t        j                  g       }t        |||      \  }}t        ||       t        ||       y )Nr
   r(   arrayr   r   r+   r   shapeaxesshape_expectedaxes_expected	shape_resaxes_ress           r   test_py_0d_defaultsz/Test_init_nd_shape_and_axes.test_py_0d_defaultsv   sZ    HHQK"5aE	8Y/X}-r   c                     t        j                  d      }d }d }t        j                  g       }t        j                  g       }t        |||      \  }}t        ||       t        ||       y )Ng      @rb   rd   s           r   test_np_0d_defaultsz/Test_init_nd_shape_and_axes.test_np_0d_defaults   sZ    HHRL"5aE	8Y/X}-r   c                     t        j                  g d      }d }d }t        j                  dg      }t        j                  dg      }t        |||      \  }}t        ||       t        ||       y )Nr   r   r	   r	   r   rb   rd   s           r   test_py_1d_defaultsz/Test_init_nd_shape_and_axes.test_py_1d_defaults   s_    HHY1#!5aE	8Y/X}-r   c                     t        j                  ddd      }d }d }t        j                  dg      }t        j                  dg      }t        |||      \  }}t	        ||       t	        ||       y )Nr   r   皙?r   )r(   arangerc   r   r   rd   s           r   test_np_1d_defaultsz/Test_init_nd_shape_and_axes.test_np_1d_defaults   sc    IIaB2$!5aE	8Y/X}-r   c                     t        j                  g dg dg      }d }d }t        j                  ddg      }t        j                  ddg      }t        |||      \  }}t        ||       t        ||       y )N)r   r   r	   r
   )r   r   r?   r   r   r
   r   r   rb   rd   s           r   test_py_2d_defaultsz/Test_init_nd_shape_and_axes.test_py_2d_defaults   so    HHl"$ %1a&)!Q(5aE	8Y/X}-r   c                    t        j                  ddd      j                  dd      }d }d }t        j                  ddg      }t        j                  ddg      }t	        |||      \  }}t        ||       t        ||       y )Nr   r   rr   r   r   )r(   rs   reshaperc   r   r   rd   s           r   test_np_2d_defaultsz/Test_init_nd_shape_and_axes.test_np_2d_defaults   sv    IIaB''1-1a&)!Q(5aE	8Y/X}-r   c                     t        j                  g d      }d }d }t        j                  g d      }t        j                  g d      }t        |||      \  }}t	        ||       t	        ||       y )Nr   r   r   r	   r
   r   r   r   r	   r
   r(   zerosrc   r   r   rd   s           r   test_np_5d_defaultsz/Test_init_nd_shape_and_axes.test_np_5d_defaults   s]    HH_%/215aE	8Y/X}-r   c                     t        j                  g d      }g d}d }t        j                  g d      }t        j                  g d      }t        |||      \  }}t	        ||       t	        ||       y )Nr{   )r   r   r   r
   )r   r   r   r   r
   r|   r}   rd   s           r   test_np_5d_set_shapez0Test_init_nd_shape_and_axes.test_np_5d_set_shape   s^    HH_%""2315aE	8Y/X}-r   c                     t        j                  g d      }d }g d}t        j                  g d      }t        j                  g d      }t        |||      \  }}t	        ||       t	        ||       y )Nr{   )r
   r   r   )r
   r   r   r}   rd   s           r   test_np_5d_set_axesz/Test_init_nd_shape_and_axes.test_np_5d_set_axes   s]    HH_%),+5aE	8Y/X}-r   c                     t        j                  g d      }g d}g d}t        j                  g d      }t        j                  g d      }t        |||      \  }}t	        ||       t	        ||       y )Nr{   )r   r   r   )r   r   r	   )r   r   r   r}   rd   s           r   test_np_5d_set_shape_axesz5Test_init_nd_shape_and_axes.test_np_5d_set_shape_axes   s]    HH_%*-+5aE	8Y/X}-r   c                     t        j                  d      }t        |dd       \  }}t        |g d       t        |g d       y )N)r   r	   r
   r   )r   r   r   re   rf   ro   )r(   r~   r   r   )r+   r   re   rf   s       r   test_shape_axes_subsetz2Test_init_nd_shape_and_axes.test_shape_axes_subset   s6    HH\"-aytLt5),4+r   c                    t        j                  d      }t        t        d      5  t	        |d ddgddgg       d d d        t        t        d      5  t	        |d g d       d d d        t        t        d	      5  t	        |d dg       d d d        t        t        d	      5  t	        |d d
g       d d d        t        t        d      5  t	        |d ddg       d d d        t        t        d      5  t	        |ddgddggd        d d d        t        t        d      5  t	        |g dd        d d d        t        t        d      5  t	        t        j                  g d      g ddg       d d d        t        t        d      5  t	        |dgd        d d d        t        t        d      5  t	        |d
d        d d d        y # 1 sw Y   xY w# 1 sw Y   }xY w# 1 sw Y   axY w# 1 sw Y   ExY w# 1 sw Y   (xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr   z-axes must be a scalar or iterable of integers)matchr   r	   r
   r   )g      ?g       @g      @g      @z$axes exceeds dimensionality of inputzall axes must be uniquer   z.shape must be a scalar or iterable of integerszBwhen given, axes and shape arguments have to be of the same length)r   r   r   r   ro   z1invalid number of data points \(\[0\]\) specifiedz2invalid number of data points \(\[-2\]\) specified)r(   r~   assert_raisesr^   r   )r+   r   s     r   test_errorsz'Test_init_nd_shape_and_axes.test_errors   sQ   HHQK: .2 3 	J#AT!Q!Q8HI	J : .2 3 	J#AT8HI	J :!GI 	=#AT<	= :!GI 	>#AT=	> :!:< 	@#ATA?	@ : .2 3 	J#Aq!fq!f-=DI	J : .2 3 	J#A-=DI	J :"<= 	? $BHH\$:*31#?	? :"34 	= $AaSt<	=
 :"45 	< $ARd;	< 	<O	J 	J	J 	J	= 	=	> 	>	@ 	@	J 	J	J 	J	? 	?	= 	=
	< 	<sw   GG!?G.(G;H;H)H"'H.H:<IG!G+.G8;HHH"H+.H7:IIN)rV   rW   rX   rk   rm   rp   rt   rv   ry   r   r   r   r   r   r   r%   r   r   r`   r`   t   s>    ..........,,<r   r`   )scipy.fft._helperr   r   numpy.testingr   r   rY   r   r   numpyr(   r\   r   r   r    r"   r`   r%   r   r   <module>r      sB    D : *   
 *
:,G8 G8Tx< x<r   