403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/io/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/io/__pycache__/_mmio.cpython-311.pyc
�

d�c�����dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZddl
mZmZgd�Zd�Zd�Zd�Zdd
�ZGd�d��Zd
�ZdS)z�
  Matrix Market I/O in Python.
  See http://math.nist.gov/MatrixMarket/formats.html
  for information about the Matrix Market format.
�N)	�asarray�real�imag�conj�zeros�ndarray�concatenate�ones�can_cast)�
coo_matrix�
isspmatrix)�mminfo�mmread�mmwrite�MMFilec�t�t|t��r|�d��St|��S)N�latin1)�
isinstance�bytes�decode�str)�ss �0/usr/lib/python3/dist-packages/scipy/io/_mmio.py�asstrrs1���!�U���"��x�x��!�!�!��q�6�6�M�c�6�t�|��S)a�
    Return size and storage parameters from Matrix Market file-like 'source'.

    Parameters
    ----------
    source : str or file-like
        Matrix Market filename (extension .mtx) or open file-like object

    Returns
    -------
    rows : int
        Number of matrix rows.
    cols : int
        Number of matrix columns.
    entries : int
        Number of non-zero entries of a sparse matrix
        or rows*cols for a dense matrix.
    format : str
        Either 'coordinate' or 'array'.
    field : str
        Either 'real', 'complex', 'pattern', or 'integer'.
    symmetry : str
        Either 'general', 'symmetric', 'skew-symmetric', or 'hermitian'.

    Examples
    --------
    >>> from io import StringIO
    >>> from scipy.io import mminfo

    >>> text = '''%%MatrixMarket matrix coordinate real general
    ...  5 5 7
    ...  2 3 1.0
    ...  3 4 2.0
    ...  3 5 3.0
    ...  4 1 4.0
    ...  4 2 5.0
    ...  4 3 6.0
    ...  4 4 7.0
    ... '''


    ``mminfo(source)`` returns the number of rows, number of columns,
    format, field type and symmetry attribute of the source file.

    >>> mminfo(StringIO(text))
    (5, 5, 7, 'coordinate', 'real', 'general')
    )r�info��sources rrrs��`�;�;�v���rc�D�t���|��S)aG
    Reads the contents of a Matrix Market file-like 'source' into a matrix.

    Parameters
    ----------
    source : str or file-like
        Matrix Market filename (extensions .mtx, .mtz.gz)
        or open file-like object.

    Returns
    -------
    a : ndarray or coo_matrix
        Dense or sparse matrix depending on the matrix format in the
        Matrix Market file.

    Examples
    --------
    >>> from io import StringIO
    >>> from scipy.io import mmread

    >>> text = '''%%MatrixMarket matrix coordinate real general
    ...  5 5 7
    ...  2 3 1.0
    ...  3 4 2.0
    ...  3 5 3.0
    ...  4 1 4.0
    ...  4 2 5.0
    ...  4 3 6.0
    ...  4 4 7.0
    ... '''

    ``mmread(source)`` returns the data as sparse matrix in COO format.

    >>> m = mmread(StringIO(text))
    >>> m
    <5x5 sparse matrix of type '<class 'numpy.float64'>'
    with 7 stored elements in COOrdinate format>
    >>> m.A
    array([[0., 0., 0., 0., 0.],
           [0., 0., 1., 0., 0.],
           [0., 0., 0., 2., 3.],
           [4., 5., 6., 7., 0.],
           [0., 0., 0., 0., 0.]])
    )r�readrs rrrTs��Z�8�8�=�=�� � � r�c�R�t���||||||��dS)a�
    Writes the sparse or dense array `a` to Matrix Market file-like `target`.

    Parameters
    ----------
    target : str or file-like
        Matrix Market filename (extension .mtx) or open file-like object.
    a : array like
        Sparse or dense 2-D array.
    comment : str, optional
        Comments to be prepended to the Matrix Market file.
    field : None or str, optional
        Either 'real', 'complex', 'pattern', or 'integer'.
    precision : None or int, optional
        Number of digits to display for real or complex values.
    symmetry : None or str, optional
        Either 'general', 'symmetric', 'skew-symmetric', or 'hermitian'.
        If symmetry is None the symmetry type of 'a' is determined by its
        values.

    Returns
    -------
    None

    Examples
    --------
    >>> from io import BytesIO
    >>> import numpy as np
    >>> from scipy.sparse import coo_matrix
    >>> from scipy.io import mmwrite

    Write a small NumPy array to a matrix market file.  The file will be
    written in the ``'array'`` format.

    >>> a = np.array([[1.0, 0, 0, 0], [0, 2.5, 0, 6.25]])
    >>> target = BytesIO()
    >>> mmwrite(target, a)
    >>> print(target.getvalue().decode('latin1'))
    %%MatrixMarket matrix array real general
    %
    2 4
    1.0000000000000000e+00
    0.0000000000000000e+00
    0.0000000000000000e+00
    2.5000000000000000e+00
    0.0000000000000000e+00
    0.0000000000000000e+00
    0.0000000000000000e+00
    6.2500000000000000e+00

    Add a comment to the output file, and set the precision to 3.

    >>> target = BytesIO()
    >>> mmwrite(target, a, comment='\n Some test data.\n', precision=3)
    >>> print(target.getvalue().decode('latin1'))
    %%MatrixMarket matrix array real general
    %
    % Some test data.
    %
    2 4
    1.000e+00
    0.000e+00
    0.000e+00
    2.500e+00
    0.000e+00
    0.000e+00
    0.000e+00
    6.250e+00

    Convert to a sparse matrix before calling ``mmwrite``.  This will
    result in the output format being ``'coordinate'`` rather than
    ``'array'``.

    >>> target = BytesIO()
    >>> mmwrite(target, coo_matrix(a), precision=3)
    >>> print(target.getvalue().decode('latin1'))
    %%MatrixMarket matrix coordinate real general
    %
    2 4 3
    1 1 1.00e+00
    2 2 2.50e+00
    2 4 6.25e+00

    Write a complex Hermitian array to a matrix market file.  Note that
    only six values are actually written to the file; the other values
    are implied by the symmetry.

    >>> z = np.array([[3, 1+2j, 4-3j], [1-2j, 1, -5j], [4+3j, 5j, 2.5]])
    >>> z
    array([[ 3. +0.j,  1. +2.j,  4. -3.j],
           [ 1. -2.j,  1. +0.j, -0. -5.j],
           [ 4. +3.j,  0. +5.j,  2.5+0.j]])

    >>> target = BytesIO()
    >>> mmwrite(target, z, precision=2)
    >>> print(target.getvalue().decode('latin1'))
    %%MatrixMarket matrix array complex hermitian
    %
    3 3
    3.00e+00 0.00e+00
    1.00e+00 -2.00e+00
    4.00e+00 3.00e+00
    1.00e+00 0.00e+00
    0.00e+00 5.00e+00
    2.50e+00 0.00e+00

    N)r�write)�target�a�comment�field�	precision�symmetrys      rrr�s+��X�H�H�N�N�6�1�g�u�i��B�B�B�B�Brc
��eZdZdZed���Zed���Zed���Zed���Zed���Z	ed���Z
ed���Zd	Zd
Z
ee
fZed���ZdZd
ZdZdZdZeeeeefZed���ZdZdZdZdZeeeefZed���ZededededediZed���Z ed���Z!ed���Z"ed+d���Z#ed ���Z$ed!���Z%d"�Z&d#�Z'		d,d&�Z(d'�Z)d(�Z*d)�Z+		d,d*�Z,d%S)-r)�_rows�_cols�_entries�_format�_field�	_symmetryc��|jS�N)r,��selfs r�rowszMMFile.rows��
���z�rc��|jSr3)r-r4s r�colszMMFile.colsr7rc��|jSr3)r.r4s r�entrieszMMFile.entriess
���}�rc��|jSr3)r/r4s r�formatz
MMFile.format
s
���|�rc��|jSr3)r0r4s rr(zMMFile.fields
���{�rc��|jSr3)r1r4s rr*zMMFile.symmetrys
���~�rc�8�|j|j|j|jfvSr3)r1�SYMMETRY_SYMMETRIC�SYMMETRY_SKEW_SYMMETRIC�SYMMETRY_HERMITIANr4s r�has_symmetryzMMFile.has_symmetrys'���~�$�"9�"&�">�"&�"9�";�;�	;r�
coordinate�arrayc�L�||jvrtd|�d|j�����dS)Nzunknown format type �, must be one of )�
FORMAT_VALUES�
ValueError)r5r=s  r�_validate_formatzMMFile._validate_format!s@����+�+�+��*�$�f�f�d�&8�&8�:�;�;�
;�,�+r�integer�unsigned-integerr�complex�patternc�L�||jvrtd|�d|j�����dS)Nzunknown field type rH)�FIELD_VALUESrJ)r5r(s  r�_validate_fieldzMMFile._validate_field0s@����)�)�)��*�#�e�e�T�%6�%6�8�9�9�
9�*�)r�general�	symmetriczskew-symmetric�	hermitianc�L�||jvrtd|�d|j�����dS)Nzunknown symmetry type rH)�SYMMETRY_VALUESrJ)r5r*s  r�_validate_symmetryzMMFile._validate_symmetry>s@���4�/�/�/��*�&�h�h��(<�(<�>�?�?�
?�0�/r�intp�uint64�d�Dc��dSr3�r^rr�readerz
MMFile.readerK����rc��dSr3r^r^rr�writerz
MMFile.writerPr`rc���|�|��\}}	|���}d�|���D��\}}}}}	|�d��st	d���|���dkst	d|z���|���dkr|j}n|���dkr|j}|r*|dd	vr |���}|r
|dd	v� |���s(|���}|����(|���}
||jkrVt|
��d
ks%t	d|�
d��z���tt|
��\}}||z}
nQt|
��d
ks%t	d|�
d��z���tt|
��\}}}
|||
||���|	���f|r|�
��SS#|r|�
��wwxYw)a�
        Return size, storage parameters from Matrix Market file-like 'source'.

        Parameters
        ----------
        source : str or file-like
            Matrix Market filename (extension .mtx) or open file-like object

        Returns
        -------
        rows : int
            Number of matrix rows.
        cols : int
            Number of matrix columns.
        entries : int
            Number of non-zero entries of a sparse matrix
            or rows*cols for a dense matrix.
        format : str
            Either 'coordinate' or 'array'.
        field : str
            Either 'real', 'complex', 'pattern', or 'integer'.
        symmetry : str
            Either 'general', 'symmetric', 'skew-symmetric', or 'hermitian'.
        c�P�g|]#}t|�������$Sr^)r�strip)�.0�parts  r�
