§
    fŠtj/  ã                   óT  — d dl mZ d dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
mZ ddlmZmZ g d¢Z ej        ¦   «         Z ej        ¦   «         Zdd„Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd d dddœZd„ Zd„ Z ed¬¦  «        ej        d„ ¦   «         ¦   «         Z ed¬¦  «        d„ ¦   «         ZdS )é    )ÚNumberN)Úcopy_if_needed)Úxp_capabilitiesé   )Ú	good_sizeÚprev_good_size)r   r   Úset_workersÚget_workersc                 ó¤   — t          | t          ¦  «        r| f} 	 d„ | D ¦   «         } n)# t          $ r}|pd}t          |› d�¦  «        |‚d}~ww xY w| S )a  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]``
    c                 ó6   — g | ]}t          j        |¦  «        ‘ŒS © )ÚoperatorÚindex)Ú.0Úas     úY/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/fft/_pocketfft/helper.pyú
<listcomp>z$_iterable_of_int.<locals>.<listcomp>'   s"   € Ð*Ð*Ð* 1�XŒ^˜AÑÔÐ*Ð*Ð*ó    Úvaluez) must be a scalar or iterable of integersN)Ú
isinstancer   Ú	TypeErrorÚ
ValueError)ÚxÚnameÚes      r   Ú_iterable_of_intr      s…   € õ �!•VÑÔð ØˆDˆðTØ*Ð*¨Ð*Ñ*Ô*ˆˆøÝð Tð Tð TØˆ�wˆÝ˜DÐKÐKÐKÑLÔLÐRSÐSøøøøðTøøøð €Hs   š' §
A±AÁAc                 óŒ  ‡ — |du }|du }|s„t          |d¦  «        }ˆ fd„|D ¦   «         }t          ˆ fd„|D ¦   «         ¦  «        rt          d¦  «        ‚t          t	          |¦  «        ¦  «        t          |¦  «        k    rt          d¦  «        ‚|s±t          |d¦  «        }|r/t          |¦  «        t          |¦  «        k    rt          d¦  «        ‚|rQt          |¦  «        ‰ j        k    rt          d	¦  «        ‚t          ‰ j        t          |¦  «        z
  ‰ j        ¦  «        }ˆ fd
