brainpy.math.csr_matvec#

brainpy.math.csr_matvec(values, indices, indptr, vector, shape, transpose=False)[source]#

Product of CSR sparse matrix and a dense vector.

Parameters
  • values (Array) – An array of shape (nse,).

  • indices (ndarray) – An array of shape (nse,).

  • indptr (Array) – An array of shape (shape[0] + 1,) and dtype indices.dtype.

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

  • shape (tuple of int) – A length-2 tuple representing the matrix shape.

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

Returns

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

Return type

Array