jax.experimental.sparse.bcoo_fromdense

Contents

jax.experimental.sparse.bcoo_fromdense#

jax.experimental.sparse.bcoo_fromdense(mat, *, nse=None, n_batch=0, n_dense=0, index_dtype=<class 'jax.numpy.int32'>)[source]#

Create BCOO-format sparse matrix from a dense matrix.

Parameters:
  • mat (Array) – array to be converted to BCOO.

  • nse (int | None) – number of specified elements in each batch

  • n_batch (int) – number of batch dimensions (default: 0)

  • n_dense (int) – number of block_dimensions (default: 0)

  • index_dtype (DTypeLike) – dtype of sparse indices (default: int32)

Returns:

BCOO representation of the matrix.

Return type:

mat_bcoo