<listcomp>zMMFile.info.<locals>.<listcomp>ws(��>�>�>���t�z�z�|�|�$�$�>�>�>rz%%MatrixMarketz%source is not in Matrix Market format�matrixzProblem reading file header: rFrEr��%�%�zHeader line not of length 2: �ascii�zHeader line not of length 3: )�_open�readline�split�
startswithrJ�lower�FORMAT_ARRAY�FORMAT_COORDINATEre�lenr�map�int�close)r5r�stream�close_it�line�mmidrir=r(r*�
split_liner6r9r;s              rrzMMFile.infoUsw��6 �:�:�f�-�-����,	��?�?�$�$�D�>�>������>�>�>�
2�D�&�&�%���?�?�#3�4�4�
J� �!H�I�I�I��<�<�>�>�X�-�-� �!@�4�!G�H�H�H��|�|�~�~��(�(��*��������<�/�/��/���
)�4��7�i�/�/����(�(���
)�4��7�i�/�/��j�j�l�l�
)����(�(���j�j�l�l�
)������J���*�*�*��:���!�+�+�$�%D�%)�[�[��%9�%9�&:�;�;�;� ��j�1�1�
��d���+����:���!�+�+�$�%D�%)�[�[��%9�%9�&:�;�;�;�&)�#�z�&:�&:�#��d�G��$���������N�N�$�$�&��
��������
��x�
��������
���s�HI�I)�rbc���	tj|��}n#t$r|dfcYSwxYw|ddk�rtj�|��swtj�|dz��r|dz}nOtj�|dz��r|dz}n'tj�|dz��r|dz}|�d��rddl}|�||��}nd|�d	��rddl}|�	|d
��}n4t||��}n#|dd�dkr|dz}t||��}|dfS)
a� Return an open file stream for reading based on source.

        If source is a file name, open it (after trying to find it with mtx and
        gzipped mtx extensions). Otherwise, just return source.

        Parameters
        ----------
        filespec : str or file-like
            String giving file name or file-like object
        mode : str, optional
            Mode with which to open file, if `filespec` is a file name.

        Returns
        -------
        fobj : file-like
            Open file-like object.
        close_it : bool
            True if the calling function should close this file when done,
            false otherwise.
        Fr�rz.mtxz.mtx.gzz.mtx.bz2z.gzNz.bz2r����T)
