arkouda.sparsematrix

Functions

random_sparse_matrix(→ arkouda.sparrayclass.sparray)

Create a random sparse matrix with the specified number of rows and columns

sparse_matrix_matrix_mult(→ arkouda.sparrayclass.sparray)

Multiply two sparse matrices.

Module Contents

arkouda.sparsematrix.random_sparse_matrix(size: int, density: float, layout: str) arkouda.sparrayclass.sparray[source]

Create a random sparse matrix with the specified number of rows and columns and the specified density. The density is the fraction of non-zero elements in the matrix. The non-zero elements are uniformly distributed random numbers in the range [0,1).

Parameters:
  • size (int) – The number of rows in the matrix, columns are equal to rows right now

  • density (float) – The fraction of non-zero elements in the matrix

  • dtype (Union[DTypes, str]) – The dtype of the elements in the matrix

Returns:

A sparse matrix with the specified number of rows and columns and the specified density

Return type:

sparray

Raises:

ValueError – Raised if density is not in the range [0,1]

arkouda.sparsematrix.sparse_matrix_matrix_mult(A, B: arkouda.sparrayclass.sparray) arkouda.sparrayclass.sparray[source]

Multiply two sparse matrices.

Parameters:
  • A (sparray) – The left-hand sparse matrix

  • B (sparray) – The right-hand sparse matrix

Returns:

The product of the two sparse matrices

Return type:

sparray