ó
    Eñi/  ã                   ó<  • 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  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\" SS9\R:                  S 5       5       r\" SS9S 5       rg)é    )ÚNumberN)Úcopy_if_needed)Úxp_capabilitiesé   )Ú	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)zúConvert ``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       ÚX/home/mande/repo/quber/.venv/lib/python3.13/site-packages/scipy/fft/_pocketfft/helper.pyÚ_iterable_of_intr      sx   € ô �!”V×ÑØˆDˆðTÙ()Ó*ª 1ŒX�^Š^˜AÖ©ˆÐ*ð
 €Hùò +øÜó TØ��wˆÜ˜D˜6Ð!JÐKÓLÐRSÐ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 )a²  
Handle shape and axes arguments for N-D transforms.

Returns the shape and axes in a standard form, taking into account negative
values and checking for various potential errors.

Parameters
----------
x : ndarray
    The input array.
shape : int or array_like of ints or None
    The shape of the result. If both `shape` and `axes` (see below) are
    None, `shape` is ``x.shape``; if `shape` is None but `axes` is
    not None, then `shape` is ``numpy.take(x.shape, axes, axis=0)``.
    If `shape` is -1, the size of the corresponding dimension of `x` is
    used.
axes : int or array_like of ints or None
    Axes along which the calculation is computed.
    The default is over all axes.
    Negative indices are automatically converted to their positive
    counterparts.

Returns
-------
shape : tuple
    The shape of the result as a tuple of integers.
axes : list
    Axes along which the calculation is computed, as a list of integers.
NÚ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>T   s#   øé € Ð2ªT¨�A—F‘F‰{×#˜a !™eÔ#ªTùs   ƒ'*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 presentéÿÿÿÿc              3   ó*   #   • U  H	  oS :  v •  M     g7f)r   N© )r   Úss     r   r   r   k   s   é € Ð
 š%�QˆqŽ5š%ù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³  ø€ ð< �tˆm€GØ�Tˆ\€FæÜ  fÓ-ˆÙ48Ó9²D¨q !›e��A—F‘F’
¨Ò*±DˆÐ9äÔ2©TÓ2×2Ñ2ÜÐCÓDÐDÜŒs�4‹y‹>œS ›YÓ&ÜÐ6Ó7Ð7æÜ  ¨Ó0ˆæ”C˜“I¤ U£Ó+Üð >ó ?ð ?æÜ�5‹z˜AŸF™FÓ"Ü Ð!LÓMÐMÜ˜Ÿ™¤# e£*Ñ,¨a¯f©fÓ5ˆDä:=¸eÔ:JÔKÒ:J±$°!˜q B›w�—‘˜’¨AÒ-Ñ:JˆÑKˆÞ	Ü�Q—W‘W“ˆÜ�Q—V‘V‹}‰á%)Ó*¢T �—‘˜”¡TˆÐ*ä
Ñ
 ™%Ó
 × Ñ ÜØ-¨e¨W°KÐ@ó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)r1   Úcopy)ÚhasattrÚnpÚasarrayr1   Úfloat16Úfloat32ÚkindÚfloat64ÚnewbyteorderÚflagsr   Úarray)r   r1   r5   s      r   Ú	_asfarrayr@   r   s¡   € ô �1�g×ÑÜ�JŠJ�q‹Mˆà‡w�w”"—*‘*ÓÜ�zŠz˜!œRŸZ™ZÓ(Ð(Ø	
�‰�‰˜TÓ	!Ü�zŠz˜!œRŸZ™ZÓ(Ð(ð �G‰G× Ñ  Ó%€Eà—w‘w˜y×)‰4¬~€DÜ�8Š8�A¨Ñ.Ð.ó    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   r7   Úndarrayr6   Úbase)ÚarrÚoriginals     r   Ú_datacopiedrH   †   s;   € ð
 ‚ØÜ�h¤§
¡
×+Ñ+´¸À+×0NÑ0NØØ�8‰8�tÐÐrA   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+   r7   Úzerosr1   )
r   r   r   Ú	must_copyr   ÚnÚaxr#   ÚaxisÚzs
             r   Ú
_fix_shaperQ   ’   sË   € à€Iô �4‹[ˆM˜!Ÿ&™&Ñ €EÜ�UÖ!‰ˆØ�7‰7�2‰;˜!ÓÜ˜a ›ˆE‹Iä˜a §¡¨¡Ó-ˆE‰IØŠIñ "ô �%‹L€EæØ‰x˜ˆÐäˆQ�W‰W‹€AÜ�uÖ#‰ˆØˆ$‹ñ $ô 	�Š�—G‘GÓ€AØ‰x€A�HØˆdˆ7€NrA   c                 óH   • US:  a  [        SU S35      e[        X4U45      $ )Nr   r$   r%   )r   rQ   )r   rM   rO   s      r   Ú_fix_shape_1drS   ­   s5   € Øˆ1ƒuÜØ-¨a¨S°Ð<ó>ð 	>ô �a˜ ˜wÓ'Ð'rA   é   )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 argumentrT   zInvalid norm value z,, should be "backward", "ortho" or "forward"N)Ú	_NORM_MAPÚKeyErrorr   )ÚnormrW   Úinorms      r   Ú_normalizationr]   ¸   sQ   € ð=Ü˜$‘ˆÞˆuÐ0 a¨%¡iÐ0øÜó =ÜØ! $¡ð *2ð 2ó3à8<ð	=ð=ú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   Ú_workersrd   Ã   s}   € Ø�Ü”wÐ 1°1Ó5Ð5à�ƒ{Ø”z�kÓ!Ø�qœ:‘~Ñ%ˆGð €Nô Ð?À¸yð I+Ü,6¨;¨-ð9ó :ð :à	�A‹ÜÐ3Ó4Ð4à€NrA   T)Úout_of_scopec              #   ó°   #   • [        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
   rd   r   r   ra   r_   )rc   Úold_workerss     r   r	   r	   Ó   s<   é € ô( “-€KÜ&¤x§~¢~°gÓ'>Ó?„GÔð.Ûà"-ŒÕø +ŒÕüs   ‚3A¶A ºAÁAÁAc                  ó$   • [        [        SS5      $ )z¿Returns 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`   ra   r"   rA   r   r
   r
   ï   s   € ô ”7Ð-¨qÓ1Ð1rA   )N) Únumbersr   r   ÚosÚ	threadingÚ
contextlibÚnumpyr7   Úscipy._lib._utilr   Úscipy._lib._array_apir   Úpypocketfftr   r   Ú__all__Úlocalra   Ú	cpu_countrb   r   r/   r@   rH   rQ   rS   rY   r]   rd   Úcontextmanagerr	   r
   r"   rA   r   Ú<module>ru      s»   ðÝ Û Û 	Û Û ã å +Ý 1÷ 3ò H€à
�/Š/Ó
€Ø�\Š\‹^€
ôò2@$òF/ò(	òò6(ð  !¨a¸AÑ>€	ò=òñ  ˜dÑ#Ø×Ññ.ó ó $ð.ñ4 ˜dÑ#ñ2ó $ñ2rA   