
    (ph                        S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJ	r	  SSK
JrJr  / SQr\R                  " 5       r\R                   " 5       rSS jrS rS	 rS
 rS rS rS S SSS.rS rS r\R6                  S 5       rS rg)    )NumberN)copy_if_needed   )	good_sizeprev_good_size)r   r   set_workersget_workersc                     [        U [        5      (       a  U 4n  U  Vs/ s H  n[        R                  " U5      PM     n nU $ s  snf ! [         a  nU=(       d    Sn[        U S35      UeSnAff = f)zConvert ``x`` to an iterable sequence of int

Parameters
----------
x : value, or sequence of values, convertible to int
name : str, optional
    Name of the argument being converted, only used in the error message

Returns
-------
y : ``List[int]``
valuez) must be a scalar or iterable of integersN)
isinstancer   operatorindex	TypeError
ValueError)xnameaes       N/var/www/html/venv/lib/python3.13/site-packages/scipy/fft/_pocketfft/helper.py_iterable_of_intr      sx     !VDT()*1X^^A*
 H + TwD6!JKLRSSTs'   A  AA A 
A0A++A0c                   ^  USL nUSL nU(       d  [        US5      nU Vs/ s H  oUS:  a  UT R                  -   OUPM     nn[        U 4S jU 5       5      (       a  [        S5      e[	        [        U5      5      [	        U5      :w  a  [        S5      eU(       d  [        US5      nU(       a#  [	        U5      [	        U5      :w  a  [        S5      eU(       aP  [	        U5      T R                  :  a  [        S	5      e[        T R                  [	        U5      -
  T R                  5      n[        X5       VVs/ s H  u  peUS
:X  a  T R                  U   OUPM     nnnOQU(       a+  [        T R                  5      n[        T R                  5      nOU Vs/ s H  nT R                  U   PM     nn[        S U 5       5      (       a  [        SU S35      e[        U5      [        U5      4$ s  snf s  snnf s  snf )z2Handles shape and axes arguments for nd transformsNaxesr   c              3   X   >#    U  H  oTR                   :  =(       d    US :  v   M!     g7f)r   N)ndim).0r   r   s     r   	<genexpr>*_init_nd_shape_and_axes.<locals>.<genexpr>7   s#     2TAFF{#a!e#Ts   '*z$axes exceeds dimensionality of inputzall axes must be uniqueshapezBwhen given, axes and shape arguments have to be of the same lengthz)shape requires more axes than are presentc              3   *   #    U  H	  oS :  v   M     g7f)r   N )r   ss     r   r   r   N   s     
 %Qq5%s   invalid number of data points () specified)r   r   anyr   lensetrangezipr   listtuple)r   r   r   noshapenoaxesr   r"   s   `      r   _init_nd_shape_and_axesr.   .   s   tmGT\Ff-489Dq!eAFF
*D92T222CDDs4y>SY&677 0CIU+ > ? ?5zAFF" !LMM#e*,aff5D:=e:JK:J$!qBwA-:JK	QWWQVV}%)*TT*

 %
   -eWK@B 	B <d##; :$ L
 +s    G*6#G/G5c                    [        U S5      (       d  [        R                  " U 5      n U R                  [        R                  :X  a%  [        R                  " U [        R
                  5      $ U R                  R                  S;  a%  [        R                  " U [        R                  5      $ U R                  R                  S5      nU R                  S   (       d  SO[        n[        R                  " XUS9$ )z`
Convert to array with floating or complex dtype.

float16 values are also promoted to float32.
dtypefc=ALIGNEDT)r0   copy)hasattrnpasarrayr0   float16float32kindfloat64newbyteorderflagsr   array)r   r0   r4   s      r   	_asfarrayr?   U   s     1gJJqMww"**zz!RZZ((	
T	!zz!RZZ(( GG  %Ewwy)4~D88A..    c                     XL a  g[        U[        R                  5      (       d  [        US5      (       a  gU R                  SL $ )zp
Strict check for `arr` not sharing any data with `original`,
under the assumption that arr = asarray(original)
F	__array__N)r   r6   ndarrayr5   base)arroriginals     r   _datacopiedrG   i   s;    
 h

+++0N0N88tr@   c                    Sn[        S5      /U R                  -  n[        X5       HE  u  pVU R                  U   U:  a  [        SU5      XF'   M(  [        SU R                  U   5      XF'   SnMG     [	        U5      nU(       d  X   S4$ [        U R                  5      n[        X5       H	  u  pXXWU'   M     [        R                  " XpR                  5      n	X   X'   U	S4$ )z5Internal auxiliary function for _raw_fft, _raw_fftnd.FNr   T)	slicer   r)   r   r+   r*   r6   zerosr0   )
r   r   r   	must_copyr   naxr"   axiszs
             r   
_fix_shaperP   u   s    I 4[M!&& EU!772;!aEIa-EII " %LExQWWAu#$ $ 	GGAxAHd7Nr@   c                 H    US:  a  [        SU S35      e[        X4U45      $ )Nr   r#   r$   )r   rP   )r   rL   rN   s      r   _fix_shape_1drR      s5    1u-aS<> 	> aw''r@      )Nbackwardorthoforwardc                 p     [         U    nU(       a  U$ SU-
  $ ! [         a    [        SU < S35      Sef = f)zAReturns the pypocketfft normalization mode from the norm argumentrS   zInvalid norm value z,, should be "backward", "ortho" or "forward"N)	_NORM_MAPKeyErrorr   )normrV   inorms      r   _normalizationr\      sQ    =$u0a%i0 =!$ *2 238<	==s     5c                     U c  [        [        SS5      $ U S:  a/  U [        * :  a  U S[        -   -  n U $ [        SU  S[        *  35      eU S:X  a  [        S5      eU $ )Ndefault_workersr   r   z workers value out of range; got z, must not be less than zworkers must not be zero)getattr_config
_cpu_countr   )workerss    r   _workersrc      s}    w 1155{zk!q:~%G N ?y I+,6;-9 : :	A344Nr@   c              #      #    [        5       n[        [        R                  " U 5      5      [        l         Sv   U[        l        g! U[        l        f = f7f)al  Context manager for the default number of workers used in `scipy.fft`

Parameters
----------
workers : int
    The default number of workers to use

Examples
--------
>>> import numpy as np
>>> from scipy import fft, signal
>>> rng = np.random.default_rng()
>>> x = rng.standard_normal((128, 64))
>>> with fft.set_workers(4):
...     y = signal.fftconvolve(x, x)

N)r	   rc   r   r   r`   r^   )rb   old_workerss     r   r   r      s<     & -K&x~~g'>?G."-+s   3AA AAAc                  $    [        [        SS5      $ )zReturns the default number of workers within the current context

Examples
--------
>>> from scipy import fft
>>> fft.get_workers()
1
>>> with fft.set_workers(4):
...     fft.get_workers()
4
r^   r   )r_   r`   r!   r@   r   r	   r	      s     7-q11r@   )N)numbersr   r   os	threading
contextlibnumpyr6   scipy._lib._utilr   pypocketfftr   r   __all__localr`   	cpu_countra   r   r.   r?   rG   rP   rR   rX   r\   rc   contextmanagerr   r	   r!   r@   r   <module>rr      s      	    + 3 H
//
\\^
2$$N/(	6( !aA>	=  . .42r@   