Ë
    âQ(hQ  ã                   óR  — d Z ddlZddlmZmZm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 g d¢Zej$                  ej&                  ej(                  ej*                  ej,                  ej.                  ej0                  eeej2                  ej4                  ej6                  ej8                  ej:                  ej<                  ej>                  ej@                  gZ!i Z"d„ Z#d„ Z$d	„ Z%d
„ Z&d„ Z'd+d„Z(d,dejR                  fd„Z*ejV                  dfd„Z,d-d„Z-dej\                  dej\                  fd„Z/de0fd„Z1de0fd„Z2d.ddœde0fd„Z3de0fd„Z4de0fd„Z5de0fd„Z6d/d„Z7d0ddœde8e9df   fd„Z:d„ Z;d „ Z<de0fd!„Z=	 	 d+d"ed#ded$   z  d%edeed&f   fd'„Z>d(„ Z?d0d)„Z@dejR                  fd*„ZAy)1z, Utility functions for sparse matrix module
é    N)ÚAnyÚLiteralÚUnion)Úprod)Únp_longÚnp_ulong)ÚupcastÚgetdtypeÚgetdataÚisscalarlikeÚ	isintlikeÚisshapeÚ
issequenceÚisdenseÚismatrixÚget_sum_dtypeÚbroadcast_shapesc                  óô   — t         j                  t        | «      «      }|�|S t        j                  | Ž }t
        D ].  }t        j                  ||«      sŒ|t         t        | «      <   |c S  t        d| ›�«      ‚)aÎ  Returns the nearest supported sparse dtype for the
    combination of one or more types.

    upcast(t0, t1, ..., tn) -> T  where T is a supported dtype

    Examples
    --------
    >>> from scipy.sparse._sputils import upcast
    >>> upcast('int32')
    <class 'numpy.int32'>
    >>> upcast('bool')
    <class 'numpy.bool'>
    >>> upcast('int32','float32')
    <class 'numpy.float64'>
    >>> upcast('bool',complex,float)
    <class 'numpy.complex128'>

    z#no supported conversion for types: )Ú_upcast_memoÚgetÚhashÚnpÚresult_typeÚsupported_dtypesÚcan_castÚ	TypeError)ÚargsÚtr	   s      úS/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/scipy/sparse/_sputils.pyr	   r	      su   € ô( 	×Ñœ˜d›Ó$€AØ€}Øˆä�^‰^˜TÐ"€Fäò ˆÜ�;‰;�v˜qÕ!Ø'(ŒLœ˜d›Ñ$ØŠHðô
 Ð9¸$¸ÐBÓ
CÐCó    c                  óŠ   — t         j                  | «      }|�|S t        t        t        j
                  | «      Ž }|t         | <   |S )z9Same as `upcast` but taking dtype.char as input (faster).)r   r   r	   Úmapr   Údtype)r   r   s     r   Úupcast_charr$   ;   s@   € ä×Ñ˜Ó€AØ€}ØˆÜ””B—H‘H˜dÓ#Ð$€AØ„L�ÑØ€Hr    c                 óL   — t        j                  dg| ¬«      |z  j                  S )z`Determine data type for binary operation between an array of
    type `dtype` and a scalar.
    r   ©r#   )r   Úarrayr#   )r#   Úscalars     r   Úupcast_scalarr)   E   s"   € ô �H‰H�a�S Ô&¨Ñ/×6Ñ6Ð6r    c                 ó>  — | j                   j                  t        j                   t        j                  «      j                  kD  rØ| j                  dk(  r| j                  t        j                  «      S | j                  «       }| j                  «       }|t        j                  t        j                  «      j                  kD  s0|t        j                  t        j                  «      j                  k  rt        d«      ‚| j                  t        j                  «      S | S )zž
    Down-cast index array to np.intp dtype if it is of a larger dtype.

    Raise an error if the array contains a value that is too large for
    intp.
    r   zzCannot deal with arrays with indices larger than the machine maximum address size (e.g. 64-bit indices on 32-bit machine).)