�os�fspath�	TypeError�path�isfile�endswith�gzip�open�bz2�BZ2File)�filespec�moder�r{r�s     rrpzMMFile._open�s���4	#��y��*�*�H�H���	#�	#�	#��U�?�"�"�"�	#������7�c�>�>��7�>�>�(�+�+�
5��7�>�>�(�6�/�2�2�5�'�&�0�H�H��W�^�^�H�Y�$6�7�7�5�'�)�3�H�H��W�^�^�H�Z�$7�8�8�5�'�*�4�H�� � ��'�'�
.��������8�T�2�2����"�"�6�*�*�
.��
�
�
����X�t�4�4����h��-�-�������}��&�&�#�f�,���(�D�)�)�F��t�|�s��(�(c�����j\}�|�krtjSd}d}�jjdv}t���r����������\}}||k���||k���krtjS��	����fd�}n��fd�}|��D]t\}}	}
|r|
r	|dkrd}nY|r||	krd}tjd���5|r	||	krd}ddd��n#1swxYwY|r|t|	��krd}|s|s|sn�u|rtj
S|rtjS|rtjStjS)	NT�FDc3��K�����D]-\\}}}||kr�||f}||dfV�� ||kr||dfV��.dS)NFT)�items)�i�j�aij�ajir&s    �r�
symm_iteratorz+MMFile._get_symmetry.<locals>.symm_iterator�sy�����%&�W�W�Y�Y�/�/�M�V�a��S��1�u�u���1��g��"�C��/�/�/�/�/��a���"�C��.�.�.�.��/�/rc3��K�t���D]<}t|���D])}�||�||}}||||kfV��*�=dSr3)�range)r�r�r�r�r&�ns    ��rr�z+MMFile._get_symmetry.<locals>.symm_iteratorsu������q���1�1�A�"�1�a�[�[�1�1��#$�Q�4��7�A�a�D��G�S��"�C��a��0�0�0�0�0�1�1�1rrF�ignore)�over)�shaper�SYMMETRY_GENERAL�dtype�charr
�tocoo�nonzero�sum�todok�np�errstaterrArBrC)r&�m�issymm�isskew�isherm�row�colr�r�r��is_diagonalr�s`          @r�
_get_symmetryzMMFile._get_symmetry�s-�����w���1���6�6��*�*���������%���a�=�=�	1����	�	�A������J�S�#��c�	��� � �S�3�Y�O�O�$5�$5�5�5��.�.����	�	�A�
/�
/�
/�
/�
/�
/�
1�
1�
1�
1�
1�
1�(5�}���
	�
	�#�S�#�{��

#�+�

#�#��(�(�����#�c�S�j�j�"�F��[�h�/�/�/�'�'��'�#�#��+�+�!&��'�'�'�'�'�'�'�'�'�'�'����'�'�'�'��#�c�T�#�Y�Y�.�.�"�F��
�f�
��
�����	-��,�,��	2��1�1��	-��,�,��&�&s�D�D!	�$D!	c
��tjd|ztjdtjdtjd||fzi�|d��S)Nz%%.%ie
z%i
z%u
z%%.%ie %%.%ie
)r�
FIELD_REAL�
FIELD_INTEGER�FIELD_UNSIGNED�
FIELD_COMPLEX�get)r(r)s  r�_field_templatezMMFile._field_template!sP���!�:�	�#9��$�f��%�v��$�&7��	�*�'+��
�#�e�T�"�"�	#rc� �|jdi|��dS)Nr^)�_init_attrs)r5�kwargss  r�__init__zMMFile.__init__+s!�����"�"�6�"�"�"�"�"rc���|�|��\}}	|�|��|�|��|r|���SS#|r|���wwxYw)a�
        Reads the contents of a Matrix Market file-like 'source' into a matrix.

        Parameters
        ----------
        source : str or file-like
            Matrix Market filename (extensions .mtx, .mtz.gz)
            or open file object.

        Returns
        -------
        a : ndarray or coo_matrix
            Dense or sparse matrix depending on the matrix format in the
            Matrix Market file.
        )rp�
_parse_header�_parse_bodyrz)r5rr{r|s    rr!zMMFile.read/s���  �:�:�f�-�-����	����v�&�&�&��#�#�F�+�+��
��������
��x�
��������
���s�)A�A4r"Nc�&�|�|d��\}}	|�||||||��|r|���dS|���dS#|r|���w|���wxYw)a7
        Writes sparse or dense array `a` to Matrix Market file-like `target`.

        Parameters
        ----------
        target : str or file-like
            Matrix Market filename (extension .mtx) or open file-like object.
        a : array like
            Sparse or dense 2-D array.
        comment : str, optional
            Comments to be prepended to the Matrix Market file.
        field : None or str, optional
            Either 'real', 'complex', 'pattern', or 'integer'.
        precision : None or int, optional
            Number of digits to display for real or complex values.
        symmetry : None or str, optional
            Either 'general', 'symmetric', 'skew-symmetric', or 'hermitian'.
            If symmetry is None the symmetry type of 'a' is determined by its
            values.
        �wbN)rp�_writerz�flush)	r5r%r&r'r(r)r*r{r|s	         rr$zMMFile.writeJs���. �:�:�f�d�3�3����	��K�K���7�E�9�h�G�G�G��
�������������������
�����������������s�A#�#-Bc
�D�|jj}d�|D��}t|�����t|��z
}|r"t	dt|���d|�����|D]/}t
|||�|dd�d�����0dS)zr
        Initialize each attributes with the corresponding keyword arg value
        or a default of None
        c�"�g|]}|dd���
S)�Nr^)rf�attrs  rrhz&MMFile._init_attrs.<locals>.<listcomp>ts ��3�3�3�T��Q�R�R��3�3�3rzfound zL invalid keyword arguments, please only
                                use r�N)�	__class__�	__slots__�set�keysrJ�tuple�setattrr�)r5r��attrs�public_attrs�invalid_keysr�s      rr�zMMFile._init_attrsms�����(��3�3�U�3�3�3���6�;�;�=�=�)�)�C��,=�,=�=���	<��*�-2�<�-@�-@�-@�-@�-9�\�;�<�<�
<��	<�	<�D��D�$��
�
�4����8�T� :� :�;�;�;�;�	<�	<rc�~�|j�|��\}}}}}}|�||||||���dS)N)r6r9r;r=r(r*)r�rr�)r5r{r6r9r;r=r(r*s        rr�zMMFile._parse_header�sZ���N����'�'�	5��d�G�V�U�H����d��w�v�$�x�	�	9�	9�	9�	9�	9rc	���|j|j|j|j|j|jf\}}}}}}	ddlm}n#t$rd}YnwxYw|j	�
|d��}	|j}
||jk}||j
k}||jk}
||jk}||jk}||jk}||jk�ryt'||f|	���}d}d\}}|rd|||f<||dz
kr|dz
}|�r|���}|r|ddvs|���s�8|rt-|��}nR|rt-|��}n@|
r/t/t1t2|������}nt3|��}||||f<|
r/||kr)|r	||||f<n|rt7|��|||f<n||||f<||dz
kr|dz}n#|dz}|
sd}n|}|rd|||f<||dz
kr|dz
}|��|r |d|fvr	||dz
kst9d����n�|d|fvr||kst9d����n�||jk�rS|��Pt'||f|	���}d}d}|�r|���}|r|ddvs|���s�8|���}t1t,|dd���\}}|dz
|dz
}}|rt-|d��}nT|rt-|d��}n<|
r%t/t1t2|dd����}nt3|d��}||||f<|
r/||kr)|r	||||f<n|rt7|��|||f<n||||f<|dz}|��||kst9d	���nQ||jk�r6|dkr|||f|	���St'|d
���}t'|d
���}|rt=|d���}nM|rt'|d���}n9|rt'|d
���}n%|
rt'|d���}nt'|d���}d}|D]�}|r|ddvs|���s�#|dz|krt9d���|���}t1t,|dd���\||<||<|sx|rt-|d��||<n]|rt-|d��||<nB|
r(t/t1t2|dd����||<nt3|d��||<|dz
}��||krt9d���|dz}|dz}|
ro||k}||}||}||}t?||f��}t?||f��}|r|dz}n|r|� ��}t?||f��}||||ff||f|	���}ntC|���|S)Nr)r)r�r�)rrrjz$Parse error, did not read all lines.rmzDid not read all entries�intc�int8rYrZrN�floatz5'entries' in header is smaller than number of entriesz4'entries' in header is larger than number of entries���)r�r�)"r6r9r;r=r(r*�scipy.sparser�ImportError�DTYPES_BY_FIELDr�rDr�r�r�rBrC�
FIELD_PATTERNrurrqreryrNrxr�rrrrJrvr
r	�	conjugate�NotImplementedError) r5r{r6r9r;r=r(�symmrr�rD�
is_integer�is_unsigned_integer�
is_complex�is_skew�is_herm�
is_patternr&r}r�r�r��k�l�I�J�V�entry_number�mask�od_I�od_J�od_Vs                                 rr�zMMFile._parse_body�s���48�I�t�y�48�L�$�+�48�J��
�4O�0��d�G�V�U�D�	�/�/�/�/�/�/�/���	�	�	��J�J�J�	�����$�(�(���5�5���(���d�0�0�
�#�t�':�:���d�0�0�
��$�6�6���$�1�1���d�0�0�
��T�&�&�&��t�T�l�%�0�0�0�A��D��D�A�q��
���!�Q�$���t�a�x�<�<���F�A�� 
'����(�(����t�A�w�)�3�3�4�:�:�<�<�3���&��d�)�)�C�C�(�&��d�)�)�C�C��&�!�3�u�d�j�j�l�l�#;�#;�<�C�C���+�+�C���!�Q�$���&�A��F�F��&�#&�$��!�Q�$��� �&�"&�s�)�)��!�Q�$���"%��!�Q�$���t�A�v�:�:��A��A�A��A��A�'�'������"�'�&'�A�a��d�G� �4��6�z�z� !�Q���A� 
'�D�
M��a��V����T�A�X�
�
�$�%K�L�L�L�)6��a��V����T�	�	�$�%K�L�L�L�)2��t�-�
-�
-�*�2D��t�T�l�%�0�0�0�A��D��A��
����(�(����t�A�w�)�3�3�4�:�:�<�<�3���J�J�L�L���3��"�1�"������1���s�A�a�C�1���&��a��d�)�)�C�C�(�&��a��d�)�)�C�C��&�!�3�u�a����e�#4�#4�5�C�C���!��+�+�C���!�Q�$���&�A��F�F��&�#&�$��!�Q�$��� �&�"&�s�)�)��!�Q�$���"%��!�Q�$����E��1�
�2��<�<��5�6�6�6��
�t�-�
-�
-��!�|�|�!�z�4��,�e�<�<�<�<��g�V�,�,�,�A��g�V�,�,�,�A��	
2����/�/�/����
2��'��0�0�0���$�
2��'��2�2�2����
2��'��3�3�3����'��1�1�1���L��
"�
"����t�A�w�)�3�3�4�:�:�<�<�3����>�G�+�+�$�&9�:�:�:��J�J�L�L��36�s�A�b�q�b�E�?�?�0��,���<��!�6�!�6�*-�a��d�)�)��,���,�6�*-�a��d�)�)��,���#�6�*1�3�u�a����e�3D�3D�*E��,���*/��!��+�+��,����!����g�%�%� �"5�6�6�6�
��F�A�
��F�A��
+��Q�����w����w����w����D�	�*�*����D�	�*�*���,��B�J�D�D��,��>�>�+�+�D���D�	�*�*���
�A��1�v�;�t�T�l�%�H�H�H�A�A�%�f�-�-�-��s�6�A�Ac�z�t|t��s:t|t��s%t|t��st	|d��r�|j}t
|��}t|j��dkrtd���|j\}}	|��||j
kr:t|jd��std���|�d��}n�||jkr$|jjdvr|�d��}ni||jkr#|jjdvr|�d	��}n:t%|��std
t'|��z���d}|j\}}	|jj}
|�	|
dvrd
}nd}|�f|jj}|dkr't|jd��std���d}n-|dkrd}n$|dkrd}n|dkrd}nt+d|z���|�|�|��}|j�|��|j�|��|j�|��d|�d|�d|�d�}|�|�d����|�d��D]/}
d|
z}|�|�d�����0|�||��}||jk�r�d||	fz}|�|�d����||j
|j|jfv�r,||j kr[tC|	��D]I}tC|��D]7}||||fz}|�|�d�����8�JdS||j"kr_tC|	��D]M}tC|dz|��D]7}||||fz}|�|�d�����8�NdStC|	��D]J}tC||��D]7}||||fz}|�|�d�����8�KdS||jkr�||j krytC|	��D]g}tC|��D]U}|||f}|tG|��tI|��fz}|�|�d�����V�hdStC|	��D]h}tC||��D]U}|||f}|tG|��tI|��fz}|�|�d�����V�idS||j%krtd���t+d |z���|�&��}||j krK|j'|j(k}tS|j*||j'||j(|ff|j�!��}d"||	|j+fz}|�|�d����|�||dz
��}||j%krWtY|j'dz|j(dz��D]4\}}d||fz}|�|�d�����5dS||j
|j|jfvrdtY|j'dz|j(dz|j*��D];\}}}d#||fz||zz}|�|�d�����<dS||jkrptY|j'dz|j(dz|j*��D]G\}}}d#||fz||j#|j$fzz}|�|�d�����HdSt+d |z���)$N�	__array__rmzExpected 2 dimensional arrayrYzBmmwrite does not support integer dtypes larger than native 'intp'.�fdr[r�r\zunknown matrix type: %srE�fF��r�rL�fr�crN�urMzunexpected dtype kind z%%MatrixMarket matrix � �
rz%%%s
z%i %i
r�z*pattern type inconsisted with dense formatzUnknown field type %s)r�z	%i %i %i
z%i %i )-r�listrr��hasattrrurrwr�rJr�rr��
OverflowError�astyper�r�r�r
�type�kindr�r�r�rKrRrXr$�encoderrr�r�r�r�rBrrr�r�r�r�r�data�nnz�zip)r5r{r&r'r(r)r*�repr6r9�typecoder�r�r}�templater�r�r��coo�lower_triangle_maskr�r�r[s                       rr�z
MMFile._write5s����a����	!�*�Q��"8�"8�	!��a����	!�#*�1�k�#:�#:�	!��#�C���
�
�A��1�7�|�|�q� � � �!?�@�@�@���J�D�$�� ��D�.�.�.�#�A�G�V�4�4�Q�+�-P�Q�Q�Q�����(�(�A�A��d�o�-�-��w�|�4�/�/��H�H�S�M�M����d�0�0�0��w�|�4�/�/��H�H�S�M�M����a�=�=�
F� �!:�T�!�W�W�!D�E�E�E��C���J�D�$��7�<�����4����	�	��	��=��7�<�D��s�{�{�����0�0�M�'�)L�M�M�M�!��������������!�������*���� 8�4� ?�@�@�@����)�)�!�,�,�H�	
��'�'��,�,�,���&�&�u�-�-�-���)�)�(�3�3�3�C��B�B�e�B�B�h�B�B�B�����T�[�[��*�*�+�+�+��M�M�$�'�'�	0�	0�D��t�$�D��L�L����X�.�.�/�/�/�/��'�'��y�9�9���$�#�#�#���d�|�+�D��L�L����X�.�.�/�/�/���+�T�_��,�.�.�.��t�4�4�4�"�4�[�[�@�@��!&�t���@�@�A�#+�a��1��g�#5�D�"�L�L����X�)>�)>�?�?�?�?�@�@�@�
��!=�=�=�"�4�[�[�@�@��!&�q�1�u�d�!3�!3�@�@�A�#+�a��1��g�#5�D�"�L�L����X�)>�)>�?�?�?�?�@�@�@�#�4�[�[�@�@��!&�q�$���@�@�A�#+�a��1��g�#5�D�"�L�L����X�)>�)>�?�?�?�?�@�@�@�
�$�,�,�,��t�4�4�4�"�4�[�[�@�@��!&�t���@�@�A�"#�A�q�D�'�C�#+�t�C�y�y�$�s�)�)�.D�#D�D�"�L�L����X�)>�)>�?�?�?�?�@�@�@�#�4�[�[�@�@��!&�q�$���@�@�A�"#�A�q�D�'�C�#+�t�C�y�y�$�s�)�)�.D�#D�D�"�L�L����X�)>�)>�?�?�?�?�@�@�@��$�,�,�,� �!M�N�N�N� � 7�%� ?�@�@�@��'�'�)�)�C��4�0�0�0�&)�g���&8�#� �#�(�+>�"?�"%�'�*=�">�"%�'�*=�">�"@�"A�(+�y�2�2�2�� �4��s�w�"7�7�D��L�L����X�.�.�/�/�/��+�+�E�9�Q�;�?�?�H���*�*�*�����	�3�7�1�9�5�5�8�8�D�A�q�$��1�v�-�D��L�L����X�!6�!6�7�7�7�7�8�8��4�-�t���.�0�0�0�"�3�7�1�9�c�g�a�i���B�B�8�8�G�A�q�!�$��1�v�-�(�Q�,�?�D��L�L����X�!6�!6�7�7�7�7�8�8��$�,�,�,�"�3�7�1�9�c�g�a�i���B�B�8�8�G�A�q�!�$��1�v�-�(�a�f�a�f�=M�2M�N�D��L�L����X�!6�!6�7�7�7�7�8�8� � 7�%� ?�@�@�@r)r��r"NNN)-�__name__�
__module__�__qualname__r��propertyr6r9r;r=r(r*rDrvrurI�classmethodrKr�r�r�r�r�rQrRr�rArBrCrWrXr��staticmethodr_rbrrpr�r�r�r!r$r�r�r�r�r^rrrr�s�������I�����X������X������X������X������X������X���;�;��X�;�%���L�&��5�M��;�;��[�;��M�'�N��J��M��M�!�>�:�}�!�#�L��9�9��[�9�!��$��.��$��'�);�.�0B�D�O��?�?��[�?�
%�f�%�x�!�3�$�c�$�c�	+�O��
�
��\�
��
�
��\�
��H�H��[�H�V�;�;�;��\�;�|�='�='��\�='�@�#�#��\�#�#�#�#����6BF�� � � � �F<�<�<�&9�9�9�k�k�k�\CG��WA�WA�WA�WA�WA�WArrc��g}	ddl}|�|j��n#t$rYnwxYw	ddl}|�|j��n#t$rYnwxYwt
|��}t||��S)z�
    Check whether `stream` is compatible with numpy.fromfile.

    Passing a gzipped file object to ``fromfile/fromstring`` doesn't work with
    Python 3.
    rN)r��append�GzipFiler�r�r�r�r)r{�bad_clsr�r�s    r�_is_fromfile_compatibler�s����G�
��������t�}�%�%�%�%���
�
�
���
����
��
�
�
����s�{�#�#�#�#���
�
�
���
�����G�n�n�G��&�'�*�*�*�*s�#�
0�0�A�
A �A r)�__doc__r��numpyr�rrrrrrr	r
rr�rr
�__all__rrrrrrr^rr�<module>rsW����
�	�	�	�����#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�0�/�/�/�/�/�/�/�
3�
3�
3�����0�0�0�j-!�-!�-!�dlC�lC�lC�lC�`VA�VA�VA�VA�VA�VA�VA�VA�r+�+�+�+�+r

Youez - 2016 - github.com/yon3zu
LinuXploit