§
    fŠtja  ã                   óD   — d dl Zd dlZddgZ ed¬¦  «        Zd	d„Zd„ ZdS )
é    NÚsave_npzÚload_npzF)Úallow_pickleTc                 ó¸  — i }|j         dv r"|                     |j        |j        ¬¦  «         n•|j         dk    r|                     |j        ¬¦  «         nn|j         dk    rI|j        dk    r"|                     |j        |j        ¬¦  «         n6|                     |j        ¬¦  «         nd	|j         › d
�}t          |¦  «        ‚|                     |j          
                    d¦  «        |j        |j        ¬¦  «         t          |t          j        j        ¦  «        r|                     d¬¦  «         |rt#          j        | fi |¤Ž dS t#          j        | fi |¤Ž dS )aj   Save a sparse matrix or array to a file using ``.npz`` format.

    Parameters
    ----------
    file : str or file-like object
        Either the file name (string) or an open file (file-like object)
        where the data will be saved. If file is a string, the ``.npz``
        extension will be appended to the file name if it is not already
        there.
    matrix: spmatrix or sparray
        The sparse matrix or array to save.
        Supported formats: ``csc``, ``csr``, ``bsr``, ``dia`` or ``coo``.
    compressed : bool, optional
        Allow compressing the file. Default: True

    See Also
    --------
    scipy.sparse.load_npz: Load a sparse matrix from a file using ``.npz`` format.
    numpy.savez: Save several arrays into a ``.npz`` archive.
    numpy.savez_compressed : Save several arrays into a compressed ``.npz`` archive.

    Examples
    --------
    Store sparse matrix to disk, and load it again:

    >>> import numpy as np
    >>> import scipy as sp
    >>> sparse_matrix = sp.sparse.csc_matrix([[0, 0, 3], [4, 0, 0]])
    >>> sparse_matrix
    <Compressed Sparse Column sparse matrix of dtype 'int64'
        with 2 stored elements and shape (2, 3)>
    >>> sparse_matrix.toarray()
    array([[0, 0, 3],
           [4, 0, 0]], dtype=int64)

    >>> sp.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix)
    >>> sparse_matrix = sp.sparse.load_npz('/tmp/sparse_matrix.npz')

    >>> sparse_matrix
    <Compressed Sparse Column sparse matrix of dtype 'int64'
        with 2 stored elements and shape (2, 3)>
    >>> sparse_matrix.toarray()
    array([[0, 0, 3],
           [4, 0, 0]], dtype=int64)
    ©ÚcscÚcsrÚbsr)ÚindicesÚindptrÚdia)ÚoffsetsÚcooé   )ÚrowÚcol)Úcoordsz4Save is not implemented for sparse matrix of format ú.Úascii)ÚformatÚshapeÚdataT)Ú	_is_arrayN)r   Úupdater   r   r   Úndimr   r   r   ÚNotImplementedErrorÚencoder   r   Ú
isinstanceÚspÚsparseÚsparrayÚnpÚsavez_compressedÚsavez)ÚfileÚmatrixÚ
compressedÚarrays_dictÚmsgs        úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/sparse/_matrix_io.pyr   r      s†  € ð\ €KØ„}Ð-Ð-Ð-Ø×Ò 6¤>¸&¼-ÐÑHÔHÐHÐHØ	Œ˜%Ò	Ð	Ø×Ò 6¤>ÐÑ2Ô2Ð2Ð2Ø	Œ˜%Ò	Ð	ØŒ;˜!ÒÐà×Ò 6¤:°6´:ÐÑ>Ô>Ð>Ð>à×Ò f¤mÐÑ4Ô4Ð4Ð4àUÀVÄ]ÐUÐUÐUˆÝ! #Ñ&Ô&Ð&Ø×ÒØŒ}×#Ò# GÑ,Ô,ØŒlØŒ[ð ñ ô ð õ
 �&�"œ)Ô+Ñ,Ô,ð +Ø×Ò TÐÑ*Ô*Ð*Øð &Ý
