
    _-Phy	                     (    d Z ddlZddlZd ZddZdS )zRandom sparse matrices.    Nc                    t          t          t          | |z  |z            | |z            d          }t          j                            d| dz
  |          }t          j                            d|dz
  |          }t          j        |t                    }t          j	        
                    |||ff| |f          S )z,Construct base function for sprand, sprandn.r      )lowhighsize)dtype)shape)maxminintnprandomrandintonesfloatspsparse
csr_matrix)mndensitynnzrowcoldatas          [/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pyamg/gallery/random_sparse.py_rand_sparser      s    
c#ac'k""AaC((!
,
,C
)

!#

6
6C
)

!#

6
6C73e$$$D 9Sz 21a&AAA    csrc                     t          |           t          |          }} t          | ||          }t          j                            |j                  |_        |                    |          S )a  Return a random sparse matrix.

    Parameters
    ----------
    m, n : int
        shape of the result
    density : float
        target a matrix with nnz(A) = m*n*density, 0<=density<=1
    format : string
        sparse matrix format to return, e.g. 'csr', 'coo', etc.

    Returns
    -------
    A : sparse matrix
        m x n sparse matrix

    Examples
    --------
    >>> from pyamg.gallery import sprand
    >>> A = sprand(5,5,3/5.0)

    )r   r   r   r   randr   r   asformat)r   r   r   formatAs        r   sprandr%      sW    . q663q66qA 	Q7##A Y^^AE""AF::fr   )r   )__doc__numpyr   scipyr   r   r%    r   r   <module>r*      sU             	B 	B 	B     r   