r#   Úitemsizer   ÚintpÚsizeÚastypeÚmaxÚminÚiinfoÚ
ValueError)ÚarrÚmaxvalÚminvals      r   Údowncast_intp_indexr6   L   sÁ   € ð ‡y�y×ÑœBŸH™H¤R§W¡WÓ-×6Ñ6Ò6Ø�8‰8�qŠ=Ø—:‘:œbŸg™gÓ&Ð&Ø—‘“ˆØ—‘“ˆØ”B—H‘HœRŸW™WÓ%×)Ñ)Ò)¨V´b·h±h¼r¿w¹wÓ6G×6KÑ6KÒ-KÜð Hó Ið Ið �z‰zœ"Ÿ'™'Ó"Ð"Ø€Jr    c                 ó‚   — | j                   }|j                  r| S t        j                  | |j	                  d«      ¬«      S )a  
    Ensure that the data type of the NumPy array `A` has native byte order.

    `A` must be a NumPy array.  If the data type of `A` does not have native
    byte order, a copy of `A` with a native byte order is returned. Otherwise
    `A` is returned.
    Únativer&   )r#   Úisnativer   ÚasarrayÚnewbyteorder)ÚAÚdts     r   Ú	to_nativer>   `   s5   € ð 
�‰€BØ	‡{‚{ð ˆÜ�:‰:�a˜rŸ™¨xÓ8Ô9Ð9r    c                 óD  — | €	 |j                   }nt        j                   | «      }|t        vr8dj                  d„ t        D «       «      }t        d|j                  › d|› d�«      ‚|S # t        $ r.}|�t        j                   |«      }nt        d«      |‚Y d}~Œtd}~ww xY w)aØ  Form a supported numpy dtype based on input arguments.

    Returns a valid ``numpy.dtype`` from `dtype` if not None,
    or else ``a.dtype`` if possible, or else the given `default`
    if not None, or else raise a ``TypeError``.

    The resulting ``dtype`` must be in ``supported_dtypes``:
        bool_, int8, uint8, int16, uint16, int32, uint32,
        int64, uint64, longlong, ulonglong, float32, float64,
        longdouble, complex64, complex128, clongdouble
    Nzcould not interpret data typeú, c              3   ó4   K  — | ]  }|j                   –— Œ y ­w©N)Ú__name__)Ú.0r   s     r   ú	<genexpr>zgetdtype.<locals>.<genexpr>ˆ   s   è ø€ Ò(N¸¨¯­Ñ(Nùs   ‚z$scipy.sparse does not support dtype z . The only supported types are: ú.)r#   ÚAttributeErrorr   r   r   Újoinr2   Úname)r#   ÚaÚdefaultÚnewdtypeÚeÚsupported_dtypes_fmts         r   r
   r
   p   s´   € ð €}ð	HØ—w‘w‰Hô —8‘8˜E“?ˆàÔ'Ñ'Ø#Ÿy™yÑ(NÔ=MÔ(NÓNÐÜÐ?ÀÇÁ¸ð O:Ø:NÐ9OÈqðRó Sð 	Sà€Oøô ò 	HØÐ"ÜŸ8™8 GÓ,‘äÐ ?Ó@ÀaÐGô ûð	Hús   „A( Á(	BÁ1$BÂBÚreturnc                 ó`   — t        j                  | ||¬«      }t        |j                  «       |S )z‰
    This is a wrapper of `np.array(obj, dtype=dtype, copy=copy)`
    that will generate a warning if the result is an object array.
    )r#   Úcopy)r   r'   r
   r#   )Úobjr#   rQ   Údatas       r   r   r   Ž   s)   € ô
 �8‰8�C˜u¨4Ô0€Dô ˆT�Z‰ZÔØ€Kr    Ú c                 ó  ‡‡— |sd‰› �}t        j                  ‰«      j                  Š| j                  dv rž| j                  d   ‰kD  rt        d|› �«      ‚t        | j                  Ž ‰kD  r+| j                  ‰kD  j                  «       rt        d|› �«      ‚| j                  j                  ‰d¬«      }| j                  j                  ‰d¬«      }||fS | j                  dk(  r_t        | j                  Ž ‰kD  r,t        ˆfd	„| j                  D «       «      rt        d
|› �«      ‚t        ˆfd„| j                  D «       «      S | j                  dk(  r_t        | j                  Ž ‰kD  r+| j                  ‰kD  j                  «       rt        d|› �«      ‚| j                  j                  ‰d¬«      }|S | j                  dk(  r°| j                  \  }}| j                  d   |z  ‰kD  rt        d«      ‚t        | j                  Ž ‰kD  r.| j                  |z  ‰kD  j                  «       rt        d|› �«      ‚| j                  j                  ‰d¬«      }| j                  j                  ‰d¬«      }||fS t        d| j                  › d�«      ‚)a6	  Safely cast sparse array indices to `idx_dtype`.

    Check the shape of `A` to determine if it is safe to cast its index
    arrays to dtype `idx_dtype`. If any dimension in shape is larger than
    fits in the dtype, casting is unsafe so raise ``ValueError``.
    If safe, cast the index arrays to `idx_dtype` and return the result
    without changing the input `A`. The caller can assign results to `A`
    attributes if desired or use the recast index arrays directly.

    Unless downcasting is needed, the original index arrays are returned.
    You can test e.g. ``A.indptr is new_indptr`` to see if downcasting occurred.

    .. versionadded:: 1.15.0

    Parameters
    ----------
    A : sparse array or matrix
        The array for which index arrays should be downcast.
    idx_dtype : dtype
        Desired dtype. Should be an integer dtype (default: ``np.int32``).
        Most of scipy.sparse uses either int64 or int32.
    msg : string, optional
        A string to be added to the end of the ValueError message
        if the array shape is too big to fit in `idx_dtype`.
        The error message is ``f"<index> values too large for {msg}"``
        It should indicate why the downcasting is needed, e.g. "SuperLU",
        and defaults to f"dtype {idx_dtype}".

    Returns
    -------
    idx_arrays : ndarray or tuple of ndarrays
        Based on ``A.format``, index arrays are returned after casting to `idx_dtype`.
        For CSC/CSR, returns ``(indices, indptr)``.
        For COO, returns ``coords``.
        For DIA, returns ``offsets``.
        For BSR, returns ``(indices, indptr)``.

    Raises
    ------
    ValueError
        If the array has shape that would not fit in the new dtype, or if
        the sparse format does not use index arrays.

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import sparse
    >>> data = [3]
    >>> coords = (np.array([3]), np.array([1]))  # Note: int64 arrays
    >>> A = sparse.coo_array((data, coords))
    >>> A.coords[0].dtype
    dtype('int64')

    >>> # rescast after construction, raising exception if shape too big
    >>> coords = sparse.safely_cast_index_arrays(A, np.int32)
    >>> A.coords[0] is coords[0]  # False if casting is needed
    False
    >>> A.coords = coords  # set the index dtype of A
    >>> A.coords[0].dtype
    dtype('int32')
    zdtype ©ÚcscÚcsréÿÿÿÿzindptr values too large for zindices values too large for F©rQ   Úcooc              3   óD   •K  — | ]  }|‰kD  j                  «       –— Œ y ­wrB   )Úany)rD   ÚcoÚ	max_values     €r   rE   z+safely_cast_index_arrays.<locals>.<genexpr>í   s   øè ø€ Ò=¨b�B˜‘N×'Ñ'×)Ñ=ùó   ƒ zcoords values too large for c              3   óD   •K  — | ]  }|j                  ‰d ¬«      –— Œ y­w)FrZ   N)r.   )rD   r^   Ú	idx_dtypes     €r   rE   z+safely_cast_index_arrays.<locals>.<genexpr>ï   s   øè ø€ ÒI¸"�R—Y‘Y˜y¨u�Y×5ÑIùr`   Údiazoffsets values too large for Úbsrz!indptr values too large for {msg}zFormat zP is not associated with index arrays. DOK and LIL have dict and list, not array.)r   r1   r/   ÚformatÚindptrr2   ÚshapeÚindicesr]   r.   ÚcoordsÚtupleÚoffsetsÚ	blocksizer   )	r<   rb   Úmsgrh   rf   rk   ÚRÚCr_   s	    `      @r   Úsafely_cast_index_arraysrp   š   sY  ù€ ñ| Ø�y�kÐ"ˆä—‘˜Ó#×'Ñ'€Ià‡x�x�>Ñ!à�8‰8�B‰<˜)Ò#ÜÐ;¸C¸5ÐAÓBÐBô �—‘ˆ=˜9Ò$Ø—	‘	˜IÑ%×*Ñ*Ô,Ü Ð#@ÀÀÐ!FÓGÐGà—)‘)×"Ñ" 9°5Ð"Ó9ˆØ—‘—‘ °�Ó7ˆØ˜ˆÐà	
