§
    !�’j  ã                   ó¨  — U d 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	 ddl
ZddlmZ ddlmZ ddlmc mc m
Z ddlmZmZ ddlmZ eZe	ed	<   eej        z  Ze	ed
<   ej                             dd¦  «        Zeez  ed<   ej                             dd¦  «        Z  G d„ dej!        ¦  «        Z" ed¦  «        de#de"fd„¦   «         Z$dedefd„Z%dS )z|
Override functions from array_api_compat, for use by array-api-extra
and internally.

See also _array_api_compat_vendor.py
é    N)Ú	lru_cache)Ú
ModuleType)ÚAnyÚ	TypeAlias)Úarray_api_compat)Úis_array_api_objÚis_jax_array)Ú	SparseABCÚArrayÚ	ArrayLikeÚSCIPY_ARRAY_APIFÚSCIPY_DEVICEÚcpuc                   ó   — e Zd ZdZdZdZdZdS )Ú_ArrayClsInfor   é   é   é   N)Ú__name__Ú
__module__Ú__qualname__ÚskipÚnumpyÚ
array_likeÚunknown© ó    úLC:\Projects\DSCons\.venv\Lib\site-packages\scipy\_lib\_array_api_override.pyr   r       s"   € € € € € Ø€DØ€EØ€JØ€G€G€Gr   r   éd   ÚclsÚreturnc           
      óL  — t          | t          t          f¦  «        rt          j        S t          | t
          ¦  «        rd}t          |¦  «        ‚t          | t          j        j	        ¦  «        rt          d¦  «        ‚t          | t          j        ¦  «        rt          d¦  «        ‚t          | t          j        t          j        f¦  «        rt          j        S t          | t          t           t"          t$          t'          d ¦  «        f¦  «        rt          j        S t          j        S )Nz�Sparse arrays/matrices are not supported by this function. Perhaps one of the `scipy.sparse.linalg` functions would work instead.z8Inputs of type `numpy.ma.MaskedArray` are not supported.z0Inputs of type `numpy.matrix` are not supported.)Ú
issubclassÚlistÚtupler   r   r
   Ú
ValueErrorÚnpÚmaÚMaskedArrayÚ	TypeErrorÚmatrixÚndarrayÚgenericr   ÚintÚfloatÚcomplexÚboolÚtyper   r   )r    Úmsgs     r   Ú_validate_array_clsr4   '   sð   € å�#��u�~Ñ&Ô&ð (ÝÔ'Ð'õ �#•yÑ!Ô!ð ð&ˆõ ˜‰oŒoÐå�#•r”uÔ(Ñ)Ô)ð TÝÐRÑSÔSÐSå�#•r”yÑ!Ô!ð LÝÐJÑKÔKÐKå�#�œ
¥B¤JÐ/Ñ0Ô0ð #ÝÔ"Ð"õ
 �#��U¥G­Tµ4¸±:´:Ð>Ñ?Ô?ð "ÝÔ!Ð!åÔ Ð r   Úarraysc                  ó  — t           st          S g }g }| D �]N}t          t          |¦  «        ¦  «        }|t          j        u rŒ.|t          j        u rq|j        j        dv r| 	                    |¦  «         Œ`|j        j        dk    r%t          |¦  «        r| 	                    |¦  «         Œ•t          d|j        ›d�¦  «        ‚|t          j        u r%t          |¦  «        r| 	                    |¦  «         Œà	 t          j        |¦  «        }n# t          $ r t          d¦  «        ‚w xY w|j        j        dvrt          d|j        ›d�¦  «        ‚| 	                    |¦  «         �ŒP|st          S t!          j        g |¢|¢R Ž S )al  Get the array API compatible namespace for the arrays xs.

    Parameters
    ----------
    *arrays : sequence of array_like
        Arrays used to infer the common namespace.

    Returns
    -------
    namespace : module
        Common namespace.

    Notes
    -----
    Wrapper around `array_api_compat.array_namespace`.

    1. Check for the global switch `SCIPY_ARRAY_API`. If disabled, just
       return array_api_compat.numpy namespace and skip all compliance checks.

    2. Check for known-bad array classes.
       The following subclasses are not supported and raise and error:

       - `numpy.ma.MaskedArray`
       - `numpy.matrix`
       - NumPy arrays which do not have a boolean or numerical dtype
       - `scipy.sparse` arrays

    3. Coerce array-likes to NumPy arrays and check their dtype.
       Note that non-scalar array-likes can't be mixed with non-NumPy Array
       API objects; e.g.

       - `array_namespace([1, 2])` returns NumPy namespace;
       - `array_namespace(np.asarray([1, 2], [3, 4])` returns NumPy namespace;
       - `array_namespace(cp.asarray([1, 2], [3, 4])` raises an error.
    ÚiufcbÚVzAn argument has dtype `z3`; only boolean and numerical dtypes are supported.zCAn argument is neither array API compatible nor coercible by NumPy.)r   Ú	np_compatr4   r2   r   r   r   ÚdtypeÚkindÚappendr	   r*   r   r   r'   Ú
asanyarrayr   Úarray_namespace)r5   Únumpy_arraysÚ
api_arraysÚarrayÚarr_infos        r   r>   r>   E   sñ  € õH ð åÐà€LØ€Jàð 'ñ 'ˆÝ&¥t¨E¡{¤{Ñ3Ô3ˆØ•}Ô)Ð)Ð)Øà�Ô,Ð,Ð,ØŒ{Ô 7Ð*Ð*Ø×#Ò# EÑ*Ô*Ð*Ð*Ø”Ô! SÒ(Ð(­\¸%Ñ-@Ô-@Ð(ð ×!Ò! %Ñ(Ô(Ð(Ð(åð !S¸%¼+ð !Sð !Sð !Sñ Tô Tð Tð �Ô.Ð.Ð.Õ3CÀEÑ3JÔ3JÐ.Ø×Ò˜eÑ$Ô$Ð$Ð$ð7Ýœ eÑ,Ô,��øÝð 7ð 7ð 7Ýð !6ñ 7ô 7ð 7ð7øøøð Œ{Ô wÐ.Ð.Ýð !S¸%¼+ð !Sð !Sð !Sñ Tô Tð Tà×Ò Ñ&Ô&Ð&Ñ&ð ð ÝÐõ Ô+ÐG¨\ÐG¸JÐGÐGÐGÐGs   Ã6DÄD%)&Ú__doc__ÚenumÚosÚ	functoolsr   Útypesr   Útypingr   r   r   r'   Únumpy.typingÚnptÚ
scipy._libr   Ú!scipy._lib.array_api_compat.numpyÚ_libr9   Úscipy._lib.array_api_compatr   r	   Úscipy._lib._sparser
   r   Ú__annotations__r   ÚenvironÚgetr   Ústrr1   r   ÚEnumr   r2   r4   r>   r   r   r   ú<module>rU      så  ððð ð ð €€€Ø 	€	€	€	à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ð !Ð !à Ð Ð Ð Ø Ð Ð Ð Ð Ð à 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø FÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ (Ð (Ð (Ð (Ð (Ð (ð €€yÐ Ð Ñ Ø˜sœ}Ñ,€	ˆ9Ð ,Ð ,Ñ ,ð !œjŸnšnÐ->ÀÑFÔF€��t‘Ð FÐ FÑ FàŒz�~Š~˜n¨eÑ4Ô4€ðð ð ð ð �D”Iñ ô ð ð €ˆ3�„ð!˜Tð ! mð !ð !ð !ñ „ð!ð:QH˜Uð QH zð QHð QHð QHð QHð QHð QHr   