
    xf                     .    d dl mZmZ  G d d      Zd Zy)   )	isintlikeisscalarlikec                       e Zd ZdZdZed        Zed        Zed        Zed        Z	ed        Z
ed        Zed	        Zd
 Zd Zd Zd Zd Z eeed      Zd Zd Zd ZddZd Zd Zd Zy)spmatrixzThis class provides a base class for all sparse matrix classes.

    It cannot be instantiated.  Most of the work is provided by subclasses.
    Fc                     ddl m} |S )Nr   )
bsr_matrix)_bsrr   )selfr   s     6/usr/lib/python3/dist-packages/scipy/sparse/_matrix.py_bsr_containerzspmatrix._bsr_container       $    c                     ddl m} |S )Nr   )
coo_matrix)_coor   )r
   r   s     r   _coo_containerzspmatrix._coo_container   r   r   c                     ddl m} |S )Nr   )
csc_matrix)_cscr   )r
   r   s     r   _csc_containerzspmatrix._csc_container   r   r   c                     ddl m} |S )Nr   )
csr_matrix)_csrr   )r
   r   s     r   _csr_containerzspmatrix._csr_container   r   r   c                     ddl m} |S )Nr   )
dia_matrix)_diar   )r
   r   s     r   _dia_containerzspmatrix._dia_container   r   r   c                     ddl m} |S )Nr   )
dok_matrix)_dokr    )r
   r    s     r   _dok_containerzspmatrix._dok_container$   r   r   c                     ddl m} |S )Nr   )
lil_matrix)_lilr$   )r
   r$   s     r   _lil_containerzspmatrix._lil_container)   r   r   c                 $    | j                  |      S N)_mul_dispatchr
   others     r   __mul__zspmatrix.__mul__/   s    !!%((r   c                 $    | j                  |      S r(   )_rmul_dispatchr*   s     r   __rmul__zspmatrix.__rmul__2   s    ""5))r   c                 x   | j                   \  }}||k7  rt        d      t        |      rut        |      }|dk  rt	        d      |dk(  rddlm}  ||| j                        S |dk(  r| j                         S | j                  |dz        }|dz  r| |z  |z  S ||z  S t        |      rt	        d      t        S )	Nzsparse matrix is not square    zexponent must be >= 0r   )eye)dtype   zexponent must be an integer)shape	TypeErrorr   int
ValueError
_constructr2   r3   copy__pow__r   NotImplemented)r
   r+   MNr2   tmps         r   r;   zspmatrix.__pow__6   s    zz169::UJEqy !899z+1DJJ//zyy{",,uz*CqyczC''Sy :;;r   c                 ~    | j                  |d      j                  | j                        }|j                  | _        y)z$Set the shape of the matrix in-placeF)r:   N)reshapeasformatformat__dict__)r
   r5   new_selfs      r   	set_shapezspmatrix.set_shapeS   s2     <<E<2;;DKKH ))r   c                     | j                   S )zGet the shape of the matrix)_shaper
   s    r   	get_shapezspmatrix.get_shapeZ       {{r   zShape of the matrix)fgetfsetdocc                 "    | j                         S )z6Upcast array to a floating point format (if necessary))	_asfptyperI   s    r   asfptypezspmatrix.asfptypea   s    ~~r   c                 "    | j                         S )z3Maximum number of elements to display when printed.)_getmaxprintrI   s    r   getmaxprintzspmatrix.getmaxprinte   s      ""r   c                     | j                   S )zMatrix storage format)rC   rI   s    r   	getformatzspmatrix.getformati   rK   r   Nc                 &    | j                  |      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
   rX   s     r   getnnzzspmatrix.getnnzm   s     |||&&r   c                 >    | j                         j                         S )zReturn the Hermitian transpose of this array.

        See Also
        --------
        numpy.matrix.getH : NumPy's implementation of `getH` for matrices
        )	conjugate	transposerI   s    r   getHzspmatrix.getHx   s     ~~))++r   c                 $    | j                  |      S )zeReturns a copy of column j of the array, as an (m x 1) sparse
        array (column vector).
        )_getcol)r
   js     r   getcolzspmatrix.getcol        ||Ar   c                 $    | j                  |      S )z^Returns a copy of row i of the array, as a (1 x n) sparse
        array (row vector).
        )_getrow)r
   is     r   getrowzspmatrix.getrow   rc   r   r(   )__name__
__module____qualname____doc__	_is_arraypropertyr   r   r   r   r   r"   r&   r,   r/   r;   rF   rJ   r5   rQ   rT   rV   rZ   r^   rb   rg    r   r   r   r      s     I             
)*:* )).0E #	',r   r   c                 L    | y | j                  dd      j                  dd      S )Nzsparse arrayszsparse matriceszsparse arrayzsparse matrix)replace)docstrs    r   _array_doc_to_matrixrr      s*    ~(9:w~7r   N)_sputilsr   r   r   rr   rn   r   r   <module>rt      s    -G GTr   