�‰�UÒ	Ü�—‘ˆ=˜9Ò$ÜÓ=°A·H±HÔ=Ô=Ü Ð#?À¸uÐ!EÓFÐFÜÓIÀÇÁÔIÓIÐIà	
�‰�UÒ	Ü�—‘ˆ=˜9Ò$Ø—	‘	˜IÑ%×*Ñ*Ô,Ü Ð#@ÀÀÐ!FÓGÐGØ—)‘)×"Ñ" 9°5Ð"Ó9ˆØˆà	
�‰�UÒ	Ø�{‰{‰ˆˆ1Ø�8‰8�B‰<˜!Ñ˜iÒ'ÜÐ@ÓAÐAÜ�—‘ˆ=˜9Ò$Ø—	‘	˜A‘ 	Ñ)×.Ñ.Ô0Ü Ð#@ÀÀÐ!FÓGÐGØ—)‘)×"Ñ" 9°5Ð"Ó9ˆØ—‘—‘ °�Ó7ˆØ˜ˆÐô ˜' !§(¡( ð ,Eð Eó Fð 	Fr    c                 ó¤  — t        j                  «       j                  dk7  rt         j                  S t        j                  t        j
                  t         j                  «      j                  «      }t        j                  t        j
                  t         j                  «      j                  «      }|�*t        j                  |«      }||kD  rt         j                  S t        | t         j                  «      r| f} | D ]Â  }t        j                  |«      }t        j                  |j                  t         j                  «      rŒG|ri|j                  dk(  rŒYt        j                  |j                  t         j                  «      r+|j                  «       }|j                  «       }||k\  r||k  rŒ²t         j                  c S  t         j                  S )aÃ  
    Based on input (integer) arrays `a`, determine a suitable index data
    type that can hold the data in the arrays.

    Parameters
    ----------
    arrays : tuple of array_like
        Input arrays whose types/contents to check
    maxval : float, optional
        Maximum value needed
    check_contents : bool, optional
        Whether to check the values in the arrays and not just their types.
        Default: False (check only the types)

    Returns
    -------
    dtype : dtype
        Suitable index data type (int32 or int64)

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import sparse
    >>> # select index dtype based on shape
    >>> shape = (3, 3)
    >>> idx_dtype = sparse.get_index_dtype(maxval=max(shape))
    >>> data = [1.1, 3.0, 1.5]
    >>> indices = np.array([0, 1, 0], dtype=idx_dtype)
    >>> indptr = np.array([0, 2, 3, 3], dtype=idx_dtype)
    >>> A = sparse.csr_array((data, indices, indptr), shape=shape)
    >>> A.indptr.dtype
    dtype('int32')

    >>> # select based on larger of existing arrays and shape
    >>> shape = (3, 3)
    >>> idx_dtype = sparse.get_index_dtype(A.indptr, maxval=max(shape))
    >>> idx_dtype
    <class 'numpy.int32'>
    é   r   )r   Úintcr+   Úint64Úint32r1   r0   r/   Ú
isinstanceÚndarrayr:   r   r#   r-   Ú
issubdtypeÚinteger)Úarraysr4   Úcheck_contentsÚint32minÚint32maxr3   r5   s          r   Úget_index_dtyper~     s3  € ôR 
‡w�wƒy×Ñ˜QÒÜ�x‰xˆä�x‰xœŸ™¤§¡Ó*×.Ñ.Ó/€HÜ�x‰xœŸ™¤§¡Ó*×.Ñ.Ó/€HàÐÜ—‘˜&Ó!ˆØ�HÒÜ—8‘8ˆOä�&œ"Ÿ*™*Ô%Ø�ˆàò ˆÜ�j‰j˜‹oˆÜ�{‰{˜3Ÿ9™9¤b§h¡hÕ/ÙØ—8‘8˜q’=àÜ—]‘] 3§9¡9¬b¯j©jÔ9Ø ŸW™W›Y�FØ ŸW™W›Y�FØ Ò)¨f¸Ò.@à Ü—8‘8ŠOðô �8‰8€Or    r#   c                 óô   — | j                   dk(  r4t        j                  | t        j                  «      rt        j                  S t        j                  | t        j                  «      rt        j                  S | S )z Mimic numpy's casting for np.sumÚu)Úkindr   r   ÚuintÚint_r&   s    r   r   r   P  sH   € à‡z�z�SÒœRŸ[™[¨´·±Ô8Ü�w‰wˆÜ	‡{�{�5œ"Ÿ'™'Ô"Ü�w‰wˆØ€Lr    c                 óh   — t        j                  | «      xs t        | «      xr | j                  dk(  S )z8Is x either a scalar, an array scalar, or a 0-dim array?r   )r   Úisscalarr   Úndim©Úxs    r   r   r   Y  s&   € ä�;‰;�q‹>Ò9œg a›jÒ8¨Q¯V©V°q©[Ð9r    c                 ó  — t        j                  | «      dk7  ry	 t        j                  | «       y# t        t
        f$ rC 	 t        t        | «      | k(  «      }n# t        t
        f$ r Y Y yw xY w|rd}t        |«      ‚|cY S w xY w)zsIs x appropriate as an index into a sparse matrix? Returns True
    if it can be cast safely to a machine int.
    r   Fz4Inexact indices into sparse matrices are not allowedT)r   r†   ÚoperatorÚindexr   r2   ÚboolÚint)rˆ   Ú	loose_intrm   s      r   r   r   ^  sˆ   € ô 
