cupyx.scipy.sparse.rand#

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

生成一个随机的稀疏矩阵。

详情请参见 cupyx.scipy.sparse.random()

参数:
  • m (int) – 行数。

  • n (int) – 列数。

  • density (float) – 非零条目的比例。

  • format (str) – 矩阵格式。

  • dtype (dtype) – 返回矩阵值的类型。

  • random_state (cupy.random.RandomState or int) – 随机数生成器的状态。如果给定一个整数,该方法会为随机数生成器创建一个新状态并使用它。如果未给定,则使用默认状态。此状态用于生成非零条目的随机索引。

返回:

生成的矩阵。

返回类型:

cupyx.scipy.sparse.spmatrix