o
    žD®f–
  ã                   @   s    d Z ddlZdgZddd„ZdS )z!
Introspection helper functions.
é    NÚopt_func_infoc           	         s´   ddl m}m‰  | durt | ¡‰‡fdd„| ¡ D ƒ}n|}|durVt |¡‰i }| ¡ D ]%\}}i }| ¡ D ]\}}t‡ ‡fdd„|D ƒƒrL|||< q8|rS|||< q.|S |}|S )aR  
    Returns a dictionary containing the currently supported CPU dispatched
    features for all optimized functions.

    Parameters
    ----------
    func_name : str (optional)
        Regular expression to filter by function name.

    signature : str (optional)
        Regular expression to filter by data type.

    Returns
    -------
    dict
        A dictionary where keys are optimized function names and values are
        nested dictionaries indicating supported targets based on data types.

    Examples
    --------
    Retrieve dispatch information for functions named 'add' or 'sub' and
    data types 'float64' or 'float32':

    >>> dict = np.lib.introspect.opt_func_info(
    ...     func_name="add|abs", signature="float64|complex64"
    ... )
    >>> import json
    >>> print(json.dumps(dict, indent=2))
        {
          "absolute": {
            "dd": {
              "current": "SSE41",
              "available": "SSE41 baseline(SSE SSE2 SSE3)"
            },
            "Ff": {
              "current": "FMA3__AVX2",
              "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            },
            "Dd": {
              "current": "FMA3__AVX2",
              "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            }
          },
          "add": {
            "ddd": {
              "current": "FMA3__AVX2",
              "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            },
            "FFF": {
              "current": "FMA3__AVX2",
              "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            }
          }
        }

    r   )Ú__cpu_targets_info__ÚdtypeNc                    s    i | ]\}}ˆ   |¡r||“qS © )Úsearch)Ú.0ÚkÚv)Úfunc_patternr   úM/home/ubuntu/webapp/venv/lib/python3.10/site-packages/numpy/lib/introspect.pyÚ
<dictcomp>H   s    þÿz!opt_func_info.<locals>.<dictcomp>c                    s&   g | ]}ˆ  |¡pˆ  ˆ |ƒj¡‘qS r   )r   Úname)r   Úc)r   Úsig_patternr   r   Ú
<listcomp>U   s
    
þþz!opt_func_info.<locals>.<listcomp>)Únumpy._core._multiarray_umathr   r   ÚreÚcompileÚitemsÚany)	Ú	func_nameÚ	signatureÚtargetsÚmatching_funcsÚmatching_sigsr   r	   Úmatching_charsÚcharsr   )r   r
   r   r   r   	   s0   9

ÿ
ý€€ÿ)NN)Ú__doc__r   Ú__all__r   r   r   r   r   Ú<module>   s    