‡w�wˆqƒz�Q‚Øð
Ü�‰�qÔð øô ”zÐ"ò ð	ÜœS ›V q™[Ó)‰IøÜœ:Ð&ò 	Úð	úáØHˆCÜ˜S“/Ð!ØÒðús3   ›1 ±BÁAÁBÁA,Á(BÁ+A,Á,BÂB)é   )Úallow_ndc                ó`   — t        | «      }||vry| D ]  }t        |«      s y|sŒ|dk  sŒ y y)z Is x a valid tuple of dimensions?

    If nonneg, also checks that the dimensions are non-negative.
    Shapes of length in the tuple allow_nd are allowed.
    Fr   T)Úlenr   )rˆ   Únonnegr�   r†   Úds        r   r   r   t  sB   € ô ˆq‹6€DØ�8ÑØàò ˆÜ˜Œ|ÙÚ�a˜!“eÙð	ð
 r    c                 óÞ   — t        | t        t        z  «      xr( t        | «      dk(  xs t	        j
                  | d   «      xs+ t        | t        j                  «      xr | j                  dk(  S )Nr   é   )rv   Úlistrj   r’   r   r…   rw   r†   ©r   s    r   r   r   †  sW   € Ü˜œ4¤%™<Ó(ò /Ü�‹V�q‰[Ò-œBŸK™K¨¨!©Ó-ò:ä˜œ2Ÿ:™:Ó&Ò8¨A¯F©F°a©Kð;r    c                 óÊ   — t        | t        t        z  «      xr t        | «      dkD  xr t	        | d   «      xs+ t        | t
        j                  «      xr | j                  dk(  S )Nr   r�   )rv   r—   rj   r’   r   r   rw   r†   r˜   s    r   r   r   Œ  sV   € Ü˜œ4¤%™<Ó(ò -Ü�‹V�a‰Zò-Ü& q¨¡tÓ,ò8ä˜œ2Ÿ:™:Ó&Ò6¨1¯6©6°Q©;ð9r    c                 ó6   — t        | t        j                  «      S rB   )rv   r   rw   r‡   s    r   r   r   ’  s   € Ü�aœŸ™Ó$Ð$r    c                 ó8  — | €y t        | «      }t        | t        «      rt        d«      ‚t	        j
                  t	        j                  |«      t        j                  «      st        d|j                  › �«      ‚d| cxk  rdk  st        d«      ‚ t        d«      ‚y )NzlTuples are not accepted for the 'axis' parameter. Please pass in one of the following: {-2, -1, 0, 1, None}.zaxis must be an integer, not éþÿÿÿr–   zaxis out of range)
