Ë
    0Ò^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 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 d	dd
„ f­Zddd„ f­Zej2                  j5                  dd«      Zeez  ed<   ej2                  j5                  dd«      Z G d„ dej@                  «      Z! ed«      dde"de!fd„«       Z#ddœdedefd„Z$y)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)Úarray_api_compat)Úis_array_api_objÚis_jax_array)Ú	SparseABCÚArrayc                  ó   — t         S ©Nr   © ó    úi/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/scipy/_lib/_array_api_override.pyr   r      s   € ŒSÐ r   Ú	ArrayLikec                  ó0   — t         t        j                  z  S r   )r   Únptr   r   r   r   r   r      s   € ”œŸ™Ñ&Ð &r   ÚSCIPY_ARRAY_APIFÚSCIPY_DEVICEÚcpuc                   ó   — e Zd ZdZdZdZdZy)Ú_ArrayClsInfor   é   é   é   N)Ú__name__Ú
__module__Ú__qualname__ÚskipÚnumpyÚ
array_likeÚunknownr   r   r   r   r       s   „ Ø€DØ€EØ€JØ�Gr   r   éd   ÚclsÚreturnc                 ón  — t        | t        t        z  «      rt        j                  S t        | t
        «      r|sd}t        |«      ‚t        j                  S t        | t        j                  j                  «      rt        d«      ‚t        | t        j                  «      rt        d«      ‚t        | t        j                  t        j                  z  «      rt        j                  S t        | t        t         z  t"        z  t$        z  t'        d «      z  «      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
   Ú
ValueErrorr    ÚnpÚmaÚMaskedArrayÚ	TypeErrorÚmatrixÚndarrayÚgenericÚintÚfloatÚcomplexÚboolÚtyper   r"   )r$   Ú	sparse_okÚmsgs      r   Ú_validate_array_clsr9   '   sä   € ä�#”tœe‘|Ô$Ü×'Ñ'Ð'ô �#”yÔ!Ùð*ˆCô ˜S“/Ð!ô ×"Ñ"Ð"ä�#”r—u‘u×(Ñ(Ô)ÜÐRÓSÐSä�#”r—y‘yÔ!ÜÐJÓKÐKä�#”r—z‘z¤B§J¡JÑ.Ô/Ü×"Ñ"Ð"ô
 �#”sœU‘{¤WÑ,¬tÑ3´d¸4³jÑ@ÔAÜ×!Ñ!Ð!ä× Ñ Ð r   ©r7   Úarraysc                 ó  — t         st        S g }g }|D �]>  }t        t        |«      | ¬«      }|t        j
                  u rŒ-|t        j                  u ry|j                  j                  dv r|j                  |«       Œi|j                  j                  dk(  rt        |«      r|j                  |«       ŒŸt        d|j                  ›d�«      ‚|t        j                  u rt        |«      r|j                  |«       Œç	 t        j                  |«      }|j                  j                  dvrt        d|j                  ›d�«      ‚|j                  |«       �ŒA |st        S t!        j"                  g |¢|¢­Ž S # t        $ r t        d«      ‚w xY w)aé  Get the array API compatible namespace for the arrays xs.

    Parameters
    ----------
    *arrays : sequence of array_like
        Arrays used to infer the common namespace.
    sparse_ok : bool
        ``True`` if `scipy.sparse` arrays should be accepted where the
        namespace would otherwise be NumPy. Default: ``False``.

    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

    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.
    r:   Ú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_compatr9   r6   r   r   r    ÚdtypeÚkindÚappendr	   r.   r"   r   r+   Ú
asanyarrayr   Úarray_namespace)r7   r;   Únumpy_arraysÚ
api_arraysÚarrayÚarr_infos         r   rD   rD   I   s’  € õL äÐà€LØ€Jàó 'ˆÜ&¤t¨E£{¸iÔHˆØ”}×)Ñ)Ñ)Øàœ×,Ñ,Ñ,Ø�{‰{×Ñ 7Ñ*Ø×#Ñ# EÕ*Ø—‘×!Ñ! SÒ(¬\¸%Ô-@ð ×!Ñ! %Õ(äÐ"9¸%¿+¹+¸ð ISð !Só Tð Tð œ×.Ñ.Ñ.Ô3CÀEÔ3JØ×Ñ˜eÕ$ð7ÜŸ™ eÓ,�ð �{‰{×Ñ wÑ.ÜÐ"9¸%¿+¹+¸ð ISð !Só Tð Tà×Ñ Ö&ð;'ñB ÜÐô ×+Ñ+ÐG¨\ÐG¸JÒGÐGøô ò 7Üð !6ó 7ð 7ð7ús   Ã;E4Å4F	)F)%Ú__doc__ÚenumÚosÚ	functoolsr   Útypesr   Útypingr   r    r+   Únumpy.typingr   Úscipy._externalr   Ú&scipy._external.array_api_compat.numpyÚ	_externalr?   Ú scipy._external.array_api_compatr   r	   Úscipy._lib._sparser
   r   r   ÚenvironÚgetr   Ústrr5   Ú__annotations__r   ÚEnumr   r6   r9   rD   r   r   r   ú<module>rZ      sÁ   ðòó Û 	å Ý Ý ã Ý å ,ß :Ó :ß KÝ (ö Þ &ð !Ÿj™jŸn™nÐ->ÀÓF€��t‘Ó Fà�z‰z�~‰~˜n¨eÓ4€ô�D—I‘Iô ñ ˆ3ƒñ!˜Tð !°}ò !ó ð!ðB /4ò SH˜Uð SH¸
ô SHr   