o
    ?HhK                     @   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spmatrixzThis 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   T/home/air/sanwanet/gpt-api/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 )zNumber 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 )zReturn 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    