Útyperv   rj   r   r   rx   r#   ry   rC   r2   )ÚaxisÚ	axis_types     r   Úvalidateaxisr    –  s•   € Ø€|ØÜ�T“
€Iô �$œÔÜð 0ó 1ð 	1ô �=‰=œŸ™ )Ó,¬b¯j©jÔ9ÜÐ7¸	×8JÑ8JÐ7KÐLÓMÐMà�$ŒO˜!ŠOÜÐ,Ó-Ð-ð ÜÐ,Ó-Ð-ð r    .c                óp  — t        | «      dk(  rt        d«      ‚t        | «      dk(  r"	 t        | d   «      }t        d„ |D «       «      }nt        d„ | D «       «      }|€;t        |«      |vrt        d|› d|›�«      ‚t        d	„ |D «       «      rÛt        d
«      ‚t        |«      }t        |«      D ��cg c]  \  }}|dk  sŒ|‘Œ }}}|s!t        |«      }	|	|k7  r�t        d|› d|› �«      ‚t        |«      dk(  rf|d   }
t        |d|
 ||
dz   d z   «      }t        ||«      \  }}|dk7  r#t        d„ |D «       «      }t        d|› d|› �«      ‚|d|
 |fz   ||
dz   d z   }nt        d«      ‚t        |«      |vrt        d|› d|›�«      ‚|S # t        $ r t	        j
                  | d   «      f}Y �ŒRw xY wc c}}w )a@  Imitate numpy.matrix handling of shape arguments

    Parameters
    ----------
    args : array_like
        Data structures providing information about the shape of the sparse array.
    current_shape : tuple, optional
        The current shape of the sparse array or matrix.
        If None (default), the current shape will be inferred from args.
    allow_nd : tuple of ints, optional default: (2,)
        If shape does not have a length in the tuple allow_nd an error is raised.

    Returns
    -------
    new_shape: tuple
        The new shape after validation.
    r   z8function missing 1 required positional argument: 'shape'r–   c              3   óF   K  — | ]  }t        j                  |«      –— Œ y ­wrB   ©rŠ   r‹   ©rD   Úargs     r   rE   zcheck_shape.<locals>.<genexpr>Ç  s   è ø€ ÒH°cœhŸn™n¨S×1ÑHùó   ‚!c              3   óF   K  — | ]  }t        j                  |«      –— Œ y ­wrB   r£   r¤   s     r   rE   zcheck_shape.<locals>.<genexpr>É  s   è ø€ Ò>°#œ(Ÿ.™.¨×-Ñ>ùr¦   Nzshape must have length in z. Got new_shape=c              3   ó&   K  — | ]	  }|d k  –— Œ y­w)r   N© )rD   r”   s     r   rE   zcheck_shape.<locals>.<genexpr>Î  s   è ø€ Ò(˜ˆq�1�uÑ(ùs   ‚z#'shape' elements cannot be negativezcannot reshape array of size z into shape c              3   ó.   K  — | ]  }|d k  rdn|–— Œ y­w)r   ÚnewshapeNr©   )rD   rˆ   s     r   rE   zcheck_shape.<locals>.<genexpr>à  s   è ø€ Ò!PÀ°°A²¡*¸1Ó"<Ñ!Pùs   ‚z&can only specify one unknown dimension)r’   r   Úiterrj   rŠ   r‹   r2   r]   r   Ú	enumerateÚdivmod)r   Úcurrent_shaper�   Ú
