warp.sparse.bsr_set_zero#

warp.sparse.bsr_set_zero(
bsr,
rows_of_blocks=None,
cols_of_blocks=None,
*,
topology='compact',
row_capacity=None,
nnz_capacity=None,
)[source]#

Set a BSR matrix to zero, possibly changing its size.

Parameters:
  • bsr (BsrMatrix) – The BSR or CSR matrix to set to zero.

  • rows_of_blocks (int | None) – If not None, the new number of rows of blocks.

  • cols_of_blocks (int | None) – If not None, the new number of columns of blocks.

  • topology (Literal['compact', 'padded', 'masked']) – Topology policy. "compact" discards the active and capacity topology, "padded" keeps row capacity and makes every row empty when the matrix size is unchanged, and "masked" keeps active topology and zeroes values.

  • row_capacity (int | Array[int] | None) – Optional reserved block capacity for each row when topology="padded". May be a nonnegative integer for uniform row capacity, or an integer Warp array of shape (rows_of_blocks,) for per-row capacity. If None, existing row capacity is preserved for retained rows, and added rows get zero capacity.

  • nnz_capacity (int | None) – Optional storage allocation upper bound for columns and values. When row_capacity is an array, the caller is responsible for ensuring nnz_capacity is at least the total row capacity. Ignored with topology="masked".