
    9=e                     6    d dl mZmZ  G d d          Zd ZdS )   )	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dS )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     4lib/python3.11/site-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                 ,    |                      |          S N)_mul_dispatchr
   others     r   __mul__zspmatrix.__mul__/   s    !!%(((r   c                 ,    |                      |          S r(   )_rmul_dispatchr*   s     r   __rmul__zspmatrix.__rmul__2   s    ""5)))r   c                    | j         \  }}||k    rt          d          t          |          rt          |          }|dk     rt	          d          |dk    rddlm}  ||| j                  S |dk    r|                                 S | 	                    |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    z1669:::U 	!JJEqyy !8999zz++++++s1DJ////zzyy{{",,uz**Cqy !czC''Sy  	<:;;;r   c                 |    |                      |d                              | j                  }|j        | _        dS )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   s7     <<E<22;;DKH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                 *    |                                  S )z6Upcast array to a floating point format (if necessary))	_asfptyperI   s    r   asfptypezspmatrix.asfptypea   s    ~~r   c                 *    |                                  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                 .    |                      |          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                 N    |                                                                  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                 ,    |                      |          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                 ,    |                      |          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  X   X   X   X   X   X   X
) ) )* * *  :* * *   H)).0 0 0E     # # #  	' 	' 	' 	', , ,      r   r   c                 ^    | d S |                      dd                               dd          S )Nzsparse arrayszsparse matriceszsparse arrayzsparse matrix)replace)docstrs    r   _array_doc_to_matrixrr      s2    ~t(9::w~77r   N)_sputilsr   r   r   rr   rn   r   r   <module>rt      sg    - - - - - - - -G G G G G G G GT    r   