shape_iterÚ	new_shapeÚcurrent_sizeÚirˆ   Únegative_indexesÚnew_sizeÚskipÚ	specifiedÚunspecifiedÚ	remainderÚ	err_shapes                  r   Úcheck_shaper»   ­  s  € ô$ ˆ4ƒy�A‚~ÜÐRÓSÐSÜ
ˆ4ƒy�A‚~ð	IÜ˜d 1™g›ˆJô ÑH¸ZÔHÓH‰IäÑ>¸Ô>Ó>ˆ	àÐÜˆy‹> Ñ)ÜÐ9¸(¸ÐCTÈ)ÈÐVÓWÐWÜÑ(˜iÔ(Ô(ÜÐBÓCÐCô ˜MÓ*ˆô +4°IÓ*>×H¡$ ! QÀ!ÀaÃ%šAÐHÐÑHÙÜ˜I“ˆHØ˜<Ò'Ü Ð#@ÀÀØ#/°	¨{ð"<ó =ð =äÐ!Ó" aÒ'Ø# AÑ&ˆDÜ˜Y u¨Ð-°	¸$¸q¹&¸'Ð0BÑBÓCˆIÜ%+¨L¸)Ó%DÑ"ˆK˜Ø˜AŠ~Ü!Ñ!PÀiÔ!PÓP�	Ü Ð#@ÀÀØ#/°	¨{ð"<ó =ð =à! % 4Ð(¨K¨>Ñ9¸IÀdÈ1ÁfÀgÐ<NÑN‰IäÐEÓFÐFä
ˆ9ƒ~˜XÑ%ÜÐ5°h°ZÐ?PÀiÀ\ÐRÓSÐSàÐøôM ò 	4Ü!Ÿ™¨¨Q©Ó0Ð3‹Ið	4üó" Is   ©F	 Â2F2Ã F2Æ	"F/Æ.F/c                  óH  — | sy| D �cg c]  }t        |t        t        f«      r|n|f‘Œ } }t        | t        ¬«      }t        |«      }| D ]M  }||u rŒt        |t	        |«       ¬«      D ],  \  }}|dk7  sŒ|||   k7  sŒ||   dk7  rt        d«      ‚|||<   Œ. ŒO g |¢­S c c}w )a  Check if shapes can be broadcast and return resulting shape

    This is similar to the NumPy ``broadcast_shapes`` function but
    does not check memory consequences of the resulting dense matrix.

    Parameters
    ----------
    *shapes : tuple of shape tuples
        The tuple of shapes to be considered for broadcasting.
        Shapes should be tuples of non-negative integers.

    Returns
    -------
    new_shape : tuple of integers
        The shape that results from broadcasting th input shapes.
    r©   )Úkey)Ústartr–   z-shapes cannot be broadcast to a single shape.)rv   rj   r—   r/   r’   r­   r2   )ÚshapesÚshpÚbig_shpÚoutr³   rˆ   s         r   r   r   í  sÁ   € ñ" ØØKQÖRÀC”Z ¤e¬T ]Ô3‰c¸#¸Ñ?ÐR€FÐRÜ�&œcÔ"€GÜ