Ô˜DÐ0Ð0 KÐ0Ð0Ð0Ð0Ð0å
Œ�Ð%Ð%˜Ð%Ð%Ð%Ð%Ð%ó    c                 ó¶  — t          j        | fi t          ¤Ž5 }|                     d¦  «        }|€t	          d| › d�¦  «        ‚|                     ¦   «         }t          |t          ¦  «        s|                     d¦  «        }|                     d¦  «        r|dz   }n|dz   }	 t          t          j        |› ¦  «        }n&# t          $ r}t	          d	|› d
�¦  «        |‚d}~ww xY w|dv r4 ||d         |d         |d         f|d         ¬¦  «        cddd¦  «         S |dk    r- ||d         |d         f|d         ¬¦  «        cddd¦  «         S |dk    rfd|v r- ||d         |d         f|d         ¬¦  «        cddd¦  «         S  ||d         |d         |d         ff|d         ¬¦  «        cddd¦  «         S t          d|› d�¦  «        ‚# 1 swxY w Y   dS )aä   Load a sparse array/matrix from a file using ``.npz`` format.

    Parameters
    ----------
    file : str or file-like object
        Either the file name (string) or an open file (file-like object)
        where the data will be loaded.

    Returns
    -------
    result : csc_array, csr_array, bsr_array, dia_array or coo_array
        A sparse array/matrix containing the loaded data.

    Raises
    ------
    OSError
        If the input file does not exist or cannot be read.

    See Also
    --------
    scipy.sparse.save_npz: Save a sparse array/matrix to a file using ``.npz`` format.
    numpy.load: Load several arrays from a ``.npz`` archive.

    Examples
    --------
    Store sparse array/matrix to disk, and load it again:

    >>> import numpy as np
    >>> import scipy as sp
    >>> sparse_array = sp.sparse.csc_array([[0, 0, 3], [4, 0, 0]])
    >>> sparse_array
    <Compressed Sparse Column sparse array of dtype 'int64'
        with 2 stored elements and shape (2, 3)>
    >>> sparse_array.toarray()
    array([[0, 0, 3],
           [4, 0, 0]], dtype=int64)

    >>> sp.sparse.save_npz('/tmp/sparse_array.npz', sparse_array)
    >>> sparse_array = sp.sparse.load_npz('/tmp/sparse_array.npz')

    >>> sparse_array
    <Compressed Sparse Column sparse array of dtype 'int64'
        with 2 stored elements and shape (2, 3)>
    >>> sparse_array.toarray()
    array([[0, 0, 3],
           [4, 0, 0]], dtype=int64)

    In this example we force the result to be csr_array from csr_matrix
    >>> sparse_matrix = sp.sparse.csc_matrix([[0, 0, 3], [4, 0, 0]])
    >>> sp.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix)
    >>> tmp = sp.sparse.load_npz('/tmp/sparse_matrix.npz')
    >>> sparse_array = sp.sparse.csr_array(tmp)
    r   Nz	The file z+ does not contain a sparse array or matrix.r   r   Ú_arrayÚ_matrixzUnknown format "ú"r   r   r   r   r   )r   r   r   r   r   r   r   z4Load is not implemented for sparse matrix of format r   )r"   ÚloadÚPICKLE_KWARGSÚgetÚ
ValueErrorÚitemr   ÚstrÚdecodeÚgetattrr   r    ÚAttributeErrorr   )r%   ÚloadedÚsparse_formatÚsparse_typeÚclsÚes         r*   r   r   T   s3  € õl 
Œ�Ð	'Ð	'�Ð	'Ð	'ð "S¨6ØŸ
š
 8Ñ,Ô,ˆØÐ Ýð :¨ð :ð :ð :ñ ;ô ;ð ;à%×*Ò*Ñ,Ô,ˆå˜-­Ñ-Ô-ð 	:ð *×0Ò0°Ñ9Ô9ˆMà�:Š:�kÑ"Ô"ð 	4Ø'¨(Ñ2ˆKˆKà'¨)Ñ3ˆKð	GÝ�"œ)¨Ð%5Ñ6Ô6ˆCˆCøÝð 	Gð 	Gð 	GÝÐ>°Ð>Ð>Ð>Ñ?Ô?ÀQÐFøøøøð	Gøøøð Ð1Ð1Ð1Ø�3˜˜vœ¨¨yÔ(9¸6À(Ô;KÐLØ# Gœ_ð.ñ .ô .ð/"Sð "Sð "Sð "Sñ "Sô "Sð "Sð "Sð2 ˜eÒ#Ð#Ø�3˜˜vœ¨¨yÔ(9Ð:À&ÈÄ/ÐRÑRÔRð5"Sð "Sð "Sð "Sñ "Sô "Sð "Sð "Sð6 ˜eÒ#Ð#Ø˜6Ð!Ð!Ø�s˜F 6œN¨F°8Ô,<Ð=ÀVÈGÄ_ÐUÑUÔUð;"Sð "Sð "Sð "Sñ "Sô "Sð "Sð "Sð< �3˜˜vœ¨°¬¸¸u¼Ð(FÐGØ# Gœ_ð.ñ .ô .ð="Sð "Sð "Sð "Sñ "Sô "Sð "Sð "SõB &ð 'RØANð'Rð 'Rð 'Rñ Sô Sð SðC"Sð "Sð "Sð "Søøøð "Sð "Sð "Sð "Sð "Sð "SsN   ˜B	GÂ"B>Â=GÂ>
C!ÃCÃC!Ã!.GÄ&GÅ*GÆ(GÆ;GÇGÇG)T)	Únumpyr"   Úscipyr   Ú__all__Údictr1   r   r   © r+   r*   ú<module>rC      sw   ðØ Ð Ð Ð Ø Ð Ð Ð à�zÐ
"€ð � %Ð(Ñ(Ô(€ðF&ð F&ð F&ð F&ðRXSð XSð XSð XSð XSr+   