Ë
    (†^i]  ã                  ó„   — d dl mZ d dlmZ d dlZd dlmZ d dlmZ erd dlm	Z	 d dl
Z
nd dlmZ  ed«      Z
ed
d	„«       Zy)é    )Úannotations)ÚcontextmanagerN)ÚTYPE_CHECKING)ÚVersion)Ú	Generator)Ú_LazyImportÚscipyc               #  ó°  K  — t        t        j                  «      t        d«      k  rd–— yt        j                  j                  d«      } dt        j                  d<   	 d–— | €!t        j                  j                  dd«       y| t        j                  d<   y# | €!t        j                  j                  dd«       w | t        j                  d<   w xY w­w)aß  
    This function limits the thread count in the context to 1.
    We need to do so because the L-BFGS-B in SciPy v1.15 or newer uses OpenBLAS and it apparently
    causes slowdown due to the unmatched thread setup. This context manager aims to solve this
    issue. If the SciPy version is 1.14.1 or older, this issue does not happen because it uses
    the Fortran implementation.

    Reference:
        https://github.com/scipy/scipy/issues/22438

    TODO(nabe): Watch the SciPy update and remove this context manager once it becomes unnecessary.
    TODO(nabe): Benchmark the speed without this context manager for any SciPy updates.
    NOTE(nabe): I don't know why, but `fmin_l_bfgs_b` in optim_mixed.py seems unaffected.
    z1.15.0NÚOPENBLAS_NUM_THREADSÚ1)r   r	   Ú__version__ÚosÚenvironÚgetÚpop)Úold_vals    úc/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/optuna/_gp/scipy_blas_thread_patch.pyÚ*single_blas_thread_if_scipy_v1_15_or_newerr      sž   è ø€ ô  Œu× Ñ Ó!¤G¨HÓ$5Ò5ää—*‘*—.‘.Ð!7Ó8ˆØ-0Œ
‰
Ð)Ñ*ð	=ÛàˆÜ—
‘
—‘Ð5°tÕ<à5<”—
‘
Ð1Ò2øð ˆÜ—
‘
—‘Ð5°tÕ<à5<”—
‘
Ð1Ò2üs   ‚ACÁ B Á$7CÂ8CÃC)ÚreturnzGenerator[None, None, None])Ú
__future__r   Ú
contextlibr   r   Útypingr   Úpackaging.versionr   r   r	   Úoptunar   r   © ó    r   ú<module>r      s@   ðÝ "å %Û 	Ý  å %ñ Ý äå"á˜Ó €Eð ò=ó ñ=r   