warp.sparse.bsr_block_index#

warp.sparse.bsr_block_index(
row: int,
col: int,
bsr_offsets: Array[int32],
bsr_columns: Array[int32],
) → int[source]#
  • Kernel: true

Return the index of the block at block-coordinates (row, col), or -1 if no such block exists.

Assumes that the segments of bsr_columns corresponding to each row are sorted. This overload searches the storage row bsr_offsets[row]:bsr_offsets[row + 1]. For matrices with padded row capacity, pass bsr_row_counts to search active blocks only.

Parameters:
  • row – Row of the block.

  • col – Column of the block.

  • bsr_offsets – Array of size at least 1 + row containing the offsets of the blocks in each row.

  • bsr_columns – Array of size at least equal to bsr_offsets[row + 1] containing the column indices of the blocks.

warp.sparse.bsr_block_index(
row: int,
col: int,
bsr_offsets: Array[int32],
bsr_columns: Array[int32],
bsr_row_counts: Array[int32],
) → int[source]
  • Kernel: true

Return the active block index in a capacity-aware BSR matrix, or -1 if no such block exists.

This row-capacity overload searches bsr_offsets[row]:bsr_offsets[row] + bsr_row_counts[row] and ignores slack storage. If bsr_row_counts is None, it falls back to compact storage rows defined by bsr_offsets.