
    geC&                         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dS )    )next_fast_len_init_nd_shape_and_axes)assert_equalassert_array_equal)raisesN)                  	   
      i  i  c                  T    t           D ]} t          t          |           |             d S )N)_5_smooth_numbersr   r   )ns    ;lib/python3.11/site-packages/scipy/fft/tests/test_helper.pytest_next_fast_lenr      s6     * *]1%%q))))* *    c                     | }|dk     rJ 	 t          | d          \  }}|dk    rn|} t          d|dz   d          D ] }	 t          | |          \  }}|dk    rn|} !| dk    sJ d| d| d	|              d S )
Nr   FTr   r	      zx=z is not z-smooth, remainder=)divmodrange)xr   x_origqrds         r   _assert_n_smoothr       s    F1uua||166	 1ac1  	!Q<<DAqAvvA		  66699999a99 6666r   c                       e Zd Zd Zd Zd Zej                            e	j
        dk     ded          d             Zd	 Zd
S )TestNextFastLenc                    t           j                            d           d } |            D ]W}t          |          }t	          |d           |t          |d          k    sJ t          |d          }t	          |d           Xd S )Ni  c               3   >   K   t          dd          E d {V  dV  d S )Nr   i  iy )r    r   r   numsz0TestNextFastLen.test_next_fast_len.<locals>.nums/   s8      Q~~%%%%%%%((((((r      FTr   )nprandomseedr   r    )selfr&   r   ms       r   r   z"TestNextFastLen.test_next_fast_len,   s    
	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 ]F} |d          }t          |          }t          |t          t          |                               Gd S )Ni90  )
r(   int16int32int64uint16uint32uint64r   r   int)r+   ITYPESitypr   testNs        r   test_np_integersz TestNextFastLen.test_np_integers;   st    (BHbh	29biP 	7 	7DUA!!$$Ec!ff 5 56666	7 	7r   c                     ddddddddddd	d
dddd}|                                 D ]#\  }}t          t          |d          |           $d S )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   sr    Q1qQ1$dh
 
 JJLL 	4 	4DAqq$//3333	4 	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 }|                                 D ]#\  }}t          t          |d!          |           $d S )"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   sI   
y
"/
y
 y
 #0
 ,	
 )9,	

 =

 +<]
 _
  
 _
  
 .
 !"2
 0
 "#4
   1#40#40#4 2$6$6 2$69
 
 
< JJLL 	4 	4DAqq$//3333	4 	4r   c                 b    t          dd          dk    sJ t          dd          dk    sJ d S )Nr'   T)real   r?   F)targetrR   )r   )r+   s    r   test_keyword_argsz!TestNextFastLen.test_keyword_argso   sD    Rd+++r1111AE222a777777r   N)__name__
__module____qualname__r   r8   rG   pytestmarkxfailsysmaxsize
ValueErrorrP   rU   r%   r   r   r"   r"   *   s        # # #7 7 74 4 4 [s{U*D(  7 7 4  47 7 4D8 8 8 8 8r   r"   c                   V    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dS )Test_init_nd_shape_and_axesc                     t          j        d          }d }d }t          j        g           }t          j        g           }t          |||          \  }}t          ||           t          ||           d S )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   so    HQKK"5aEE	8Y///X}-----r   c                     t          j        d          }d }d }t          j        g           }t          j        g           }t          |||          \  }}t          ||           t          ||           d S )Ng      @rb   rd   s           r   test_np_0d_defaultsz/Test_init_nd_shape_and_axes.test_np_0d_defaults   so    HRLL"5aEE	8Y///X}-----r   c                     t          j        g d          }d }d }t          j        dg          }t          j        dg          }t          |||          \  }}t          ||           t          ||           d S )Nr   r   r	   r	   r   rb   rd   s           r   test_py_1d_defaultsz/Test_init_nd_shape_and_axes.test_py_1d_defaults   sy    HYYY1#!5aEE	8Y///X}-----r   c                     t          j        ddd          }d }d }t          j        dg          }t          j        dg          }t          |||          \  }}t	          ||           t	          ||           d S )Nr   r   皙?r   )r(   arangerc   r   r   rd   s           r   test_np_1d_defaultsz/Test_init_nd_shape_and_axes.test_np_1d_defaults   sy    IaB2$!5aE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          ||           d S )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   s    Hlll"ll$ % %1a&))!Q((5aEE	8Y///X}-----r   c                 "   t          j        ddd                              dd          }d }d }t          j        ddg          }t          j        ddg          }t	          |||          \  }}t          ||           t          ||           d S )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   s    IaB''1--1a&))!Q((5aEE	8Y///X}-----r   c                     t          j        g d          }d }d }t          j        g d          }t          j        g d          }t          |||          \  }}t	          ||           t	          ||           d S )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    H___%%///22115aEE	8Y///X}-----r   c                     t          j        g d          }g d}d }t          j        g d          }t          j        g d          }t          |||          \  }}t	          ||           t	          ||           d S )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    H___%%""""2"2"233115aEE	8Y///X}-----r   c                     t          j        g d          }d }g d}t          j        g d          }t          j        g d          }t          |||          \  }}t	          ||           t	          ||           d S )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    H___%%yy))),,++5aE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	          ||           d S )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    H___%%yy***--++5aEE	8Y///X}-----r   c                     t          j        d          }t          |dd           \  }}t          |g d           t          |g d           d S )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   sW    H\""-aytLL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            n# 1 swxY w Y   t          t          d          5  t	          |d g d           d d d            n# 1 swxY w Y   t          t          d	          5  t	          |d dg           d d d            n# 1 swxY w Y   t          t          d	          5  t	          |d d
g           d d d            n# 1 swxY w Y   t          t          d          5  t	          |d ddg           d d d            n# 1 swxY w Y   t          t          d          5  t	          |ddgddggd            d d d            n# 1 swxY w Y   t          t          d          5  t	          |g dd            d d d            n# 1 swxY w Y   t          t          d          5  t	          t          j        g d          g ddg           d d d            n# 1 swxY w Y   t          t          d          5  t	          |dgd            d d d            n# 1 swxY w Y   t          t          d          5  t	          |d
d            d d d            d S # 1 swxY w Y   d S )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   s   HQKK: .2 3 3 3 	J 	J#AT!Q!Q8HIIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J : .2 3 3 3 	J 	J#AT8H8H8HIIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J :!GI I I 	= 	=#AT<<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= :!GI I I 	> 	>#AT====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> :!:< < < 	@ 	@#ATA????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ : .2 3 3 3 	J 	J#Aq!fq!f-=DIIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J : .2 3 3 3 	J 	J#A-=-=-=DIIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J :"<= = = 	? 	? $BH\\\$:$:*3))1#? ? ? ?	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? :"34 4 4 	= 	= $AaSt<<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=
 :"45 5 5 	< 	< $ARd;;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<s   AAA1BBB3CCC4DDD5EEE7FF #F =GG"%G"?*H55H9<H9I66I:=I:J77J;>J;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      s   D D D D D D D D : : : : : : : : * * * * * *      



   * * *
: : :,G8 G8 G8 G8 G8 G8 G8 G8Tx< x< x< x< x< x< x< x< x< x<r   