„t          ||¦  «        D ¦   «         }n9|r)t          ‰ j	        ¦  «        }t          ‰ j        ¦  «        }nˆ fd„|D ¦   «         }t          d„ |D ¦   «         ¦  «        rt          d|› d�¦  «        ‚t          |¦  «        t          |¦  «        fS )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Úaxesc                 ó4   •— g | ]}|d k     r
|‰j         z   n|‘ŒS )r   ©Úndim©r   r   r   s     €r   r   z+_init_nd_shape_and_axes.<locals>.<listcomp>R   s+   ø€ Ð9Ð9Ð9¨q˜a !še˜e��A”F‘
�
¨Ð9Ð9Ð9r   c              3   ó:   •K  — | ]}|‰j         k    p|d k     V — ŒdS )r   Nr    r"   s     €r   ú	<genexpr>z*_init_nd_shape_and_axes.<locals>.<genexpr>T   s2   øè è € Ð2Ð2¨ˆq�A”FŠ{Ð#˜a !šeÐ2Ð2Ð2Ð2Ð2Ð2r   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                 ó@   •— g | ]\  }}|d k    r‰j         |         n|‘ŒS )éÿÿÿÿ©r%   )r   Úsr   r   s      €r   r   z+_init_nd_shape_and_axes.<locals>.<listcomp>d   s/   ø€ ÐKÐKÐK±$°!°Q˜q Bšw˜w�”˜”�¨AÐKÐKÐKr   c                 ó*   •— g | ]}‰j         |         ‘ŒS r   r(   r"   s     €r   r   z+_init_nd_shape_and_axes.<locals>.<listcomp>i   s   ø€ Ð*Ð*Ð* �”˜”Ð*Ð*Ð*r   c              3   ó"   K  — | ]
}|d k     V — ŒdS )r   Nr   )r   r)   s     r   r$   z*_init_nd_shape_and_axes.<locals>.<genexpr>k   s&   è è € Ð
 Ð
 �Qˆ1ˆqŠ5Ð
 Ð
 Ð
 Ð
 Ð
 Ð
 r   úinvalid number of data points (ú) specified)r   Úanyr   ÚlenÚsetr!   ÚrangeÚzipÚlistr%   Útuple)r   r%   r   ÚnoshapeÚnoaxess   `    r   Ú_init_nd_shape_and_axesr7   /   sú  ø€ ð< �tˆm€GØ�Tˆ\€Fàð 8Ý  fÑ-Ô-ˆØ9Ð9Ð9Ð9°DÐ9Ñ9Ô9ˆåÐ2Ð2Ð2Ð2¨TÐ2Ñ2Ô2Ñ2Ô2ð 	EÝÐCÑDÔDÐDÝ�s�4‰yŒy‰>Œ>�S ™YœYÒ&Ð&ÝÐ6Ñ7Ô7Ð7àð +Ý  ¨Ñ0Ô0ˆàð 	?•C˜‘I”I¥ U¡¤Ò+Ð+Ýð >ñ ?ô ?ð ?àð 	6Ý�5‰zŒz˜AœFÒ"Ð"Ý Ð!LÑMÔMÐMÝ˜œ¥# e¡*¤*Ñ,¨a¬fÑ5Ô5ˆDàKÐKÐKÐK½#¸eÀTÑ:JÔ:JÐKÑKÔKˆˆØ	ð +Ý�Q”W‘”ˆÝ�Q”V‰}Œ}ˆˆà*Ð*Ð*Ð* TÐ*Ñ*Ô*ˆå
Ð
 Ð
 ˜%Ð
 Ñ
 Ô
 Ñ Ô ð BÝØ@¨eÐ@Ð@Ð@ñBô Bð 	Bõ �‰<Œ<�˜d™œÐ#Ð#r   c                 óš  — t          | d¦  «        st          j        | ¦  «        } | j        t          j        k    rt          j        | t          j        ¦  «        S | j        j        dvrt          j        | t          j        ¦  «        S | j                             d¦  «        }| j	        d         sdnt          }t          j        | ||¬¦  «        S )zl
    Convert to array with floating or complex dtype.

    float16 values are also promoted to float32.
    ÚdtypeÚfcú=ÚALIGNEDT)r9   Úcopy)ÚhasattrÚnpÚasarrayr9   Úfloat16Úfloat32ÚkindÚfloat64ÚnewbyteorderÚflagsr   Úarray)r   r9   r=   s      r   Ú	_asfarrayrH   r   s¬   € õ �1�gÑÔð ÝŒJ�q‰MŒMˆà„w•"”*ÒÐÝŒz˜!�RœZÑ(Ô(Ð(Ø	
ŒŒ˜TÐ	!Ð	!ÝŒz˜!�RœZÑ(Ô(Ð(ð ŒG× Ò  Ñ%Ô%€Eà”w˜yÔ)Ð=ˆ4ˆ4­~€DÝŒ8�A˜U¨Ð.Ñ.Ô.Ð.r   c                 óx   — | |u rdS t          |t          j        ¦  «        st          |d¦  «        rdS | j        du S )z|
    Strict check for `arr` not sharing any data with `original`,
    under the assumption that arr = asarray(original)
    FÚ	__array__N)r   r?   Úndarrayr>   Úbase)ÚarrÚoriginals     r   Ú_datacopiedrO   †   sI   € ð
 ˆh€€ØˆuÝ�h¥¤
Ñ+Ô+ð µ¸À+Ñ0NÔ0Nð ØˆuØŒ8�tÐÐr   c                 óÒ  — d}t          d¦  «        g| j        z  }t          ||¦  «        D ]J\  }}| j        |         |k    rt          d|¦  «        ||<   Œ*t          d| j        |         ¦  «        ||<   d}ŒKt	          |¦  «        }|s
| |         dfS t          | j        ¦  «        }t          ||¦  «        D ]
\  }}|||<   Œt          j        || j        ¦  «        }	| |         |	|<   |	dfS )z5Internal auxiliary function for _raw_fft, _raw_fftnd.FNr   T)	Úslicer!   r2   r%   r4   r3   r?   Úzerosr9   )
r   r%   r   Ú	must_copyr   ÚnÚaxr)   ÚaxisÚzs
             r   Ú
_fix_shaperX   ’   sý   € à€Iõ �4‰[Œ[ˆM˜!œ&Ñ €EÝ�U˜DÑ!Ô!ð ð ‰ˆˆ2ØŒ7�2Œ;˜!ÒÐÝ˜a ™œˆE�"‰IˆIå˜a ¤¨¤Ñ-Ô-ˆE�"‰IØˆIˆIå�%‰LŒL€Eàð Ø�Œx˜ˆÐåˆQŒW‰Œ€AÝ�u˜dÑ#Ô#ð ð ‰ˆˆ4Øˆˆ$‰ˆå
Œ��A”GÑÔ€AØ�Œx€A€e�HØˆdˆ7€Nr   c                 óZ   — |dk     rt          d|› d�¦  «        ‚t          | |f|f¦  «        S )Nr   r,   r-   )r   rX   )r   rT   rV   s      r   Ú_fix_shape_1drZ   ­   sC   € Øˆ1‚u€uÝØ<¨aÐ<Ð<Ð<ñ>ô >ð 	>õ �a˜!˜ ˜wÑ'Ô'Ð'r   é   )NÚbackwardÚorthoÚforwardc                 ót   — 	 t           |          }|r|nd|z
  S # t          $ r t          d| ›d�¦  «        d‚w xY w)zAReturns the pypocketfft normalization mode from the norm argumentr[   zInvalid norm value z,, should be "backward", "ortho" or "forward"N)Ú	_NORM_MAPÚKeyErrorr   )Únormr^   Úinorms      r   Ú_normalizationrd   ¸   si   € ð=Ý˜$”ˆØÐ0ˆuˆu a¨%¡iÐ0øÝð =ð =ð =Ýð2 $ð 2ð 2ð 2ñ3ô 3à8<ð	=ð=øøøs   ‚ ˜7c                 óÖ   — | €t          t          dd¦  «        S | dk     r5| t           k    r| dt          z   z  } n0t          d| › dt           › �¦  «        ‚| dk    rt          d¦  «        ‚| S )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   Ú_workersrk   Ã   s�   € Ø€Ý•wÐ 1°1Ñ5Ô5Ð5à�‚{€{Ø•z�kÒ!Ð!Ø�q�:‘~Ñ%ˆGˆGåð 9Àð 9ð 9Ý,6¨;ð9ð 9ñ :ô :ð :à	�AŠˆÝÐ3Ñ4Ô4Ð4à€Nr   T)Úout_of_scopec              #   óÀ   K  — t          ¦   «         }t          t          j        | ¦  «        ¦  «        t          _        	 dV — |t          _        dS # |t          _        w xY w)a   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
   rk   r   r   rh   rf   )rj   Úold_workerss     r   r	   r	   Ó   s[   è è € õ( ‘-”-€KÝ&¥x¤~°gÑ'>Ô'>Ñ?Ô?…GÔð.Øˆˆˆà"-�ÔÐÐø +�ÔÐ-Ð-Ð-Ð-s   ½A ÁAc                  ó.   — t          t          dd¦  «        S )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
    rf   r   )rg   rh   r   r   r   r
   r
   ï   s   € õ •7Ð-¨qÑ1Ô1Ð1r   )N) Únumbersr   r   ÚosÚ	threadingÚ
contextlibÚnumpyr?   Úscipy._lib._utilr   Úscipy._lib._array_apir   Úpypocketfftr   r   Ú__all__Úlocalrh   Ú	cpu_countri   r   r7   rH   rO   rX   rZ   r`   rd   rk   Úcontextmanagerr	   r
   r   r   r   ú<module>r|      s³  ðØ Ð Ð Ð Ð Ð Ø €€€Ø 	€	€	€	Ø Ð Ð Ð Ø Ð Ð Ð à Ð Ð Ð à +Ð +Ð +Ð +Ð +Ð +Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1ð 3Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2ð HÐ
GÐ
G€à
ˆ)Œ/Ñ
Ô
€ØˆRŒ\‰^Œ^€
ðð ð ð ð2@$ð @$ð @$ðF/ð /ð /ð(	ð 	ð 	ðð ð ð6(ð (ð (ð  !¨a¸AÐ>Ð>€	ð=ð =ð =ðð ð ð  €˜dÐ#Ñ#Ô#ØÔð.ð .ñ Ôñ $Ô#ð.ð4 €˜dÐ#Ñ#Ô#ð2ð 2ñ $Ô#ð2ð 2ð 2r   