ˆw‹-€CØò ˆØ�'‰>ØÜ˜c¬#¨c«(¨Ô3ò 	‰DˆAˆqØ�A‹v˜!˜s 1™v›+Ø�q‘6˜Q’;Ü$Ð%TÓUÐUØ��A’ñ		ðð ˆS‰7€Nùò Ss   ˆ"Bc                 ó¬   — | j                  dd«      }| j                  dd«      }| r+t        ddj                  | j                  «       «      › �«      ‚||fS )a?  Unpack keyword arguments for reshape function.

    This is useful because keyword arguments after star arguments are not
    allowed in Python 2, but star keyword arguments are. This function unpacks
    'order' and 'copy' from the star keyword arguments (with defaults) and
    throws an error for any remaining.
    Úorderro   rQ   Fz-reshape() got unexpected keywords arguments: r@   )Úpopr   rH   Úkeys)ÚkwargsrÄ   rQ   s      r   Úcheck_reshape_kwargsrÈ     s[   € ð �J‰J�w Ó$€EØ�:‰:�f˜eÓ$€DÙÜÐGØŸ9™9 V§[¡[£]Ó3Ð4ð6ó 7ð 	7à�$ˆ;Ðr    c                 óz   — t        t        j                  j                  d«      dd«      }|duxr t	        | |«      S )zV
    Check whether object is pydata/sparse matrix, avoiding importing the module.
    ÚsparseÚSparseArrayN)ÚgetattrÚsysÚmodulesr   rv   )ÚmÚbase_clss     r   Úis_pydata_spmatrixrÑ     s6   € ô ”s—{‘{—‘ xÓ0°-ÀÓF€HØ˜4ÐÒ;¤J¨q°(Ó$;Ð;r    r¥   Útarget_formatrV   Ú	accept_fvzsp.spmatrixc                 óæ   — t        | «      rF	 | j                  |¬«      } |�| j                  |«      } | S | j                  dvr| j                  «       } | S # t        $ r | j                  «       } Y ŒPw xY w)z_
    Convert a pydata/sparse array to scipy sparse matrix,
    pass through anything else.
    )rÓ   rV   )rÑ   Úto_scipy_sparser   Úasformatre   Útocsc)r¥   rÒ   rÓ   s      r   Úconvert_pydata_sparse_to_scipyrØ   '  s~   € ô ˜#Ôð	(Ø×%Ñ%°	Ð%Ó:ˆCð Ð$Ø—,‘,˜}Ó-ˆCð €Jð �Z‰Z˜~Ñ-Ø—)‘)“+ˆCØ€Jøô ò 	(Ø×%Ñ%Ó'ŠCð	(ús   �A ÁA0Á/A0c                  óf   — t        j                  | i |¤Žj                  t         j                  «      S rB   )r   r'   ÚviewÚmatrix)r   rÇ   s     r   rÛ   rÛ   D  s%   € Ü�8‰8�TÐ$˜VÑ$×)Ñ)¬"¯)©)Ó4Ð4r    c                 óÄ   — t        | t        j                  «      r|�| j                  |k(  r| S t        j                  | |¬«      j                  t        j                  «      S )Nr&   )rv   r   rÛ   r#   r:   rÚ   )rS   r#   s     r   ÚasmatrixrÝ   H  sD   € Ü�$œŸ	™	Ô"¨¨¸¿¹ÀuÒ9LØˆÜ�:‰:�d %Ô(×-Ñ-¬b¯i©iÓ8Ð8r    c                 ó0  — t        | t        j                  j                  «      r| j	                  «       S t        | t        j
                  «      r:t        j                  | j                  «       | j                  | j                  ¬«      S t        | t        j                  «      rWt        j                  | j                  | j                  ¬«      }t        j                  j                  | j                  |«       |S | j!                  «       j	                  «       S )zñAccess nonzero values, possibly after summing duplicates.

    Parameters
    ----------
    s : sparse array
        Input sparse array.

    Returns
    -------
    data: ndarray
      Nonzero values of the array, with shape (s.nnz,)

    )r#   Úcountr&   )rv   ÚspÚ_dataÚ_data_matrixÚ_deduped_dataÚ	dok_arrayr   ÚfromiterÚvaluesr#   ÚnnzÚ	lil_arrayÚemptyÚ_csparsetoolsÚlil_flatten_to_arrayrS   Útocoo)ÚsrS   s     r   Ú_todatarî   P  s®   € ô �!”R—X‘X×*Ñ*Ô+Ø�‰Ó Ð ä�!”R—\‘\Ô"Ü�{‰{˜1Ÿ8™8›:¨Q¯W©W¸A¿E¹EÔBÐBä�!”R—\‘\Ô"Ü�x‰x˜Ÿ™ Q§W¡WÔ-ˆÜ
×Ñ×-Ñ-¨a¯f©f°dÔ;Øˆà�7‰7‹9×"Ñ"Ó$Ð$r    )NN)NF)r©   NF)F)rO   NrB   )BÚ__doc__rÍ   Útypingr   r   r   rŠ   Únumpyr   Úmathr   Úscipy.sparserÊ   rà   Úscipy._lib._utilr   r   Ú__all__Úbool_ÚbyteÚubyteÚshortÚushortrs   ÚuintcÚlonglongÚ	ulonglongÚfloat32Úfloat64Ú
longdoubleÚ	complex64Ú
complex128Úclongdoubler   r   r	   r$   r)   r6   r>   r
   rw   r   ru   rp   r~   r#   r   rŒ   r   r   r   r   r   r   r    rj   r�   r»   r   rÈ   rÑ   rØ   rÛ   rÝ   rî   r©   r    r   ú<module>r     sê  ðñó ß &Ñ &Û Û Ý Ý ß .ò€ð —H‘H˜bŸg™g r§x¡x°·±¸2¿9¹9ÀbÇgÁgØ—H‘H˜g x°·±¸b¿l¹lØ—J‘J §
¡
¨B¯M©MØ—L‘L "§-¡-°·±ðAÐ ð
 €òDòDò7òò(:ó ñ<	¨B¯J©Jó 	ð +-¯(©(¸ó kFó\EðP˜Ÿ™ð  b§h¡hó ð:�tó :ð
�Dó ð,¨ò °$ó ð$;�Tó ;ð9�4ó 9ð%�$ó %ó.ð.=°dò =¸uÀSÈ#ÀX¹ó =ò@òBð"<˜Tó <ð 37ØñØ	ðà˜' ,Ñ/Ñ/ðð ðð ˆ3�ÐÑó	ò:5ó9ð%�"—*‘*ô %r    