o
    Ö­jK  ã                   @   s   G d d„ dƒZ dS )c                       sê   e Zd ZdZdZedd„ ƒZedd„ ƒZedd„ ƒZed	d
„ ƒZ	edd„ ƒZ
edd„ ƒZedd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zeeedd�Zdd„ Zdd „ Zd!d"„ Zd.d$d%„Zd&d'„ Zd(d)„ Zd*d+„ Zd/‡ fd,d-„	Z‡  ZS )0Úspmatrixz‘This class provides a base class for all sparse matrix classes.

    It cannot be instantiated.  Most of the work is provided by subclasses.
    )é   c                 C   ó   ddl m} |S )Né   )Ú
bsr_matrix)Ú_bsrr   )Úselfr   © r   úQ/var/www/html/CropPilot/venv/lib/python3.10/site-packages/scipy/sparse/_matrix.pyÚ_bsr_container   ó   zspmatrix._bsr_containerc                 C   r   )Nr   )Ú
coo_matrix)Ú_coor   )r   r   r   r   r	   Ú_coo_container   r   zspmatrix._coo_containerc                 C   r   )Nr   )Ú
csc_matrix)Ú_cscr   )r   r   r   r   r	   Ú_csc_container   r   zspmatrix._csc_containerc                 C   r   )Nr   )Ú
csr_matrix)Ú_csrr   )r   r   r   r   r	   Ú_csr_container   r   zspmatrix._csr_containerc                 C   r   )Nr   )Ú
dia_matrix)Ú_diar   )r   r   r   r   r	   Ú_dia_container   r   zspmatrix._dia_containerc                 C   r   )Nr   )Ú
dok_matrix)Ú_dokr   )r   r   r   r   r	   Ú_dok_container!   r   zspmatrix._dok_containerc                 C   r   )Nr   )Ú
lil_matrix)Ú_lilr   )r   r   r   r   r	   Ú_lil_container&   r   zspmatrix._lil_containerc                 C   ó
   |   |¡S ©N)Ú_matmul_dispatch©r   Úotherr   r   r	   Ú__mul__,   ó   
zspmatrix.__mul__c                 C   r   r   )Ú_rmatmul_dispatchr!   r   r   r	   Ú__rmul__/   r$   zspmatrix.__rmul__c                 C   s   ddl m} || |ƒS )Nr   )Úmatrix_power)Úlinalgr'   )r   Úpowerr'   r   r   r	   Ú__pow__3   s   
zspmatrix.__pow__c                 C   s"   | j |dd� | j¡}|j| _dS )z$Set the shape of the matrix in-placeF)ÚcopyN)ÚreshapeÚasformatÚformatÚ__dict__)r   ÚshapeÚnew_selfr   r   r	   Ú	set_shape:   s   zspmatrix.set_shapec                 C   ó   | j S )zGet the shape of the matrix)Ú_shape©r   r   r   r	   Ú	get_shapeA   ó   zspmatrix.get_shapezShape of the matrix)ÚfgetÚfsetÚdocc                 C   ó   |   ¡ S )z7Upcast matrix to a floating point format (if necessary))Ú	_asfptyper5   r   r   r	   ÚasfptypeH   ó   zspmatrix.asfptypec                 C   r;   )z3Maximum number of elements to display when printed.)Ú_getmaxprintr5   r   r   r	   ÚgetmaxprintL   r>   zspmatrix.getmaxprintc                 C   r3   )zMatrix storage format)r.   r5   r   r   r	   Ú	getformatP   r7   zspmatrix.getformatNc                 C   s   | j |d�S )zóNumber of stored values, including explicit zeros.

        Parameters
        ----------
        axis : None, 0, or 1
            Select between the number of values across the whole array, in
            each column, or in each row.
        )Úaxis)Ú_getnnz)r   rB   r   r   r	   ÚgetnnzT   s   	zspmatrix.getnnzc                 C   s   |   ¡  ¡ S )z¤Return the Hermitian transpose of this matrix.

        See Also
        --------
        numpy.matrix.getH : NumPy's implementation of `getH` for matrices
        )Ú	conjugateÚ	transposer5   r   r   r	   ÚgetH_   s   zspmatrix.getHc                 C   r   )zgReturns a copy of column j of the matrix, as an (m x 1) sparse
        matrix (column vector).
        )Ú_getcol)r   Újr   r   r	   Úgetcolh   ó   
zspmatrix.getcolc                 C   r   )z`Returns a copy of row i of the matrix, as a (1 x n) sparse
        matrix (row vector).
        )Ú_getrow)r   Úir   r   r	   Úgetrown   rK   zspmatrix.getrowc                    s   t ƒ  ||¡S )aÅ  
        Return a dense representation of this sparse matrix.

        Parameters
        ----------
        order : {'C', 'F'}, optional
            Whether to store multi-dimensional data in C (row-major)
            or Fortran (column-major) order in memory. The default
            is 'None', which provides no ordering guarantees.
            Cannot be specified in conjunction with the `out`
            argument.

        out : ndarray, 2-D, optional
            If specified, uses this array (or `numpy.matrix`) as the
            output buffer instead of allocating a new array to
            return. The provided array must have the same shape and
            dtype as the sparse matrix on which you are calling the
            method.

        Returns
        -------
        arr : numpy.matrix, 2-D
            A NumPy matrix object with the same shape and containing
            the same data represented by the sparse matrix, with the
            requested memory order. If `out` was passed and was an
            array (rather than a `numpy.matrix`), it will be filled
            with the appropriate values and returned wrapped in a
            `numpy.matrix` object that shares the same memory.
        )ÚsuperÚtodense)r   ÚorderÚout©Ú	__class__r   r	   rP   t   s   zspmatrix.todenser   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	_allow_ndÚpropertyr
   r   r   r   r   r   r   r#   r&   r*   r2   r6   r0   r=   r@   rA   rD   rG   rJ   rN   rP   Ú__classcell__r   r   rS   r	   r      sB    






ÿ
	r   N)r   r   r   r   r	   Ú<module>   s    