o
    XÛ·iÆ  ã                   @  s8   U d dl mZ d dlZi Zded< dd„ Zd
dd	„ZdS )é    )ÚannotationsNz dict[tuple[int, list[int]], int]Ú_next_fast_len_cachec                 C  s~   t |ƒdkr	tjS t | |fd ¡}|d u r=| dkrd}n|d }tt| | d | |ƒ| t| |dd … ƒƒ}|t| |f< |S )Nr   é   )ÚlenÚmathÚinfr   ÚgetÚminÚ_next_fast_len_impl)ÚnÚprimesÚresultÚp© r   úM/home/ubuntu/vllm_env/lib/python3.10/site-packages/cupyx/scipy/fft/_helper.pyr
   
   s   þr
   Fc                 C  s   | dkrdS d}t | |ƒS )aå  Find the next fast size to ``fft``.

    Args:
        target (int): The size of input array.
        real (bool): ``True`` if the FFT involves real input or output.
            This parameter is of no use, and only for compatibility to
            SciPy's interface.

    Returns:
        int: The smallest fast length greater than or equal to the input value.

    .. seealso:: :func:`scipy.fft.next_fast_len`

    .. note::
        It may return a different value to :func:`scipy.fft.next_fast_len`
        as pocketfft's prime factors are different from cuFFT's factors.
        For details, see the `cuFFT documentation`_.

    .. _cuFFT documentation:
        https://docs.nvidia.com/cuda/cufft/index.html#accuracy-and-performance
    r   )é   é   é   é   )r
   )ÚtargetÚrealr   r   r   r   Únext_fast_len   s   
r   )F)Ú
__future__r   r   r   Ú__annotations__r
   r   r   r   r   r   Ú<module>   s
    