csr_to_dense

Contents

csr_to_dense#

class brainpy.math.sparse.csr_to_dense(data, indices, indptr, *, shape)[source]#

Convert a CSR sparse matrix to a dense array.

Parameters:
  • data (ndarray) – An array of shape (nse,) holding the non-zero values.

  • indices (ndarray) – An array of shape (nse,) holding the column index of each value.

  • indptr (ndarray) – An array of shape (shape[0] + 1,) holding the row pointers.

  • shape (tuple of int) – A length-2 tuple (n_rows, n_cols) for the dense matrix.

Returns:

dense – The dense matrix of shape shape.

Return type:

ndarray