coomv

Contents

coomv#

class brainpy.math.sparse.coomv(data, row, col, vector, *, shape, transpose=False)[source]#

Product of COO sparse matrix and a dense vector.

The brainevent COO format was removed in v0.1.0, so the COO indices are converted to CSR (via brainevent.coo2csr()) and the multiplication is delegated to brainevent.CSR.

This function supports JAX transformations, including jit(), grad(), vmap() and pmap().

Parameters:
  • data (Union[float, Array, Array]) – An array of shape (nse,).

  • row (Union[Array, Array]) – An array of shape (nse,).

  • col (Union[Array, Array]) – An array of shape (nse,) and dtype row.dtype.

  • vector (Union[Array, Array]) – An array of shape (shape[0] if transpose else shape[1],) and dtype data.dtype.

  • shape (Tuple[int, int]) – The shape of the sparse matrix.

  • transpose (bool) – A boolean specifying whether to transpose the sparse matrix before computing.

Returns:

y – An array of shape (shape[1] if transpose else shape[0],) representing the matrix vector product.

Return type:

ndarray