warp.sparse.bsr_zeros#
- warp.sparse.bsr_zeros(
- rows_of_blocks,
- cols_of_blocks,
- block_type,
- device=None,
- *,
- topology=None,
- row_capacity=None,
- nnz_capacity=None,
Construct and return an empty BSR or CSR matrix with the given shape.
- Parameters:
rows_of_blocks (int) – Number of rows of blocks.
cols_of_blocks (int) – Number of columns of blocks.
block_type (BlockType) – Type of individual blocks. For CSR matrices, this should be a scalar type. For BSR matrices, this should be a matrix type (e.g. from
warp.types.matrix()).device (wp.DeviceLike) – Device on which to allocate the matrix arrays.
topology (Literal['compact', 'padded'] | None) – Topology policy. Defaults to
"compact"unlessrow_capacityis provided, in which case it defaults to"padded".row_capacity (int | Array[int] | None) – Optional row capacity for padded matrices. May be a nonnegative integer for uniform capacity, or an integer Warp array of shape
(rows_of_blocks,)for per-row capacity. Providing this implies padded topology whentopologyis omitted.nnz_capacity (int | None) – Optional storage allocation upper bound for
columnsandvalues. This is mainly useful with per-rowrow_capacityarrays when an upper bound is already known. Whenrow_capacityis an array, the caller is responsible for ensuringnnz_capacityis at least the total row capacity. During CUDA graph capture, per-rowrow_capacityarrays require an explicitnnz_capacityto avoid a host readback.
- Return type: