cupyx.scipy.sparse.rand#

cupyx.scipy.sparse.rand(m, n, density=0.01, format='coo', dtype=None, random_state=None)[source]#

Generates a random sparse matrix.

See cupyx.scipy.sparse.random() for detail.

Parameters:
  • m (int) – Number of rows.

  • n (int) – Number of cols.

  • density (float) – Ratio of non-zero entries.

  • format (str) – Matrix format.

  • dtype (dtype) – Type of the returned matrix values.

  • random_state (cupy.random.RandomState or int) – State of random number generator. If an integer is given, the method makes a new state for random number generator and uses it. If it is not given, the default state is used. This state is used to generate random indexes for nonzero entries.

Returns:

Generated matrix.

Return type:

cupyx.scipy.sparse.spmatrix